summary refs log tree commit diff stats
path: root/admin/editPoll.php
diff options
context:
space:
mode:
Diffstat (limited to 'admin/editPoll.php')
-rwxr-xr-xadmin/editPoll.php118
1 files changed, 0 insertions, 118 deletions
diff --git a/admin/editPoll.php b/admin/editPoll.php deleted file mode 100755 index 425f33c..0000000 --- a/admin/editPoll.php +++ /dev/null
@@ -1,118 +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/editPoll.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 = 'quotes';
27
28$template = new FITemplate('admin/writePoll');
29$template->add('TITLE', 'Edit Poll');
30$template->add('ACTION', '/admin/editPoll.php?id=' . $_GET['id'] . '&amp;submit=');
31
32if (isset($_GET['submit']))
33{
34 if (empty($_POST['question']))
35 {
36 $errors[] = array( 'field' => 'question',
37 'text' => 'Question is a required field');
38 }
39
40 if (empty($_POST['option1']))
41 {
42 $errors[] = array( 'field' => 'option1',
43 'text' => 'Option 1 is a required field');
44 }
45
46 if (empty($_POST['option2']))
47 {
48 $errors[] = array( 'field' => 'option2',
49 'text' => 'Option 2 is a required field');
50 }
51
52 if (empty($_POST['option3']))
53 {
54 $errors[] = array( 'field' => 'option3',
55 'text' => 'Option 3 is a required field');
56 }
57
58 if (empty($_POST['option4']))
59 {
60 $errors[] = array( 'field' => 'option4',
61 'text' => 'Option 4 is a required field');
62 }
63
64 if (isset($errors))
65 {
66 $template->adds_block('ISERROR',array('exi'=>1));
67
68 $eid = 0;
69 foreach ($errors as $error)
70 {
71 $template->adds_block('ERROR', array( 'ID' => $eid,
72 'TEXT' => $error['text']));
73 $template->add('IS' . strtoupper($error['field']) . 'ERROR', ' error');
74 $template->adds_block(strtoupper($error['field']) . 'ERROR', array( 'ID' => $eid,
75 'TEXT' => $error['text']));
76
77 $eid++;
78 }
79
80 $getpoll = "SELECT * FROM polloftheweek WHERE id = " . $_GET['id'];
81 $getpoll2 = mysql_query($getpoll);
82 $getpoll3 = mysql_fetch_array($getpoll2);
83
84 $template->add('QUESTIONVALUE', htmlentities($_POST['question']));
85 $template->add('OPTION1VALUE', htmlentities($_POST['option1']));
86 $template->add('OPTION2VALUE', htmlentities($_POST['option2']));
87 $template->add('OPTION3VALUE', htmlentities($_POST['option3']));
88 $template->add('OPTION4VALUE', htmlentities($_POST['option4']));
89 $template->add('TEXTVALUE', $_POST['text']);
90 } else {
91 $inspoll = "UPDATE polloftheweek SET question = \"" . mysql_real_escape_string($_POST['question']) . "\", option1 = \"" . mysql_real_escape_string($_POST['option1']) . "\", option2 = \"" . mysql_real_escape_string($_POST['option2']) . "\", option3 = \"" . mysql_real_escape_string($_POST['option3']) . "\", option4 = \"" . mysql_real_escape_string($_POST['option4']) . "\", text = \"" . mysql_real_escape_string($_POST['text']) . "\" WHERE id = " . $_GET['id'];
92 $inspoll2 = mysql_query($inspoll);
93
94 $template->add('QUESTIONVALUE', htmlentities($_POST['question']));
95 $template->add('OPTION1VALUE', htmlentities($_POST['option1']));
96 $template->add('OPTION2VALUE', htmlentities($_POST['option2']));
97 $template->add('OPTION3VALUE', htmlentities($_POST['option3']));
98 $template->add('OPTION4VALUE', htmlentities($_POST['option4']));
99 $template->add('TEXTVALUE', $_POST['text']);
100
101 $template->adds_block('FLASH', array('TEXT' => 'Your poll has been sucessfully edited. <a href="/poll/' . $_GET['id'] . '.php">View poll</a>.'));
102 }
103} else {
104 $getpoll = "SELECT * FROM polloftheweek WHERE id = " . $_GET['id'];
105 $getpoll2 = mysql_query($getpoll);
106 $getpoll3 = mysql_fetch_array($getpoll2);
107
108 $template->add('QUESTIONVALUE', htmlentities($getpoll3['question']));
109 $template->add('OPTION1VALUE', htmlentities($getpoll3['option1']));
110 $template->add('OPTION2VALUE', htmlentities($getpoll3['option2']));
111 $template->add('OPTION3VALUE', htmlentities($getpoll3['option3']));
112 $template->add('OPTION4VALUE', htmlentities($getpoll3['option4']));
113 $template->add('TEXTVALUE', $getpoll3['text']);
114}
115
116$template->display();
117
118?>