I have created a simple login / register form in php, it works very well in local host.
When testing in localhost when i try and register the same email address twice then it informs me that the email is already taken. However i have now uploaded my entire login form to go daddy hosting cpanel and it for some reason allows me to register the same email twice ?? I think this is a bit odd considering its the exact same code uploaded.
Here is my register form ....
If anyone has some tips it would be greatly appreciated
<?php
if(isset($_SESSION['user'])!="")
{
header("Location: home.php");
}
include_once 'dbconnect.php';
if(isset($_POST['btn-signup']))
{
$uname = mysql_real_escape_string($_POST['uname']);
$sname = mysql_real_escape_string($_POST['sname']);
$email = mysql_real_escape_string($_POST['email']);
$upass = md5(mysql_real_escape_string($_POST['pass']));
a:
if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
?>
<script>
window.onload = function() { document.getElementById('register_error').innerHTML = 'Invalid Email Address'; };
</script>
<?php
return;
goto a;
}
if(mysql_query("INSERT INTO users(username,second_name,email,password) VALUES('$uname','$sname','$email','$upass')"))
{
header( "refresh:5; url=login.php" );
?>
<script>
window.onload = function() { document.getElementById('register_success').innerHTML = 'Sucessfully Registered, You will now be redirected to the login page'; };
</script> <?php
}
else
{
?>
<script>window.onload = function() { document.getElementById('register_error').innerHTML = 'This email is allready taken'; };
</script> <?php
}
}
?>