Jump to content

Login Script Not Working


chriscloyd

Recommended Posts

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

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.