chriscloyd Posted April 1, 2012 Share Posted April 1, 2012 My Login Script is not working! Please someone help. I am typing in the correct email and password! Mysql Table Table - Users email varchar 100 password varchar 256 form action/members.php <?php session_start(); include("../config.inc.php"); include("../classes/class.action.php"); if ($_POST['login'] && $_POST['*****'] == '*****') { $info = array(); $info['email'] = $_POST['email']; $info['password'] = hash("sha256", $_POST['password']); if ($Action->Login($info)) { $_SESSION['CPLoggedIn'] = $_POST['email']; header("Location: ../index.php"); } else { $Error[] = '- Please check you email and password!'; $_SESSION['CPErrors'] = $Error; header("Location: ../index.php?action=LoginForm"); } } classes/class.actions.php <?php class Action { var $Erros = array(); function Login($info) { foreach ($info as $key => $val) { if ($key = "password") { $$val = mysql_real_escape_string($val); $password = hash("sha256", $val); $values[$key] = $password; } else { $values[$key] = mysql_real_escape_string($val); } } $Sql = "SELECT * FROM Users WHERE email = '{$values['email']}' AND password = '{$values['password']}'"; $Query = mysql_query($Sql); $Num = mysql_num_rows($Query); if ($Num > 0) { return true; } else { return false; } } } $Action = new Action; Link to comment https://forums.phpfreaks.com/topic/260146-login-script-not-working/ Share on other sites More sharing options...
NomadicJosh Posted April 1, 2012 Share Posted April 1, 2012 The form code is missing in your first code section. Link to comment https://forums.phpfreaks.com/topic/260146-login-script-not-working/#findComment-1333388 Share on other sites More sharing options...
btherl Posted April 1, 2012 Share Posted April 1, 2012 The first step is to add some debugging statements to tell you what part is not working. There are many places it could fail and you need to narrow it down. Link to comment https://forums.phpfreaks.com/topic/260146-login-script-not-working/#findComment-1333392 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.