Hi Everyone, Hoping someone here can help me fix this problem I have of setting a cookie variable from a databse $id = $row["id"]; variable.
This seems to work fine when using session data, but I am trying to use cookies and I am a bit stuck. . .
here is the code I have been trying with, you will see where I am setting the cookies, but I need to make the cookie variable = $row ["id"]
if ($_POST['sms'] != "") {
include_once "../includes/config.php";
// Be sure to filter this data to deter SQL injection, filter before querying database
$sms = $_POST['sms'];
//strip slashes
$sms = stripslashes($sms);
//stripping tags
$sms = strip_tags($sms);
$sql = mysql_query("SELECT id FROM minibays WHERE creff='$sms'");
$numRows = mysql_num_rows($sql);
if ($sms = "") {
$msg_to_user = '<br /><br /><h4><font color="#484848">Please enter your secure sms code</font></h4>';
} else if ($numRows > 0) {
/*
Start sessions
*/
$id = $row["id"];
//$_SESSION['SESS_MEMBER_ID'] = $id;
setcookie("id", "id", time()+86400);
setcookie("id"," ' . $id . '", time()+86400);
setcookie("id"," ' . $id", time()+86400);
setcookie("id"," " . $id . "", time()+86400);
$securecode = $row["securecode"];
//$_SESSION['SESS_SECURE_CODE'] = $securecode;
setcookie("securecode"," ' . $securecode . '", time()+86400);
$creff = $row["creff"];
//$_SESSION['SESS_CREFF'] = $creff;
setcookie("creff","$creff", time()+86400);
//$creff = $row["creff"];
//$_SESSION['SESS_CREFF'] = $creff;
/*
Login and go to members area
*/
//header("location: members.php?$_SESSION[id]");
//header("Location: members.php?id=".$id."");
header("Location: members.php?id=$id");
exit ();
} else {
Any help would be great thanks :)