Jump to content

Login Script


Panta

Recommended Posts

please i dont know the problem with this login script. the error message is Fatal error: Call to undefined function msql_query() in C:\wamp\www\newform\login.php on line 33

//connect to the mysql database server.mysql_connect ($dbhost, $dbusername, $dbuserpass);mysql_select_db($dbname) or die('Cannot select database');$page_mode = isset($_POST['page_mode']) ? $_POST['page_mode'] : '';$error_string = '';if ($page_mode == 'login'){  $email = $_POST['email'];  $password = $_POST['password'];  if (trim($email) == '' || trim($password) == '')    {	$error_string .= 'Please enter your email address and password.<br>';	}	}  else  {    		$query = msql_query("SELECT * FROM users WHERE email='" . mysql_real_escape_string($email) . "'");	$data = mysql_fetch_array($query);	if($data['password'] != $password) {echo "The supplied login is incorrect";}else{$query = mysql_query("SELECT* FROM users WHERE email='" . mysql_real_escape_string($email) . "'") ;$row = mysql_fetch_array($query);      $_SESSION['user_id'] = $row['id'];      $_SESSION['user_name'] = $row['name'];      $_SESSION['user_email'] = $row['email'];      header('Location: index.php');      exit();    }  }?>

Link to comment
Share on other sites

Try this,

$emaailescape=mysql_real_escape_string($email)$query="SELECT* FROM users WHERE email='" .$emaailescape ."'";mysql_query($query) or die("<b>mysql_error:</b>".mysql_error()."<br>query was:".$query);

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...