15. marts 2004 - 12:05
Der er
3 kommentarer og
1 løsning
cookie class
hej alle
jeg har her de sidste par dage sidet og arbejdet med at få lavet en cookie class til min site... men jeg har ikke rigtig få det til at virker som jeg gerne vil havde.
er der nogle som har et forslag til hvordan sådan en fætter kan laves.
15. marts 2004 - 12:24
#2
det er ikke meget men det skulle give en ide om hvor jeg vil hend
class cookie{
var $expire;
var $path;
var $cookie_list;
function cookie(){
$this->expire = time()+60*60*24*30;
$this->path ="/";
}
function set_expire($input){ // set expire time for new cookie's
$this->expire = $input;
}
function set_path($input){ // set path for new cooki's
$this->path = $input;
}
function create_cookie_list($listname){
$this->cookie_list = $listname;
}
function add_item($itemname,$value){
setcookie($this->cookie_list[$itemname],$value,$this->expire,$this->path);
}
}
15. marts 2004 - 14:16
#3
har fundet en mulig løsning men vil gerne høre om der skal noget mere til.
class cookie{
//private
var $expire;
var $path;
var $cookie_list;
function cookie(){
$this->expire = time()+60*60*24*30;
$this->path ="/";
}
function set_expire($input){ // set expire time for new cookie's
$this->expire = $input;
}
function set_path($input){ // set path for new cooki's
$this->path = $input;
}
function cookie_list($listname){
$this->cookie_list = $listname;
}
function add_item($itemname,$value=NULL){
setcookie($this->cookie_list."[".$itemname."]",$value,$this->expire,$this->path);
}
function mod_item($itemname,$value=NULL){
setcookie($this->cookie_list."[".$itemname."]",$value,$this->expire,$this->path);
}
function del_item($itemname,$value=NULL){
setcookie($this->cookie_list."[".$itemname."]",$value,"-3600",$this->path);
}
}