PDA

View Full Version : poll voters.. grab the ip and display on 'who voted'


somerfeld
01-02-2003, 09:54 AM
poll voters.. grab the ip and display on 'who voted'.

Woundering if anyone has done somethign like this yet?

Chris M
01-02-2003, 02:10 PM
Open admin/thread.php
Find:
$votes = $DB_site->query("
SELECT pollvote.*, user.username
FROM pollvote
LEFT JOIN user ON(user.userid=pollvote.userid)
WHERE pollid='$pollid' ORDER BY voteoption, username ASC
");
Replace with:
$votes = $DB_site->query("
SELECT pollvote.*, user.username, user.ipaddress
FROM pollvote
LEFT JOIN user ON(user.userid=pollvote.userid)
WHERE pollid='$pollid' ORDER BY voteoption, username ASC
");

Now find:
if ($vote['username']=="") {
$username = "<font size='1'>Guest</font>";
} else {
$username = "<a href=\"../member.php?s=$session[sessionhash]&action=getinfo&userid=$vote[userid]\" target=\"_blank\">$vote[username]</a>";
}
Add below:
if ($vote['ipaddress']=="") {
$ipaddress = "<font size='1'>No IP</font>";
} else {
$ipaddress = "<a href=\"/user.php?s=$session[sessionhash]&action=doips&username=$vote[username]\" target=\"_blank\">$vote[ipaddress]</a>";
}
Now find:
if ($lastoption != $vote['voteoption']) {
$option = $options[($vote['voteoption']-1)];
echo "</td></tr>\n<tr class='".getrowbg()."'><td><b>$option</b></td><td>\n";
echo "$username &nbsp;\n";
} else {
echo "$username &nbsp;\n";
}
Replace with:
if ($lastoption != $vote['voteoption']) {
$option = $options[($vote['voteoption']-1)];
echo "</td></tr>\n<tr class='".getrowbg()."'><td><b>$option</b></td><td>\n";
echo "$username ($ipaddress) &nbsp;\n";
} else {
echo "$username ($ipaddress) &nbsp;\n";
}

:)

Satan

somerfeld
01-16-2003, 12:05 PM
how would I get a unregeistered user ip who voted?

Chris M
01-17-2003, 06:10 PM
I am afraid that would be impossible without some sort of storage system for unregistered user's ips...

Satan