Jump to content

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'";

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • 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.