note 29150 added to function.setcookie

From: Date: Tue, 04 Feb 2003 14:03:33 +0000
Subject: note 29150 added to function.setcookie
Groups: php.notes 
Request: Send a blank email to php-notes+get-43389@lists.php.net to get a copy of this message
<?php if(ereg("[0-9].[0-9].[0-9].[0-9]",$HTTP_HOST)){ $domain = $HTTP_HOST; } else { $domain = eregi_replace("www.","",$HTTP_HOST); $domain = ".".$domain; } if(isset($uidcookie)) { $set = "Your Unique ID is: $uidcookie"; } else { srand ((double) microtime() * 1000000); $uniq_id = uniqid(rand()); setcookie ("uidcookie", $uniq_id, time()+86400, "/", "$domain"); $set = "Your Unique ID is now: $uniq_id"; $log = "log.txt"; $fp= fopen($log,"a"); $uniqid = "| Unique ID: $uniq_id | "; $datelang = "Date Created: "; $date = date("l - F j, Y - g:i a"); $ip = " | IP Address: $REMOTE_ADDR | "; $referer = " | $HTTP_REFERER "; $incomingpage = " | $PHP_SELF "; fputs($fp,"$uniqid$datelang$date$incomingpage$referer$ip\n"); fclose ($fp); } ?> -- http://www.php.net/manual/en/function.setcookie.php http://master.php.net/manage/user-notes.php?action=edit+29150 http://master.php.net/manage/user-notes.php?action=delete+29150 http://master.php.net/manage/user-notes.php?action=reject+29150

« previous php.notes (#43389) next »