Jump to content

Problem with Logic I think


todayme

Recommended Posts

I have the code blow problem is that an email address is in the database, I know this for sure.  The code is suppose to find it and if true redirect, but it doesnt.  I think the code is okay the only thing I can think it could be is the Storage type of the Email, I beleive some datatypes chop of white space etc.  And I am thinking maybe it is stored with whitespace as I dont know alot about mysql data types.

 

Can someone tell me there opinion on wether they think the code is good and if it is what sort of data type does not store whitespace.

 

Here is the code.

 




<? 
//set the variables as required
$dbhost = "localhost"; 
$dbuser = "admin_sex"; 
$dbpass = "sex"; 
$dbname = "admin_sex"; 



$dbDate = date("d.m.y");
$dbState = $_POST['State'];
$dbName = $_POST['Name'];
$dbAddress = $_POST['Address'];
$dbPostCode = $_POST['PostCode'];
$dbPhPrefix = $_POST['PhPrefix'];
$dbPhone = $_POST['Phone'];
$dbMobile = $_POST['Mobile'];
$dbEmail = $_POST['Email'];
$dbPassword = $_POST['Password'];
$dbSuburb = $_POST['Suburb'];
$dbPayMethod = $_POST['PayMethod'];

$db = mysql_pconnect($dbhost,$dbuser,$dbpass); 
mysql_select_db($dbname) or die(mysql_error());


$data = mysql_query("SELECT * FROM _User WHERE Email = '$dbEmail'")
or die(mysql_error());

$info = mysql_fetch_array( $data );

if(mysql_num_rows($data) == 1 ){ 

		mysql_close($db);
		header( 'Location: http://www.sold.au.com/userregistered.php' ) ;

      			
			}


else;

{ 

$sql = mysql_query("INSERT INTO _User (Date, Email, Password, Name, Address, Suburb, State, PostCode, PayMethod, PhPrefix, Phone, Mobile)
VALUES
('$dbDate','$dbEmail','$dbPassword','$dbName','$dbAddress','$dbSuburb','$dbState','$dbPostCode','$PayMethod','$dbPhPrefix','$dbPhone','$dbMobile')") or die (mysql_error()); 

mysql_close($db);


$to = $dbEmail;
$subject = "Account Created Sold.au.com!";
$body = "Your Password Information,\n\n Login: $dbEmail\n\n Password: $dbPassword\n\n You can login at http://www.sold.au.com/login.html";
if (mail($to, $subject, $body)) {
  //echo("<p>Your password information has been sent, please check your email.  You will be redirect back to the login page.</p>");

header( 'Location: http://www.sold.au.com/login1.php' ) ;



} else {
  echo("<p>Message delivery failed, please check you have supplied an email address that is working correctly.</p>");
}


}

?>






Link to comment
https://forums.phpfreaks.com/topic/41712-problem-with-logic-i-think/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.