Forum Moderators: coopster

Message Too Old, No Replies

Getting document elements

Writing a pseudo server-side cookie

         

beath

9:12 am on Jun 28, 2004 (gmt 0)

10+ Year Member



hiya

i want to track voting of specified pictures in a picture-gallery. users should be able to make a vote for a pic, but ONLY ONCE for a spefic pic.
the problem is: i can not get the reference of the picture the user voted for. (html-img-object).

any ideas?

thanks in advance
Beat from Switzerland

WhosAWhata

2:03 am on Jun 29, 2004 (gmt 0)

10+ Year Member



make your links like
<a href=vote.php?pic=22&vote=1>option 1</option>
<a href=vote.php?pic=22&vote=2>option 2</option>
<a href=vote.php?pic=22&vote=3>option 3</option>

then write a file that uses $_SERVER['REMOTE_ADDR'] to track their IP address and the pics they have voted for

ex:
00.000.00.000,22,21,45
00.000.00.111,21,37

then
$cnt = file_gent_contents("file.php");
$users = explode("\n",$cnt);
foreach($users as $n => $v){
$sep = explode(",",$v);
$user = $sep['0'];
array_shift($sep);
//check $sep for the pic you are looking at
//$sep will be an array of the pics they have voted on
}

i would give a full script but i am too busy right now