View file addpolls.php

File size: 2.84Kb
<?php
require('includes/header.php');
require('includes/utils.php');
require('includes/db.php');
require('includes/auth.php');

$max_answers = 10;

if(isset($_POST['question']))
{
   mysql_query('INSERT INTO polls_questions(question, date, user_id) VALUES ("' . addslashes($_POST['question']) . '", CURRENT_TIMESTAMP, "' . (int)$id . '")');
   $qid = mysql_insert_id();
   for($i = 1; $i <= $max_answers; $i++)
   {
      if($_POST['answer' . $i] != '')
      {
         mysql_query('INSERT INTO polls_answers(qid, aid, answer, votes) VALUES ("' . $qid . '", "' . $i . '", "' . addslashes($_POST['answer' . $i]) . '", "0")');
      }
   }
?>
<wml>
<card id="added" title="added" ontimer="viewpolls.php?id=<?php echo $id; ?>&amp;p=<?php echo $login; ?>"><timer value="15"/>
<p>
Голосование добавлено<br/>
</p>
</card>
</wml>
<?php
}
else
{
?>
<wml>
<head><meta http-equiv="Cache-Control" content="no-cache" forua="true"/></head>
<card id="links" title="&#x041C;&#x0435;&#x043D;&#x0435;&#x0434;&#x0436;&#x0435;&#x0440; &#x0444;&#x0430;&#x0439;&#x043B;&#x043E;&#x0432;">
<do type="options" name="main" label="&#x041C;&#x0435;&#x043D;&#x044E;"><go href="main.php?id=<?php echo $id; ?>&amp;p=<?php echo $login; ?>"/></do>
<p>
Вопрос:<br/>
<input name="question" maxlength="255" title="question"/><br/>
Ответ 1:<br/>
<input name="answer1" maxlength="255" title="answer1"/><br/>
Ответ 2:<br/>
<input name="answer2" maxlength="255" title="answer2"/><br/>
Ответ 3:<br/>
<input name="answer3" maxlength="255" title="answer3"/><br/>
Ответ 4:<br/>
<input name="answer4" maxlength="255" title="answer4"/><br/>
Ответ 5:<br/>
<input name="answer5" maxlength="255" title="answer5"/><br/>
Ответ 6:<br/>
<input name="answer6" maxlength="255" title="answer6"/><br/>
Ответ 7:<br/>
<input name="answer7" maxlength="255" title="answer7"/><br/>
Ответ 8:<br/>
<input name="answer8" maxlength="255" title="answer8"/><br/>
Ответ 9:<br/>
<input name="answer9" maxlength="255" title="answer9"/><br/>
Ответ 10:<br/>
<input name="answer10" maxlength="255" title="answer10"/><br/>

<anchor title="go">OK<go href="addpolls.php?id=<?php echo $id; ?>&amp;p=<?php echo $login; ?>" method="post">
<postfield name="question" value="$(question)"/>
<postfield name="answer1" value="$(answer1)"/>
<postfield name="answer2" value="$(answer2)"/>
<postfield name="answer3" value="$(answer3)"/>
<postfield name="answer4" value="$(answer4)"/>
<postfield name="answer5" value="$(answer5)"/>
<postfield name="answer6" value="$(answer6)"/>
<postfield name="answer7" value="$(answer7)"/>
<postfield name="answer8" value="$(answer8)"/>
<postfield name="answer9" value="$(answer9)"/>
<postfield name="answer10" value="$(answer10)"/>
</go></anchor><br/>
</p>
<p align="center">
</p>
</card>
</wml>
<?php
}
?>