websitebuilder Posted October 20, 2014 Share Posted October 20, 2014 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 More sharing options...
PrestaShopDeveloper Posted October 20, 2014 Share Posted October 20, 2014 md5(_COOKIE_KEY_.$_REQUEST['password']) _COOKIE_KEY_ is in \config\settings.inc.php Link to comment Share on other sites More sharing options...
websitebuilder Posted October 20, 2014 Author Share Posted October 20, 2014 I am still very new to PHP and learning as I go along. I have changed the above code and included an include link to the file suggested with the cookie key but it still didn't work. Link to comment Share on other sites More sharing options...
websitebuilder Posted October 20, 2014 Author Share Posted October 20, 2014 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 More sharing options...
websitebuilder Posted October 21, 2014 Author Share Posted October 21, 2014 Can anyone help me please, I could really do with some guidance here. Thanls Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now