Cookie function library: Cookie. Inc. php3
<? PHP
If (! Isset ($ __cookie_inc __)){
$ __Cookie_inc __= 1;
Function jssetcookie ($ cname, $ cvalue, $ cexpr = false ){
// This function allows you to set the cookie after the HTML header is marked,
// Can be supplemented or even replaced by the setcookie function.
// $ Cname...: Cookie name
// $ Cvalue...: cookie value
// $ Cexpr...: The Cookie's validity period, in minutes. You can also modify the number of hours and days.
If ($ cexpr> 0 ){
$ Cookiestring = "astr = '$ cname' +' = '+' $ cvalue' + '; expires =' + expr + '; Path = /';";
$ Cookie. = "n <script language =" JavaScript "> N ";
$ Cookie. = 'function makeyearexpdate (min ){
VaR expire = new date ();
Expire. settime (expire. gettime () + (Min * 60) * 1000 ));
Expire = expire. togmtstring ()
Return expire
}
Expr = makeyearexpdate ('. $ cexpr .');';
$ Cookie. = "N". $ cookiestring. "N ";
$ Cookie. = "document. Cookie = astr; n </SCRIPT> N ";
} Else {
$ Cookie. = "n <script language =" JavaScript "> N ";
$ Cookie. = "document. Cookie = '$ cname = $ cvalue; Path = /';";
$ Cookie. = "n </SCRIPT> N ";
}
Echo $ cookie;
}
}
?>
Original Author: Unknown