I want to build a feature into my site where people can pick out 5 of some 5000 favourite links to be displayed as the users favourite links across the site. I'm working on a perl script that will hopefully allow for this...
However, I wanted to expand on the usual format of the cookie I have. Ideallly a single cookie will hold the 5 values for each seperate id of the link.
The values would be one for each link and would consist of an id+4 digits which are picked off a query string. There is a .HTaccess file and XSSI code to deal with thr front end.
Link would be fired on the website by either:
<a href="/cgi-bin/setfavourite.pl?<!--#echo var="PAGE_ID" -->&addfavlink">Add <!--#echo var="label" --></a> for adding a one
&
<a href="/cgi-bin/setfavourite.pl?<!--#echo var="PAGE_ID" -->&removefavlink">Remove <!--#echo var="label" --></a> for removing a one.
#!/usr/local/bin/perl use CGI; $query = new CGI; my ($number, $fav1, $fav2, $fav3, $fav4, $fav5, $cookie); my $nextpage ='http://www.domain.co.uk/'; if (m/^(\d+)&addfavlink/) { $number = $1; $addfavlink = "id".$number; $cookie = $query -> cookie( -NAME => 'FAV5LINK', -VALUE => '$fav1', '$fav2', '$fav3 +', '$fav4', '$fav5', -EXPIRES => '+1y', -DOMAIN => '.domain', -PATH => '/', -SECURE => '0' ); print $query -> header( -COOKIE => $cookie, -LOCATION => $nextpage."userchoice.sht +ml?id=$number&added" ); } elsif (m/^(\d+)&removefavlink/) { $cookie = $query -> cookie( -name => 'FAV5LINK', -VALUE => '$fav1','$fav2','$f +av3','$fav4','$fav5', -EXPIRES => '-1h', -DOMAIN => '.domain, -PATH => '/', -SECURE => '0' ); print $query -> header( -COOKIE => $cookie, -LOCATION => $nextpage."removed.html" );<br /> } exit 0;
The content should define in the content area of the cookie the values *= omitted *(fav1=)id0008... etc ...etc
Ideally I wanted to allow for updating the cookies values to allow for replacing the 'fav1' with something else or the user adding a 'fav2'. Also there would only be a maxiumum of 5 values for this named cookie.
I got my head around it a little bit but am in much need of help.
many thanks, mat
In reply to CGI cookies: in much need of help by matc
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |