Jump to content

Customers can log in from another site using Prestashop credentials


websitebuilder

Recommended Posts

Hello,

 

I am setting up a second website, just a basic site using php. I want my customers to be able to sign into the new site using their prestashop 1.6 log in details from my e-commerce website.

 

I have created a basic log in script but it isn't picking up the customers password from prestashop. What I am doing wrong?

?php 

session_start();

include 'config.php';

$SQLSt = "SELECT * FROM ps_customer WHERE email = '" . $_REQUEST['username'] . "' AND passwd = '" . md5($_REQUEST['password']) . "'";

$result = mysql_query($SQLSt);

$myrows = mysql_num_rows($result);

if($myrows > 0)
{
	
	$row = mysql_fetch_row($result);
	
        $_SESSION['user'] = $row[1];
        header("Location: dashboard.php");
}
else
{
        header("Location: login_failed.php");
}

mysql_close($con);
?>
Link to comment
Share on other sites

Not sure if it will help if I give a little more info as to what I am trying to achieve as I may have done it wrong.

 

I have two websites, website A is my prestashop store and website B is a standalone html / php site. I want my customers who log into website B to be able to use their log in details for website A. 

 

The script I have prepared above is the login script I have for website B but not sure if its right or the best way. The config file simply has the connection details to Website A.

 

Hope that helps explain a little better what I'm trying to achieve.

 

Thanks

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