PHP-Quelltext |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 |
<?php
error_reporting(E_ALL);
/**************************************************
Formulargenerator v1.0 by 4Webmaster.net
Programmed by Borlabs
Website: www.borlabs.de
visit www.4webmaster.net
**************************************************/
$error = false;
$errors = array();
$receiver = 'spamschutz@arcor.de';
function check_email ($string) {
// RegEx created by Myle Ott, found at regexlib.com
return preg_match('/^([a-zA-Z0-9_\-])+(\.([a-zA-Z0-9_\-])+)*@((\[(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5])))\.(((([0-1])?([0-9])?[0-9])|(2[0-4][0-9])|(2[0-5][0-5]))\]))|((([a-zA-Z0-9])+(([\-])+([a-zA-Z0-9])+)*\.)+([a-zA-Z])+(([\-])+([a-zA-Z0-9])+)*))$/i', $string);
}
function check_onlynumbers ($string) {
return preg_match('/^[0-9,.]{1,}$/', $string);
}
function check_onlyletters ($string) {
return preg_match('/^[a-zA-ZäöüÄÖÜß]{1,}$/', $string);
}
function send_email ($subject, $body, $receiver, $html = 1) {
if ($html != 1) {
$body = str_replace('<br />', "\n", $body);
$body = str_replace('<br>', "\n", $body);
$body = strip_tags($body);
}
$subject = str_replace('\n', '', $subject);
$subject = str_replace('\r', '', $subject);
if ($html) {
$header = 'MIME-Version: 1.0' . "\n";
$header .= 'Content-type: text/html; charset=iso-8859-15'."\n";
$header .= 'From: '.$receiver.' <'.$receiver.'>'."\n";
} else {
$header = 'MIME-Version: 1.0' . "\n";
$header .= 'From: '.$receiver.' <'.$receiver.'>'."\n";
}
if (mail($receiver, $subject, $body, $header)) {
return true;
} else {
return false;
}
}
function array_stripslashes(&$var) {
if(is_string($var)) {
$var = stripslashes($var);
} else {
if(is_array($var))
foreach($var as $key => $value)
array_stripslashes($var[$key]);
}
}
if(get_magic_quotes_gpc()){
array_stripslashes($_GET);
array_stripslashes($_POST);
array_stripslashes($_REQUEST);
array_stripslashes($_COOKIE);
}
if (!empty($_POST)) {
// Prüfung für das Feld "Familienname"
$errors['Name_'] = null; if (empty($_POST['Name_'])) {
$error = true;
$errors['Name_'] = ' class="error"'; }
// Prüfung für das Feld "Vorname"
$errors['Vorname_'] = null; if (empty($_POST['Vorname_'])) {
$error = true;
$errors['Vorname_'] = ' class="error"'; }
// Prüfung für das Feld "Straße + Hausnummer"
$errors['Strasse_'] = null; if (empty($_POST['Strasse_'])) {
$error = true;
$errors['Strasse_'] = ' class="error"'; }
// Prüfung für das Feld "Wohnort + PLZ"
$errors['Ort_'] = null; if (empty($_POST['Ort_'])) {
$error = true;
$errors['Ort_'] = ' class="error"'; }
// Prüfung für das Feld "Kartenanzahl Erwachsene"
$errors['Kartenanzahl_Erwachsene_'] = null; if (empty($_POST['Kartenanzahl_Erwachsene_'])) {
$error = true;
$errors['Kartenanzahl_Erwachsene_'] = ' class="error"'; }
if (!check_onlynumbers($_POST['Kartenanzahl_Erwachsene_'])) {
$error = true;
$errors['Kartenanzahl_Erwachsene_'] = ' class="error"'; }
// Prüfung für das Feld "Kartenanzahl Kinder"
$errors['Kartenanzahl_Kinder_'] = null; if (empty($_POST['Kartenanzahl_Kinder_'])) {
$error = true;
$errors['Kartenanzahl_Kinder_'] = ' class="error"'; }
if (!check_onlynumbers($_POST['Kartenanzahl_Kinder_'])) {
$error = true;
$errors['Kartenanzahl_Kinder_'] = ' class="error"'; }
// Prüfung für das Feld "E-Mail"
$errors['E_Mail_'] = null; if (empty($_POST['E_Mail_'])) {
$error = true;
$errors['E_Mail_'] = ' class="error"'; }
if (!empty($_POST['E_Mail_']) && !check_email($_POST['E_Mail_'])) {
$error = true;
$errors['E_Mail_'] = ' class="error"'; }
// Prüfung für das Feld "Sonstiges"
$errors['Sonstiges_'] = null; if (empty($_POST['Sonstiges_'])) {
$error = true;
$errors['Sonstiges_'] = ' class="error"'; }
}
$_text_Name_ = (!empty($_POST['Name_']) ? htmlspecialchars($_POST['Name_'], ENT_QUOTES, 'iso-8859-15') : null);
$_text_Vorname_ = (!empty($_POST['Vorname_']) ? htmlspecialchars($_POST['Vorname_'], ENT_QUOTES, 'iso-8859-15') : null);
$_text_Strasse_ = (!empty($_POST['Strasse_']) ? htmlspecialchars($_POST['Strasse_'], ENT_QUOTES, 'iso-8859-15') : null);
$_text_Ort_ = (!empty($_POST['Ort_']) ? htmlspecialchars($_POST['Ort_'], ENT_QUOTES, 'iso-8859-15') : null);
$_text_Kartenanzahl_Erwachsene_ = (!empty($_POST['Kartenanzahl_Erwachsene_']) ? htmlspecialchars($_POST['Kartenanzahl_Erwachsene_'], ENT_QUOTES, 'iso-8859-15') : null);
$_text_Kartenanzahl_Kinder_ = (!empty($_POST['Kartenanzahl_Kinder_']) ? htmlspecialchars($_POST['Kartenanzahl_Kinder_'], ENT_QUOTES, 'iso-8859-15') : null);
$_text_E_Mail_ = (!empty($_POST['E_Mail_']) ? htmlspecialchars($_POST['E_Mail_'], ENT_QUOTES, 'iso-8859-15') : null);
$_textarea_Sonstiges_ = (!empty($_POST['Sonstiges_']) ? htmlspecialchars($_POST['Sonstiges_'], ENT_QUOTES, 'iso-8859-15') : null);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15" />
<!--
Formulargenerator v1.0 by 4Webmaster.net
Programmed by Borlabs
Website: www.borlabs.de
visit www.4webmaster.net
-->
<title>Karten bestellen</title>
<style type="text/css">
body {
font: 12px Verdana, Tahoma, Arial, Helvetica, sans-serif;
color: #444;
}
h1, p {
margin: 10px; padding: 0px;
}
textarea {
width: 350px;
padding: 2px;
font: normal 12px Verdana, sans-serif;
border: 1px solid #828790;
height: 100px;
color: #777;
}
input.button {
margin: 0;
font: bolder 12px Arial, Sans-serif;
border: 1px solid #828790;
padding: 1px;
background: #FFF;
color: #CC0000;
}
.error_msg {
padding: 4px;
background-color: #ffeeee;
border: 1px dotted #cc0000;
margin: 5px 10px 5px 10px;
color: #cc0000;
}
.error { color: #cc0000; }
fieldset { width: 570px; }
div.formulargenerator-4webmaster label,
div.formulargenerator-4webmaster .controlset span {
width: 150px;
display: block;
float: left;
text-align: right;
}
div.formulargenerator-4webmaster label { margin: 5px; }
div.formulargenerator-4webmaster .controlset span { margin: 0px 0px 0px 5px; }
div.formulargenerator-4webmaster .controlset label {
display: inline;
float: none;
}
div.formulargenerator-4webmaster .controlset input { margin: 0px 0px 0px 10px; }
div.formulargenerator-4webmaster input,
div.formulargenerator-4webmaster select,
div.formulargenerator-4webmaster textarea {
margin: 2px 2px 2px 5px;
}
div.formulargenerator-4webmaster div { clear: both; }
</style>
</head>
<body>
<?php
if ($error || empty($_POST)) {?>
<form action="<?php echo htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'iso-8859-15'); ?>" method="post">
<div class="formulargenerator-4webmaster">
<?php if ($error) { ?>
<div class="error_msg">Bitte alle mit * markierten Felder ausfüllen.</div>
<?php } ?><div>
<label for="Name_"<?php echo !empty($errors['Name_']) ? $errors['Name_'] : null ; ?>>Familienname *</label>
<input tabindex="1" type="text" maxlength="50" id="Name_" name="Name_" value="<?php echo $_text_Name_; ?>" />
</div>
<div>
<label for="Vorname_"<?php echo !empty($errors['Vorname_']) ? $errors['Vorname_'] : null ; ?>>Vorname *</label>
<input tabindex="2" type="text" maxlength="50" id="Vorname_" name="Vorname_" value="<?php echo $_text_Vorname_; ?>" />
</div>
<div>
<label for="Strasse_"<?php echo !empty($errors['Strasse_']) ? $errors['Strasse_'] : null ; ?>>Straße + Hausnummer *</label>
<input tabindex="3" type="text" maxlength="100" id="Strasse_" name="Strasse_" value="<?php echo $_text_Strasse_; ?>" />
</div>
|