Skip to content

Commit

Permalink
Bugfix: #998700 - Users able to submit two surveys/votes. Added token…
Browse files Browse the repository at this point in the history
… checking routine to every page presented, to ensure that people can't submit two or more surveys per token by a particular cheating method.

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/trunk/unstable@1109 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
jcleeland committed Jul 31, 2004
1 parent 591e07b commit 35ce52e
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions index.php
Expand Up @@ -187,6 +187,42 @@
$_SESSION['oldsid']=$sid;
}

//Check if TOKEN is used for EVERY PAGE
//This function fixes bug #998700 - Users able to submit two surveys/votes
//by checking that the token has not been used at each page displayed.
if ($tokensexist == 1 && returnglobal('token'))
{
//check if token actually does exist
$tkquery = "SELECT * FROM {$dbprefix}tokens_$sid WHERE token='".trim(returnglobal('token'))."' AND completed != 'Y'";
$tkresult = mysql_query($tkquery);
$tkexist = mysql_num_rows($tkresult);
if (!$tkexist)
{
sendcacheheaders();
echo "<html>\n";
//TOKEN DOESN'T EXIST OR HAS ALREADY BEEN USED. EXPLAIN PROBLEM AND EXIT
foreach(file("$thistpl/startpage.pstpl") as $op)
{
echo templatereplace($op);
}
foreach(file("$thistpl/survey.pstpl") as $op)
{
echo "\t".templatereplace($op);
}
echo "\t<center><br />\n"
."\t"._NOTOKEN1."<br /><br />\n"
."\t"._NOTOKEN3."\n"
."\t"._FURTHERINFO." {$thissurvey['adminname']} "
."(<a href='mailto:{$thissurvey['adminemail']}'>"
."{$thissurvey['adminemail']}</a>)<br /><br />\n"
."\t<a href='javascript: self.close()'>"._CLOSEWIN_PS."</a><br />&nbsp;\n";
foreach(file("$thistpl/endpage.pstpl") as $op)
{
echo templatereplace($op);
}
exit;
}
}
//CLEAR SESSION IF REQUESTED
if (isset($_GET['move']) && $_GET['move'] == "clearall")
{
Expand Down

0 comments on commit 35ce52e

Please sign in to comment.