summary refs log tree commit diff stats
path: root/admin/newPoll.php
diff options
context:
space:
mode:
Diffstat (limited to 'admin/newPoll.php')
-rwxr-xr-xadmin/newPoll.php114
1 files changed, 0 insertions, 114 deletions
diff --git a/admin/newPoll.php b/admin/newPoll.php deleted file mode 100755 index d105f45..0000000 --- a/admin/newPoll.php +++ /dev/null
@@ -1,114 +0,0 @@
1<?php
2/*
3 444444444
4 4::::::::4
5 4:::::::::4
6 4::::44::::4
7 4::::4 4::::4 Four Island
8 4::::4 4::::4
9 4::::4 4::::4 Written and maintained by Starla Insigna
104::::444444::::444
114::::::::::::::::4 admin/newPoll.php
124444444444:::::444
13 4::::4 Please do not use, reproduce or steal the
14 4::::4 contents of this file without explicit
15 4::::4 permission from Hatkirby.
16 44::::::44
17 4::::::::4
18 4444444444
19*/
20
21if (!defined('S_INCLUDE_FILE')) {define('S_INCLUDE_FILE',1);}
22
23require('headerproc.php');
24
25$category = 'polls';
26$pageaid = 'newpoll';
27
28$template = new FITemplate('admin/writePoll');
29
30if (isset($_GET['submit']))
31{
32 if (empty($_POST['question']))
33 {
34 $errors[] = array( 'field' => 'question',
35 'text' => 'Question is a required field');
36 }
37
38 if (empty($_POST['option1']))
39 {
40 $errors[] = array( 'field' => 'option1',
41 'text' => 'Option 1 is a required field');
42 }
43
44 if (empty($_POST['option2']))
45 {
46 $errors[] = array( 'field' => 'option2',
47 'text' => 'Option 2 is a required field');
48 }
49
50 if (empty($_POST['option3']))
51 {
52 $errors[] = array( 'field' => 'option3',
53 'text' => 'Option 3 is a required field');
54 }
55
56 if (empty($_POST['option4']))
57 {
58 $errors[] = array( 'field' => 'option4',
59 'text' => 'Option 4 is a required field');
60 }
61
62 if (isset($errors))
63 {
64 $template->adds_block('ISERROR',array('exi'=>1));
65
66 $eid = 0;
67 foreach ($errors as $error)
68 {
69 $template->adds_block('ERROR', array( 'ID' => $eid,
70 'TEXT' => $error['text']));
71 $template->add('IS' . strtoupper($error['field']) . 'ERROR', ' error');
72 $template->adds_block(strtoupper($error['field']) . 'ERROR', array( 'ID' => $eid,
73 'TEXT' => $error['text']));
74
75 $eid++;
76 }
77
78 $template->add('TITLE', 'New Poll');
79 $template->add('ACTION', '/admin/newPoll.php?submit=');
80
81 $template->add('QUESTIONVALUE', htmlentities($_POST['question']));
82 $template->add('OPTION1VALUE', htmlentities($_POST['option1']));
83 $template->add('OPTION2VALUE', htmlentities($_POST['option2']));
84 $template->add('OPTION3VALUE', htmlentities($_POST['option3']));
85 $template->add('OPTION4VALUE', htmlentities($_POST['option4']));
86 $template->add('TEXTVALUE', htmlentities($_POST['text']));
87 } else {
88 $inspoll = "INSERT INTO polloftheweek (question,option1,option2,option3,option4,text) VALUES (\"" . mysql_real_escape_string($_POST['question']) . "\",\"" . mysql_real_escape_string($_POST['option1']) . "\",\"" . mysql_real_escape_string($_POST['option2']) . "\",\"" . mysql_real_escape_string($_POST['option3']) . "\",\"" . mysql_real_escape_string($_POST['option4']) . "\",\"" . mysql_real_escape_string($_POST['text']) . "\")";
89 $inspoll2 = mysql_query($inspoll);
90
91 $id = mysql_insert_id();
92
93 $cleardid = "TRUNCATE TABLE didpollalready";
94 $cleardid2 = mysql_query($cleardid);
95
96 $template->add('QUESTIONVALUE', htmlentities($_POST['question']));
97 $template->add('OPTION1VALUE', htmlentities($_POST['option1']));
98 $template->add('OPTION2VALUE', htmlentities($_POST['option2']));
99 $template->add('OPTION3VALUE', htmlentities($_POST['option3']));
100 $template->add('OPTION4VALUE', htmlentities($_POST['option4']));
101 $template->add('TEXTVALUE', htmlentities($_POST['text']));
102
103 $template->add('TITLE', 'Edit Poll');
104 $template->add('ACTION', '/admin/editPoll.php?id=' . $id . '&amp;submit=');
105 $template->adds_block('FLASH', array('TEXT' => 'Your poll has been sucessfully created. <a href="/poll/' . $id . '.php">View poll</a>.'));
106 }
107} else {
108 $template->add('TITLE', 'New Poll');
109 $template->add('ACTION', '/admin/newPoll.php?submit=');
110}
111
112$template->display();
113
114?>