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
Share on other sites

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.