Jump to content

[SOLVED] Problem with verification script


darkenedember

Recommended Posts

Hello.

 

I am currently making a login panel for my site, but I cannot seem to get a script to work. I have, with a bit of testing, found the location of the error, but cannot understand what it is.

 

<?php
require('config.php');
mysql_connect($config['dbhost'],$config['dbuser'],$config['dbpass']);
@mysql_select_db($config['dbname']) or die("could not connect");
$username = $_POST['username'];
$password = $_POST['password'];
$hash1 = md5($password);
$hash2 = sha1($hash1);
$table = $config['dbprefix'] . "adminlogin";
$query = "SELECT password FROM " . $table . "WHERE username=" . $username;
$result = mysql_query($query);
if ($result == $hash2) {
$cookievalue = [color=red]<deleted value>[/color];
setcookie("asadmin", $cookievalue, time()+3600);
header('Location: [color=red]<url deleted>[/color]');
} elseif ($result == NULL) {
echo "null"; 
} else {
die("INVALID PASSWORD");
}
?>

 

I have, with the inclusion of that elseif, found that the query will not return a value. Could somebody please point out what I am doing wrong?

 

Thank you, and I am sorry if this is in the wrong section.

Link to comment
https://forums.phpfreaks.com/topic/126134-solved-problem-with-verification-script/
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.