whaite page streets_staff.php
The streets.php works i get a white page for the streets_staff.php
<?php /* EXPLORE THE STREETS CREATED BY: Lithium ~ 03/01/2010 UPDATED BY: Curt ~ 08/03/2011 This feature is 100% free. Enjoy. */ include(DIRNAME(__FILE__) ."sglobals.php"); $_POST['streetid']=abs((int)$_POST['streetid']);$_POST['location']=abs((int)$_POST['location']); // EDIT STEP function edit_step() {global $db,$h; ?><h1> EDIT STEP </h1><?php $edit=$db->query("SELECT * FROM streets WHERE sid={$_POST['streetid']}"); if (!$db->num_rows($edit)) { echo "Incorrect Option."; $h->endpage(); exit;} else { $step=$db->fetch_row($edit); if(!isset($_POST['submit2'])) { ?> <form action="staff_streets.php?action=edit" method="post"> <input type="hidden" name="streetid" value="<?php echo $step['sid']; ?>" > <input type="hidden" name="action" value="EDIT" > <table width="100%"> <tr> <td width="50%"> NOTES: on the reward amount, be VERY careful with your input. You can make random giveaways using p.e. {1} rand(5,20) {2} rand(5,20)*$ir['level'] which will give the user a random amount between 5 and 20 of the type you have chosen. If you want to show the reward amount ot the user, use fig 1 or 2 Money: {money} Crystals: {crystals} Item: {item} Nothing: {nothing} (returns the word "nothing") Jail Time: {jail} Hospital Time: {hospital} Robbed: {rob} (returns the word "robbed") REWARD TYPES Get Robbed: Player loses money </td> <td> Location <select name="location" id="location"> <?php if ($step['location']==0) { ?> <option selected="selected" value="0">All Cities</option> <?php } else { ?> <option value="0">All Cities</option> <?php } $l = $db->query("SELECT `cityid`, `cityname` FROM `cities`"); while($disp = $db->fetch_row($l)) { if ($step['location'] == $disp['cityid']) { ?> <option selected="selected" value="<?php echo $disp['cityid']; ?>"><?php echo $disp['cityname']; ?></option> <?php } else { ?> <option value="<?php echo $disp['cityid']; ?>"><?php echo $disp['cityname']; ?></option> <?php } } ?> </select> Create Reward/Penalty Type: <select name="sreward" id="sreward"> <?php if ($step['reward_type']=='nothing') { ?> <option selected="selected" value="nothing">Nothing</option> <?php } else { ?> <option value="nothing">Nothing</option> <?php } $l = $db->query("SELECT `srID`, `srNAME`, `srDBNAME` FROM `streets_rewardtypes`"); while($disp = $db->fetch_row($l)) { if ($step['reward_type'] == $disp['srDBNAME']) { ?> <option selected="selected" value="<?php echo $disp['srDBNAME']; ?>"><?php echo $disp['srNAME']; ?></option> <?php } else { ?> <option value="<?php echo $disp['srDBNAME']; ?>"><?php echo $disp['srNAME']; ?></option> <?php } } ?> </select> Item ID or Reward/Penalty Amount: <input type="text" name="reward" id="reward" value="<?php echo $step['reward']; ?>" /> Jail/Hospital Reason: <textarea name="reason" id="reason" cols="45" rows="5"><?php echo $step['reason']; ?></textarea> Text: <textarea name="text" cols="45" rows="5" id="text"><?php echo $step['text']; ?></textarea> </td> </tr> <tr> <td colspan="2" align="center"><input type="submit" name="submit2" id="submit2" value="Edit Step" /></td> </tr> </table> </form> <?php } else { $_POST['sreward']=$db->escape($_POST['sreward']); if(empty($_POST['text'])) { echo "Step text not entered."; $h->endpage(); exit; } if(empty($_POST['location'])) { $_POST['location']=0; } if(empty($_POST['reward']) AND $_POST['sreward']!='nothing') { echo "Reward was not entered"; $h->endpage(); exit; } if ($_POST['sreward']) { if(($_POST['sreward']=='jail' OR $_POST['sreward']=='hospital') && empty($_POST['reason'])) { echo "Reason was not entered"; $h->endpage(); exit; } if($_POST['sreward']=='item') { $item=$db->query("SELECT itmid FROM items WHERE itmid={$_POST['reward']}"); if (!$db->num_rows($item)) { echo "The Item you entered does not exist."; $h->endpage(); exit; } } } $update = " UPDATE `streets` SET `location`='{$_POST['location']}', `reward`='{$_POST['reward']}',`reward_type`='{$_POST['sreward']}', `reason`='{$db->escape($_POST['reason'])}', `text`='{$db->escape($_POST['text'])}' WHERE sid={$_POST['streetid']}"; $db->query($update); echo "You have successfully edited this Step!"; $h->endpage(); exit; } }}// DELETE STEPfunction delete_step() { ?><h1> DELETE STEP </h1><?php $db->query("DELETE FROM streets WHERE sid={$_POST['streetid']}"); echo "The step has been deleted."; } // CREATE NEW STEPfunction create_step() {global $db,$h; ?><h1> CREATE STEP </h1><?php if(!isset($_POST['submit'])) { ?> <form action="staff_streets.php?action=create" method="post"> <table width="100%"> <tr> <td width="50%"> NOTES: on the reward amount, be VERY careful with your input. You can make random giveaways using p.e. {1} rand(5,20) {2} rand(5,20)*$ir['level'] which will give the user a random amount between 5 and 20 of the type you have chosen. If you want to show the reward amount ot the user, use fig 1 or 2 Money: {money} Crystals: {crystals} Item: {item} Nothing: {nothing} (returns the word "nothing") Jail Time: {jail} Hospital Time: {hospital} Robbed: {rob} (returns the word "robbed") REWARD TYPES Get Robbed: Player loses money </td> <td> Location <select name="location" id="location"> <option selected="selected" value="0">All Cities</option> <?php $l = $db->query("SELECT `cityid`, `cityname` FROM `cities`"); while($disp = $db->fetch_row($l)) { ?> <option value="<?php echo $disp['cityid']; ?>"><?php echo $disp['cityname']; ?></option> <?php } ?> </select> Create Reward/Penalty Type: <select name="sreward" id="sreward"> <option value="nothing">Nothing</option> <?php $l = $db->query("SELECT `srID`, `srNAME`, `srDBNAME` FROM `streets_rewardtypes`"); while($disp = $db->fetch_row($l)) { ?> <option value="<?php echo $disp['srDBNAME']; ?>"><?php echo $disp['srNAME']; ?></option> <?php } ?> </select> Item ID or Reward/Penalty Amount: <input type="text" name="reward" id="reward" /> Jail/Hospital Reason: <textarea name="reason" id="reason" cols="45" rows="5"></textarea> Text: <textarea name="text" cols="45" rows="5" id="text"></textarea> </td> </tr> <tr> <td colspan="2" align="center"><input type="submit" name="submit" id="submit" value="Add Step" /></td> </tr> </table> </form> <?php } else { $_POST['sreward']=$db->escape($_POST['sreward']); if(empty($_POST['text'])) { echo "Step text not entered."; $h->endpage(); exit; } if(empty($_POST['location'])) { $_POST['location']=0; } if(empty($_POST['reward']) AND $_POST['sreward']!='nothing') { echo "Reward was not entered"; $h->endpage(); exit; } if ($_POST['sreward']) { if(($_POST['sreward']=='jail' OR $_POST['sreward']=='hospital') && empty($_POST['reason'])) { echo "Reason was not entered"; $h->endpage(); exit; } if($_POST['sreward']=='item') { $item=$db->query("SELECT itmid FROM items WHERE itmid={$_POST['reward']}"); if (!$db->num_rows($item)) { echo "The Item you entered does not exist."; $h->endpage(); exit; } } } $insert = " INSERT INTO `streets` (`location`, `reward`, `reward_type`, `reason`, `text`) VALUES ({$_POST['location']}, '{$_POST['reward']}', '{$_POST['sreward']}','{$db->escape($_POST['reason'])}','{$db->escape($_POST['text'])}')"; $db->query($insert); echo "Step created on city id {$_POST['location']}."; $h->endpage(); exit; }} // VIEW ALL CREATED STEPSfunction view_steps() {global $db,$h;?><h1> VIEWING CREATED STEPS </h1><?php ?><?php // PAGINATION -- $st=abs((int) $_GET['st']); $app=25; $q=$db->query("SELECT sid FROM streets"); $isid=$db->num_rows($q); $pages=ceil($isid/$app); print "Pages: "; for($i=1;$i<=$pages;$i++) { $s=($i-1)*$app; if($s==$st) { print "<b>$i</b> "; } else { print "<a href='staff_streets.php?st=$s'>$i</a> "; } if($i % 30 == 0) { print ""; } } echo "<table width='100%' class='table'><tr><th> ID </th><th> Location </th><th> Reward Type </th><th> Reward Amount </th><th> EDIT/DELETE </th></tr> "; $q=$db->query("SELECT * FROM streets s LEFT JOIN cities c ON s.location=c.cityid WHERE s.sid>0 ORDER BY location ASC LIMIT $st, $app"); while($ss=$db->fetch_row($q)) { if ($ss['cityid']==0) {$ss['cityname']="All Cities"; } echo "<tr><td> {$ss['sid']} </td><td> {$ss['cityname']} </td><td> {$ss['reward_type']}</td><td> {$ss['reward']} </td> <td> <form action='staff_streets.php?action=edit' method='POST'><input type='hidden' name='streetid' value='{$ss['sid']}'><input type='submit' name='action' value='EDIT'></form> <form action='staff_streets.php?action=delete' method='POST'><input type='hidden' name='streetid' value='{$ss['sid']}'><input type='submit' name='action' value='DELETE'></form> </td> </tr>"; } echo "</table>"; print "Pages: "; for($i=1;$i<=$pages;$i++) { $s=($i-1)*$app; if($s==$st) { print "<b>$i</b> "; } else { print "<a href='staff_streets.php?&st=$s'>$i</a> "; } if($i % 30 == 0) { print ""; } } } ?><h2> MANAGE STREETS </h2><a href="staff_streets.php?action=create"> Create Step </a> <a href="staff_streets.php?action=view"> View Steps </a> <?php if ($_GET['action']=='create') { create_step(); exit;}else if ($_GET['action']=='view') { view_steps(); exit;}else if ($_GET['action']=='edit') { edit_step(); exit;}else if ($_GET['action']=='delete') { delete_step(); exit;} ?>