summary refs log tree commit diff stats
path: root/pages/polloftheweek.php
diff options
context:
space:
mode:
authorStarla Insigna <hatkirby@fourisland.com>2008-12-09 21:27:04 -0500
committerStarla Insigna <hatkirby@fourisland.com>2008-12-09 21:27:04 -0500
commit973b420608ee303ad9d68b068121a46a8cffee42 (patch)
tree2370d6169f5257ee0859c103727bff16e49f66ae /pages/polloftheweek.php
parent9107fce738865f27908f2c4ae9f8f913b3a32c0e (diff)
downloadfourisland-973b420608ee303ad9d68b068121a46a8cffee42.tar.gz
fourisland-973b420608ee303ad9d68b068121a46a8cffee42.tar.bz2
fourisland-973b420608ee303ad9d68b068121a46a8cffee42.zip
Fixed long-time poll glitch
After you voted on the POTW, the resulting page used to be very strange and hideous. This has finally, after being like this since the beginning of
the third layout, been fixed.
Diffstat (limited to 'pages/polloftheweek.php')
-rwxr-xr-xpages/polloftheweek.php71
1 files changed, 27 insertions, 44 deletions
diff --git a/pages/polloftheweek.php b/pages/polloftheweek.php index 930f346..0410151 100755 --- a/pages/polloftheweek.php +++ b/pages/polloftheweek.php
@@ -22,52 +22,35 @@ if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);}
22 22
23require('headerproc.php'); 23require('headerproc.php');
24 24
25if (!isset($_GET['potw'])) 25if (!isset($forceDisplay))
26{ 26{
27 if (!isset($forceDisplay)) 27 $getpoll = "SELECT * FROM polloftheweek ORDER BY id DESC LIMIT 0,1";
28 { 28} else {
29 $getpoll = "SELECT * FROM polloftheweek ORDER BY id DESC LIMIT 0,1"; 29 $getpoll = "SELECT * FROM polloftheweek WHERE id = " . $forceDisplay;
30 } else { 30}
31 $getpoll = "SELECT * FROM polloftheweek WHERE id = " . $forceDisplay; 31$getpoll2 = mysql_query($getpoll);
32 } 32$getpoll3 = mysql_fetch_array($getpoll2);
33 $getpoll2 = mysql_query($getpoll); 33
34 $getpoll3 = mysql_fetch_array($getpoll2); 34$template->add('QUESTION', $getpoll3['question']);
35 35$template->add('OPTION1', $getpoll3['option1']);
36 $template->add('QUESTION', $getpoll3['question']); 36$template->add('OPTION2', $getpoll3['option2']);
37 $template->add('OPTION1', $getpoll3['option1']); 37$template->add('OPTION3', $getpoll3['option3']);
38 $template->add('OPTION2', $getpoll3['option2']); 38$template->add('OPTION4', $getpoll3['option4']);
39 $template->add('OPTION3', $getpoll3['option3']); 39
40 $template->add('OPTION4', $getpoll3['option4']); 40$getip = "SELECT * FROM didpollalready WHERE ip = \"" . $_SERVER['REMOTE_ADDR'] . "\"";
41 41$getip2 = mysql_query($getip);
42 $getip = "SELECT * FROM didpollalready WHERE ip = \"" . $_SERVER['REMOTE_ADDR'] . "\""; 42$getip3 = mysql_fetch_array($getip2);
43 $getip2 = mysql_query($getip);
44 $getip3 = mysql_fetch_array($getip2);
45 43
46 if (($getip3['ip'] != $_SERVER['REMOTE_ADDR']) && (!isset($forceDisplay))) 44if (($getip3['ip'] != $_SERVER['REMOTE_ADDR']) && (!isset($forceDisplay)))
47 { 45{
48 $template->adds_block('FORM',array('exi'=>1)); 46 $template->adds_block('FORM',array('exi'=>1));
49 } else { 47} else {
50 $template->adds_block('DISPLAY',array('exi'=>1)); 48 $template->adds_block('DISPLAY',array('exi'=>1));
51 49
52 $template->add('PERCENT1', getpercent($getpoll3,'1')); 50 $template->add('PERCENT1', getpercent($getpoll3,'1'));
53 $template->add('PERCENT2', getpercent($getpoll3,'2')); 51 $template->add('PERCENT2', getpercent($getpoll3,'2'));
54 $template->add('PERCENT3', getpercent($getpoll3,'3')); 52 $template->add('PERCENT3', getpercent($getpoll3,'3'));
55 $template->add('PERCENT4', getpercent($getpoll3,'4')); 53 $template->add('PERCENT4', getpercent($getpoll3,'4'));
56 }
57} else {
58 $setip = "INSERT INTO didpollalready SET ip = \"" . $_SERVER['REMOTE_ADDR'] . "\"";
59 $setip2 = mysql_query($setip);
60 $getpoll = "SELECT * FROM polloftheweek ORDER BY id DESC LIMIT 0,1";
61 $getpoll2 = mysql_query($getpoll);
62 $getpoll3 = mysql_fetch_array($getpoll2);
63 $setpoll = "UPDATE polloftheweek SET clicks" . $_POST['options'] . " = " . ($getpoll3['clicks' . $_POST['options']]+1) . " WHERE id = " . $getpoll3['id'];
64 $setpoll2 = mysql_query($setpoll);
65
66 $template = new FITemplate('msg');
67
68 $template->add('MSG','<H2>' . $getpoll3['question'] . '</H2><P>Thank you for voting on the Poll of the Week!<BR><A HREF="poll.php?id=' . $getpoll3['id'] . '">Click here to visit the page for this poll.');
69
70 $template->display();
71} 54}
72 55
73?> 56?>