Jump to content
Sign in to follow this  
Panta

Login Script

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();    }  }?>

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...