Checking for a bad email for registering...
Posted: Sat Dec 09, 2006 6:50 am
feyd | Please use
Any ideas?
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
What happens is, I enter the info, yeah it's great, whatever. But then I go to the next page (after hitting my register button) and it says... well, nothing, but it's supposed to. However, it won't add anything, it's like it's being blocked by the filter for emails, but it just... won't work... for real emails. Basically, I've set up a guard to stop entries without "." or "@" to stop from bad emails. Or, typo's.
Here's what I've got altogether.Code: Select all
<?php
$con = mysql_connect("localhost","burnttoa_umonbre","*****");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
$username = $_POST["username"];
$password = $_POST["password"];
$cpassword = $_POST["cpassword"];
$email = $_POST["email"];
if ($password == $cpassword)
;
else
die("It seems you've typo'd your password, please go back and enter it again!");
$findmail = strpos($email, "@");
$finddot = strpos($email, ".");
if ($findmail === false)
{
echo "You did not enter a valid email address; <a href=\"javascript:history.back\">Go back</a> and enter\n
a valid email adress";
$continue = false;
if ($finddot === false)
{
$continue = false;
}
}
else
{
if ($continue != false)
{
mysql_select_db("burnttoa_monbre", $con);
mysql_query("INSERT INTO user (ID, name, pword, email, money, ranch, barn, happy, tlevel)
VALUES ('', '$username', '$password', '$email', '3000', '1', '1', '70', '1')")
or die(mysql_error());
mysql_query("INSERT INTO items (userbagID)
VALUES ('')")
or die(mysql_error());
}
}
?>feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]