Please help me to figure out what is the problem with this code.I ve tried register and successful.I received the confirmation email (username & password) and i can successfully sign in to the website. But, when i tried with other mail account, i received the confirmation email but i can't sign in to the website. When i checked the database, the registration info was not insert into the database. So, i am really confused why the codes works properly only for the certain mail address and not for all mail address.
Successfully insert to the database (eg:yahoo,gmail)
Didn't save / insert to the database (eg:marin-dbase.com)(my other account for other domains)
Here is the code
PHP Code:
<? include("../conn/conndb.inc") ?>
<?php
$username=$_POST['username'];
$sql="SELECT username FROM member WHERE username='$username'";
$result = mysql_query($sql) or die('Query failed. ' . mysql_error());
//jumpa username yg sama
if (mysql_num_rows($result) == 1) {
{
//generating password
# all the chars we want to use
$length=8;
$all=explode(" ",
"a b c d e f g h i j k l m n o p q r s t u v w x y z "
. "A B C D E F G H I J K L M N O P Q R S T U V W X Y Z "
. "0 1 2 3 4 5 6 7 8 9");
for($i=0;$i<$length;$i++) {
srand((double)microtime()*1000000);
$randy=rand(0, 61);
$pass.=$all[$randy];
}
//print "$pass";
//print "<br> Generating password compelete";
//end generate password
$salutation=$_POST['salutation'];
$name=$_POST['name'];
$nationality=$_POST['nationality'];
$address=$_POST['address'];
$postal_code=$_POST['postal_code'];
$city=$_POST['city'];
$state=$_POST['state'];
$country=$_POST['country'];
$contactNo=$_POST['contactNo'];
$faxNo=$_POST['faxNo'];
$email=$_POST['email'];
$username=$_POST['username'];
$password=$pass;
$organization=$_POST['organization'];
$website=$_POST['website'];
$position=$_POST['position'];
$status1='TRUE';
/*mysql_select_db ("irrdb");*/
mysql_query("INSERT INTO member (salutation, name, nationality, address, postal_code, city, state, country, contactNo, faxNo, email, username, password, organization, website, position, status)
VALUES ('$salutation','$name','$nationality','$address','$postal_code','$city','$state','$country','$contactNo', '$faxNo','$email','$username','$password','$organization','$website','$position','$status1')");
$to = $email;
$subject = "Welcome to IRRDB Website";
$message = "Congratulations! Your registration has been successful. \n";
$message = $message.''."\n";
$message = $message.''."Your username is : $username \n";
$message = $message.''."Your password is : $pass \n";
$message = $message.''."\n";
$message = $message.''."Thank you for registering with IRRDB Website";
$from = "irrdb@streamyx.com";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
//echo "Mail Sent.";
//mysql_close();
?>
<html>
<head>
<meta http-equiv="Refresh" content="3;url=index.php">
</head>
<body>
<table align="center">
<tr>
<td align="center"><b>Successfully registered. Your password will be sent to your email </b></td>
</tr>
</table>
Bookmarks