jeffnick
11-25-2009, 10:49 AM
Hi there,
I just signed up with bluehost and i am transferring my script from my old server to here. I ran into a problem. My script uses a registration form that users sign up with their email, and the script would then send them their user info details.
But for some odd reason, after moving the script here, when a user signs up using my registration form, they never receive their confirmation email.
Can some kind soul look at my registration.php file below and tell me if I need a special setting to get it to work in Bluehost. I was using this same script at hostgator for 3 years but never ran into this problem with the server not sending the confirmations out. Thanks in advance :)
<?
include("headers.php");
if($createaccount == 1){
$badname=badname($username); //check to see if username is bad
$host=gethostbyaddr("$REMOTE_ADDR");
if($badname == BAD){ $msg="Username already taken!"; }
elseif(strstr($host, ".access.telenet.be")){ $msg="We're sorry, alot of abuse comes from your internet provider, so we do not allow any new registrations from your network."; }
elseif(strstr($host, "8.server.ntli.net")){ $msg="We're sorry, alot of abuse comes from your internet provider, so we do not allow any new registrations from your network."; }
elseif(strstr($host, "6.server.ntli.net")){ $msg="We're sorry, alot of abuse comes from your internet provider, so we do not allow any new registrations from your network."; }
elseif($REMOTE_ADDR == "69.142.155.109"){ $msg="What dont you understand, YOU ARE NOT WELCOME HERE! Have a nice day."; }
elseif(!is_letter($username)){ $msg="Please use only a-Z charactors in your username."; $username=""; }
elseif((strlen($username) <= 2) || (strlen($username) >= 13)){ $msg="Your username must be between 3-12 charactors long."; $username=""; }
elseif(fetch("SELECT username FROM $tab[account] WHERE username='$username';")){ $msg="Username already taken!"; $username="";}
elseif(!ereg("^.+@.+\\..+$", $email)){ $msg="That is not a valid e-mail address."; $email=""; $cemail=""; }
elseif(fetch("SELECT email FROM $tab[account] WHERE email='$email';")){ $msg="E-mail already in use."; $email=""; $cemail=""; }
elseif($email != $cemail){ $msg="The e-mails you entered do not match."; $email=""; $cemail=""; }
elseif($agree != 1){ $msg="Your must agree to our terms."; }
else{
// if($humancheck != $unique)
// { $check=failed; $msg="The code you entered was incorrect. Try again."; }
//else{
$password=randcode();
$code=randcode();
mysql_query("INSERT INTO $tab[account] (username,password,email,host,ip,code,joined) VALUES ('$username','$password','$email','$host','$REMOTE _ADDR','$code','$time');");
mailuser("Welcome to $site[name]!","\nWelcome to $site[name]!\n\nYour account information:\n Username: $username\n Password: $password\n\n\n- Admins \n$site[url]","$email");
$complete=yes;
//}
}
}
htmlheader("create empire");
?>
<table width="100%" height="100%">
<tr>
<td align="center" valign="middle">
<?if($complete==yes){ session_destroy(); ?>
<br><b><font color="#FFFFFF">You've got mail!</font></b>
<br>A message has been sent to your e-mail containing the password to login.
<br>
<br>
<?}else{?>
<form method="post" action="register.php">
<?if($msg){?><font color="red"><?=$msg?></font><br><?}?>
<?if($check == failed){?>
<input type="hidden" name="secretcode" value="<?=$secretcode?>">
<input type="hidden" name="username" value="<?=$username?>">
<input type="hidden" name="email" value="<?=$email?>">
<input type="hidden" name="cemail" value="<?=$cemail?>">
<input type="hidden" name="agree" value="1">
<?}else{?>
<br><font color="white">Username:</font>
<br><input type="text" class="input" name="username" value="<?=$username?>">
<br>
<br><font color="white">E-mail:</font>
<br><input type="text" class="input" name="email" value="<?=$email?>">
<br><small>your password will be mailed here</small>
<br>
<br><font color="white">Confirm E-mail:</font>
<br><input type="text" class="input" name="cemail" value="<?=$cemail?>">
<br>
<br><input type="checkbox" name="agree" value="1"> <b><font color="white">I AGREE</font></b> that this is my ONLY ACCOUNT<br>and that i have read the <a href="rules.php" target="_parent">game rules</a>.
<br>
<?}?>
<!--
<br><font color="white">Enter the charactors shown below:</font>
<br><img src="humancheck.php">
<br><input type="text" class="input" name="unique">
!-->
<br>
<br><input type="hidden" name="createaccount" value="1"><input type="submit" class="button" value="register">
</form>
<?}?>
<a href="javascript:window.close();">close</a>
</td>
</tr>
</table>
<?
htmlfooter();
?>
I just signed up with bluehost and i am transferring my script from my old server to here. I ran into a problem. My script uses a registration form that users sign up with their email, and the script would then send them their user info details.
But for some odd reason, after moving the script here, when a user signs up using my registration form, they never receive their confirmation email.
Can some kind soul look at my registration.php file below and tell me if I need a special setting to get it to work in Bluehost. I was using this same script at hostgator for 3 years but never ran into this problem with the server not sending the confirmations out. Thanks in advance :)
<?
include("headers.php");
if($createaccount == 1){
$badname=badname($username); //check to see if username is bad
$host=gethostbyaddr("$REMOTE_ADDR");
if($badname == BAD){ $msg="Username already taken!"; }
elseif(strstr($host, ".access.telenet.be")){ $msg="We're sorry, alot of abuse comes from your internet provider, so we do not allow any new registrations from your network."; }
elseif(strstr($host, "8.server.ntli.net")){ $msg="We're sorry, alot of abuse comes from your internet provider, so we do not allow any new registrations from your network."; }
elseif(strstr($host, "6.server.ntli.net")){ $msg="We're sorry, alot of abuse comes from your internet provider, so we do not allow any new registrations from your network."; }
elseif($REMOTE_ADDR == "69.142.155.109"){ $msg="What dont you understand, YOU ARE NOT WELCOME HERE! Have a nice day."; }
elseif(!is_letter($username)){ $msg="Please use only a-Z charactors in your username."; $username=""; }
elseif((strlen($username) <= 2) || (strlen($username) >= 13)){ $msg="Your username must be between 3-12 charactors long."; $username=""; }
elseif(fetch("SELECT username FROM $tab[account] WHERE username='$username';")){ $msg="Username already taken!"; $username="";}
elseif(!ereg("^.+@.+\\..+$", $email)){ $msg="That is not a valid e-mail address."; $email=""; $cemail=""; }
elseif(fetch("SELECT email FROM $tab[account] WHERE email='$email';")){ $msg="E-mail already in use."; $email=""; $cemail=""; }
elseif($email != $cemail){ $msg="The e-mails you entered do not match."; $email=""; $cemail=""; }
elseif($agree != 1){ $msg="Your must agree to our terms."; }
else{
// if($humancheck != $unique)
// { $check=failed; $msg="The code you entered was incorrect. Try again."; }
//else{
$password=randcode();
$code=randcode();
mysql_query("INSERT INTO $tab[account] (username,password,email,host,ip,code,joined) VALUES ('$username','$password','$email','$host','$REMOTE _ADDR','$code','$time');");
mailuser("Welcome to $site[name]!","\nWelcome to $site[name]!\n\nYour account information:\n Username: $username\n Password: $password\n\n\n- Admins \n$site[url]","$email");
$complete=yes;
//}
}
}
htmlheader("create empire");
?>
<table width="100%" height="100%">
<tr>
<td align="center" valign="middle">
<?if($complete==yes){ session_destroy(); ?>
<br><b><font color="#FFFFFF">You've got mail!</font></b>
<br>A message has been sent to your e-mail containing the password to login.
<br>
<br>
<?}else{?>
<form method="post" action="register.php">
<?if($msg){?><font color="red"><?=$msg?></font><br><?}?>
<?if($check == failed){?>
<input type="hidden" name="secretcode" value="<?=$secretcode?>">
<input type="hidden" name="username" value="<?=$username?>">
<input type="hidden" name="email" value="<?=$email?>">
<input type="hidden" name="cemail" value="<?=$cemail?>">
<input type="hidden" name="agree" value="1">
<?}else{?>
<br><font color="white">Username:</font>
<br><input type="text" class="input" name="username" value="<?=$username?>">
<br>
<br><font color="white">E-mail:</font>
<br><input type="text" class="input" name="email" value="<?=$email?>">
<br><small>your password will be mailed here</small>
<br>
<br><font color="white">Confirm E-mail:</font>
<br><input type="text" class="input" name="cemail" value="<?=$cemail?>">
<br>
<br><input type="checkbox" name="agree" value="1"> <b><font color="white">I AGREE</font></b> that this is my ONLY ACCOUNT<br>and that i have read the <a href="rules.php" target="_parent">game rules</a>.
<br>
<?}?>
<!--
<br><font color="white">Enter the charactors shown below:</font>
<br><img src="humancheck.php">
<br><input type="text" class="input" name="unique">
!-->
<br>
<br><input type="hidden" name="createaccount" value="1"><input type="submit" class="button" value="register">
</form>
<?}?>
<a href="javascript:window.close();">close</a>
</td>
</tr>
</table>
<?
htmlfooter();
?>