Jump to content

Problem with user authentication. . .


ryan.od

Recommended Posts

Can anyone help me with this? When I try to run my login script I get the following error. . .

Unable to perform product query. Error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '@yahoo.com' at line 1

 

I think it has trouble handling the @ symbol, but I'm not sure. Perhaps this is a common issue many have had before? Here is the code:

 

<?php
$path = "/home/tablashi/public_html/";
set_include_path(get_include_path() . PATH_SEPARATOR . $path);

include("$path" . "db/db_connect.php");
include("$path" . "db/db_select.php");	
include("$path" . "login/login_funcs.php");

$users_email = $_POST[email];
$users_password = $_POST[password];

$encrypted = user_password($users_password, $users_email);

$sql = "SELECT * FROM users WHERE users_email = $users_email AND users_password = $encrypted"; 
$result = mysql_query($sql) or die('<p>Unable to perform user query. Error: ' . mysql_error() . '</p>');

if($sql){
	session_start();
}
else{
	echo("nope");
}
?>

 

I'm not inlcuding the login function that handles the salt and the encryption. I don't think there is any problem there.

 

Thanks.

 

RyanOD

Link to comment
https://forums.phpfreaks.com/topic/50808-problem-with-user-authentication/
Share on other sites

For starters, you allready set your include path so your includes only need....

 

include "db/db_connect.php";
include "db/db_select.php";	
include "login/login_funcs.php";

 

Next, your query is incorrect. Try...

 

$sql = "SELECT * FROM users WHERE users_email = '$users_email' AND users_password = '$encrypted'";

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.