- Code: Select all
<?
function controlStringErrors($string){
$string = str_replace("'", " ", $string);
$string = str_replace('"', " ", $string);
return $string;
}
if (!isset($_POST['Continue']))
{
echo '<div class="forminfo">Oops! You must have come here by accident. Click <a href="http://www.lowdownbids.com">here</a> to continue on.</div>';
exit();
}
else
{
require_once("Database.php");
$name=controlStringErrors($_POST['name']);
$lname=strtolower($name);
$username=controlStringErrors($_POST['username']);
$password=controlStringErrors($_POST['password']);
$address=controlStringErrors($_POST['address']);
for ($i=0; $i<strlen($zip); i++)
{
switch(substr($zip, $i, 1)){
case 9:
$goodstring=true;
continue;
case 8:
$goodstring=true;
continue;
case 7:
$goodstring=true;
continue;
case 6:
$goodstring=true;
continue;
case 5:
$goodstring=true;
continue;
case 4:
$goodstring=true;
continue;
case 3:
$goodstring=true;
continue;
case 2:
$goodstring=true;
continue;
case 1:
$goodstring=true;
continue;
case 0:
$goodstring=true;
continue;
default:
$goodstring=false;
}
if (!$goodstring)
{
break;
}
}
$zip=controlStringErrors($_POST['zip']);
//check if the username is taken
$username_taken=false;
if ($username_taken)
{
echo "The username '$name' is taken!";
}
$email=controlStringErrors($_POST['email']);
echo "<div class=\"forminfo\">A confirmation email has been sent to '$email'</div>";
}
?>
In the case where $_POST['submit'] isn't defined, here is what the user is shown.
Oops! You must have come here by accident. Click here to continue on.'; exit(); } else { require_once("Database.php"); $name=controlStringErrors($_POST['name']); $lname=strtolower($name); $username=controlStringErrors($_POST['username']); $password=controlStringErrors($_POST['passwrod']); $address=controlStringErrors($_POST['address']); for ($i=0; $iA confirmation email has been sent to '$email'"; } ?>
Why isn't it stopping at the single quote after the word on?