I have a problem with the following script, whereby, first,I will supply a variable to it and then it will store the $skin_id and then I set a cookie to store the $skin_id.Then i can safely remove the $skin_id from the url such that everytime the script executes, it will replace the old cookie with a new one.
<?php
/*get cookie*/
$skin_id = $_GET['skin_id'];
if(isset($skin_id) != true){
$skin_id == 1;
}
if(isset($_COOKIE['skin'])){
$skin_id == $_COOKIE['skin'];
}
if($user_auth == true && $user_skin == 1){
/*set folder*/
$folder = "silver";
}
elseif($user_auth == true && $user_skin == 2){
/*set folder*/
$folder = "default";
}
elseif($skin_id == 1){
/*set folder*/
$folder = "silver";
}
elseif($skin_id == 2){
/*set folder*/
$folder = "default";
}
setcookie("skin", $skin_id, time()+3600);
print"$folder";
print_r($_COOKIE);
?>
In short, i set the $skin_id once, then script save it to cookie, then when i remove the $skin_id i set, the script should reference to the one in the cookie