StevenG89

Untitled

May 27th, 2014
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2.  
  3. require(__DIR__."/globals.php");
  4.  
  5. $titles = array(
  6.     'Gangs',
  7.     'Gym',
  8.     'Players',
  9.     'Staff',
  10.     'Crimes',
  11.     'Profiles',
  12.     'Referrals',
  13.     'General',
  14.     'Other'
  15. );
  16.  
  17. function mres($str) {
  18.     return mysql_real_escape_string($str);
  19. }
  20.  
  21. if(isset($_POST['suggestions'])) {
  22.     $_POST['title'] = isset($_POST['title']) && ctype_alpha($_POST['title']) && in_array($_POST['title'], $titles) ? $_POST['title'] : null;
  23.     if(empty($_POST['title']))
  24.         echo "Invalid Choice.";
  25.     mysql_query("INSERT INTO `suggestions`
  26.             VALUES('','".$_POST['title']."',unix_timestamp(),'".mres($_POST['suggestions'])."','No','N/A','{$ir['username']}
  27.     [{$ir['userid']}]')",$c) or die("Your suggestion processing has sensed an error, please click back and fix it.<br />
  28.     -<a href='suggestion.php'>Back</a><br />");
  29.     print "Your suggestion has been added!<br />
  30.     <a href='suggestions.php'>> Back</a><br />";
  31. }
  32. else {
  33.     print "<h3>Add Suggestion</h3><br />
  34.     <hr width=50% /><b><font color=red>Do not post things that are NOT ideas or suggestions!</font></b><hr width=50% /><br />
  35.     Suggestion Category:
  36.     <select name='title' type='dropdown'>
  37.         ".foreach($titles as $opt)
  38.             printf("<option value='%1\$s'>%1\$s</option>", $opt)."
  39.     </select><br /><br />
  40.     <form method='post' action=''>
  41.         Suggestion:<br />
  42.         <textarea rows='7' cols='40' name='suggestions'></textarea><br />
  43.         <input type='submit' name='suggestions' value='Process' />
  44.     </form>";
  45. }
  46. $h->endpage();
  47. ?>
Advertisement
Add Comment
Please, Sign In to add comment