Well this is the code i am using:
PHP Code:
<?
session_start();
// Quote variable to make safe
function quote_smart($value)
{
// Stripslashes
if (get_magic_quotes_gpc()) {
$value = stripslashes($value);
}
// Quote if not a number or a numeric string
if (!is_numeric($value)) {
$value = "'" . mysql_real_escape_string($value) . "'";
}
return $value;
} // end make safe
/*Retrive Database Connection Login*/
require("./databaseconnection.php");
$email=$_POST['Email'];
$adminpassword=$_POST['Password'];
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Oops theres an error, our highly trained monkeys have been notified.");
$query = sprintf("SELECT * FROM admins WHERE Email=%s and Password=%s",
quote_smart($email),
quote_smart($adminpassword));
//echo $query;
mysql_query($query);
$result = mysql_query($query);
$count=mysql_num_rows($result);
mysql_close();
while($row = mysql_fetch_array($result))
{
//echo $row['Pixel'];
$adminid=$row['AdminID'];
}
if($count==1){
// store session data
$_SESSION['AdminID']=$adminid;
//echo $_SESSION['AdminID'];
header( 'Location: http://xxxxxxxxxx.com/xxxx/xxxxx/admin.php' ) ;
}
else {
header( 'Location: http://xxxxxxxxx.com/xxxxxx/xxxxxx/index.php?s=failed' ) ;
}
?>
I know that they are being sent to admin.php as i can see this using a FireFox addon. But admin.php keeps sending me back to the login area as its saying the session doesnt exist. Any help would be great please.
Bookmarks