The source of cookies.php (click to demo the file) viewed 1693 times.

If I wrote this code, then it is licensed under the GPL. If someone else wrote it, then please ask them if you want to use the code.


<?php
if ($clear==true) {
    
setcookie ("Site[items]");
    
header ("Location: cookies.php");
    exit;
}


// They have click a link
if ($add_item==true) {
    
// If they have more than 1 item
    
if ($Site[items]==true) {
        
$new_cookie "$Site[items]|$add_item";
        
setcookie ("Site[items]"$new_cookie);
    }
    else
    {
        
setcookie ("Site[items]"$add_item);
    }
    
// Refresh the page
    
header ("Location: cookies.php");
    exit;
}

echo 
"You have:<br>";

if (
$Site[items]==true) {
    
$array_items explode("|"$Site[items]);
    
$array_items array_unique ($array_items);
    
    while(
$output_items each($array_items))
    {
        echo 
"$output_items[value]<br>";
    }
}
else
{
echo 
"no items<br><br>";
}

?>

<br>Books:<br><br>

<a href="?clear=yes_please">Clear the list</a><br><br>


<a href="?add_item=book_cheese">The book of cheese</a><br>
<a href="?add_item=cheese_world">Cheese from around the world</a><br>
<a href="?add_item=humm_cheese">Hummmmm cheese</a><br>
more books from the db etc, etc

If you want to have a look at the source code, chose a file from this list:

server_mon.php
(Demo Script)
perl_smtp_email.php
(Demo Script)
cookies.php
(Demo Script)
pad_test.php
(Demo Script)
md5_password.php
(Demo Script)
userdetails.php
(Demo Script)
ip.txt
(Demo Script)
email.php
(Demo Script)
phpself.php
(Demo Script)
htpasswd_maker.php
(Demo Script)
url_verify.php
(Demo Script)
birthday.php
(Demo Script)
phpinfo.php
(Demo Script)
password.php
(Demo Script)
time.php
(Demo Script)
mysql_backup.php
(Demo Script)
smarty.php
(Demo Script)
char_limit.php
(Demo Script)
title_case.php
(Demo Script)
convert_link.php
(Demo Script)
unix_time.php
(Demo Script)
html.php
(Demo Script)
ip_monitor.php
(Demo Script)
floor_time.php
(Demo Script)

To colour code your own PHP paste it here: