Jump to content

Login Script


Panta
 Share

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);

Edited by gar onn
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...