Viewing file: dovote.php (1.13 KB) -rwxr-xr-x Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
// detect file extension
$dotloc = strrpos(__FILE__, ".");
$ext = substr(__FILE__, $dotloc+1, (strlen(__FILE__) - $dotloc));
include dirname(__FILE__)."/common.${ext}";
include dirname(__FILE__)."/classes/poll.${ext}";
$p = new Poll($pid);
$cookiename = "symp".$p->tstamp;
if(isset($sympvotes[$cookiename])) {
$scookie1 = $sympvotes[$cookiename];
} elseif(isset($$cookiename)) {
$scookie1 = $$cookiename;
}
# tried to vote without selecting an option or option can't
# be verified as valid or already voted. attempt to just
# return them to the previous page.
if( ($s_cookielog != "0" && isset($scookie1)) ||
($s_iplog != "0" && $p->voted != 0) ||
!isset($cid) || !isset($p->options[$cid])) {
header("Location: $ref");
exit();
}
if($s_cookielog != "0") {
$date = time()+($s_blength * 86400);
$sympvotes[$cookiename] = $cid;
$data = serialize($sympvotes);
setcookie("sympvotes", "$data", "$date", "/");
$p->inc_vote($cid);
# do_redir for iis cookie+redir bug
do_redir("$ref"."$vostr");
} else {
$p->inc_vote($cid);
header("Location: $ref"."$vostr");
exit();
}
?>
|