Advertisement
peterisgb

move.php

May 27th, 2023 (edited)
1,298
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 24.40 KB | Gaming | 0 0
  1. <?php
  2. $locationmxy ="25";
  3. $locationmxx ="25";
  4. include "globals.php";
  5. $tresder=(int) rand(100,999);
  6. if($ir['jail'] or $ir['hospital']) {
  7.    echo "This page cannot be accessed while in jail or hospital.";
  8.    $h->endpage();
  9.    exit;
  10. }
  11.  
  12. $locationx = $ir['locationx'];
  13. $locationy = $ir['locationy'];
  14. $moves = $ir['moves'];
  15. $action = isset($_GET['action']) ? $_GET['action'] : '';
  16.  
  17. $actions = [
  18.     'moven' => 'do_move1_north',
  19.     'movenw' => 'do_move1_northwest',
  20.     'movene' => 'do_move1_northeast',
  21.     'movew' => 'do_move1_west',
  22.     'movee' => 'do_move1_east',
  23.     'moves' => 'do_move1_south',
  24.     'movesw' => 'do_move1_southwest',
  25.     'movese' => 'do_move1_southeast',
  26.     'search1' => 'do_search1_ad',
  27.     'search2' => 'do_search2_ad',
  28.     'staff' => 'do_staff',
  29.     'stafftowncreate' => 'staff_town_create',
  30.     'stafftowncreatedo' => 'staff_town_create_do',
  31.     'stafftownedit' => 'staff_town_edit',
  32.     'stafftowneditdo' => 'staff_town_edit_do',
  33.     'stafftowneditcom' => 'staff_town_edit_com',
  34.     'stafftowndelete' => 'staff_town_delete',
  35.     'stafftowndeletedo' => 'staff_town_delete_do',
  36.     'staffcreate' => 'staff_create',
  37.     'staffcreatedo' => 'staff_create_do',
  38.     'staffedit' => 'staff_edit',
  39.     'staffeditdo' => 'staff_edit_do',
  40.     'staffeditcom' => 'staff_edit_com',
  41.     'staffdelete' => 'staff_delete',
  42.     'staffdeletedo' => 'staff_delete_do',
  43.     'staffmoveuser' => 'staff_move_user',
  44.     'staffmoveuserdo' => 'staff_move_user_do',
  45.     'staffmoveusercom' => 'staff_move_user_com',
  46. ];
  47.  
  48. if (array_key_exists($action, $actions)) {
  49.     $function = $actions[$action];
  50.     if (function_exists($function)) {
  51.         call_user_func($function);
  52.     }
  53. }
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.    default: echo "<br /><hr /><h3>The Maps</h3>";
  62.  
  63.  
  64. if($ir['user_level'] == 2)
  65. {
  66. echo "<a href=move.php?action=staff>Staff Options</a><br />";
  67. }
  68. echo "
  69. <small>Being a donator you are 2x more likely to find money and gold while searching the map.</small><br />
  70. <small>Please Note that most images are only temporary until system is completed</small>
  71. <table width='95%'>
  72. <tr><td></td>
  73. <td align='center'>
  74. </td><tr>
  75. <tr><td align='center' valign='top' width='100'><hr />";
  76.  
  77. $northstop = ($locationy == 0) ? "<img src='/images/no.png' width='44' height='44'>" : "<a href='move.php?action=moven'><img src='/images/up.png'></a>";
  78. $northstopwest = ($locationy == 0) ? "<img src='/images/no.png' width='42' height='42'>" : "<a href='move.php?action=movenw'><img src='/images/nw.png'></a>";
  79. $northstopeast = ($locationy == 0) ? "<img src='/images/no.png' width='42' height='42'>" : "<a href='move.php?action=movene'><img src='/images/ne.png'></a>";
  80. $eaststop = ($locationy == $locationmxy) ? "<img src='/images/no.png' width='44' height='44'>" : "<a href='move.php?action=movee'><img src='/images/right.png'></a>";
  81. $southstop = ($locationx == $locationmxx) ? "<img src='/images/no.png' width='44' height='44'>" : "<a href='move.php?action=moves'><img src='/images/down.png'></a>";
  82. $southstopwest = ($locationx == 0) ? "<img src='/images/no.png' width='42' height='42'>" : "<a href='move.php?action=movesw'><img src='/images/sw.png'></a>";
  83. $southstopeast = ($locationx == 0) ? "<img src='/images/no.png' width='42' height='42'>" : "<a href='move.php?action=movese'><img src='/images/se.png'></a>";
  84. $weststop = ($locationx == 0) ? "<img src='/images/no.png' width='44' height='44'>" : "<a href='move.php?action=movew'><img src='/images/left.png'></a>";
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100. if ($moves <= 0) {
  101.     echo "No Moves, Nav Disabled";
  102. } else {
  103.     echo "
  104.    Your Map Location: <font color='blue' size='3'>
  105.    <font color='green'>" . $locationx . "</font>,
  106.    <font color='red'>" . $locationy . "</font><br />
  107.    You have <font color='yellow'>" . $moves . "</font> left.</font><hr />
  108.    <table>
  109.    <tr>
  110.     <td><font color='red'><b>N</b></font><font color='green'><b>W</b></font></td>
  111.     <td></td>
  112.     <td align='center'><font color='red'><b>N</b></font></td>
  113.     <td></td>
  114.     <td><font color='red'><b>N</b></font><font color='green'><b>E</b></font></td>
  115.    </tr>
  116.    <tr>
  117.     <td></td>
  118.     <td align='center'>" . $northstopwest . "</td>
  119.     <td align='center'>" . $northstop . "</td>
  120.     <td align='center'>" . $northstopeast . "</td>
  121.     <td></td>
  122.    </tr>
  123.    <tr>
  124.     <td><font color='green'><b>W</b></font></td>
  125.     <td align='center'>" . $weststop . "</td>
  126.     <td align='center'><b>+</b></td>
  127.     <td align='center'>" . $eaststop . "</a></td>
  128.     <td><font color='green'><b>E</b></font></td>
  129.    </tr>
  130.    <tr>
  131.     <td></td>
  132.     <td align='center'>" . $southstopwest . "</td>
  133.     <td align='center'>" . $southstop . "</td>
  134.     <td align='center'>" . $southstopeast . "</td>
  135.     <td></td>
  136.    </tr>
  137.    <tr>
  138.     <td><font color='red'><b>S</b></font><font color='green'><b>W</b></font></td>
  139.     <td></td>
  140.     <td align='center'><font color='red'><b>S</b></font></td>
  141.     <td></td>
  142.     <td><font color='red'><b>S</b></font><font color='green'><b>E</b></font></td>
  143.    </tr>
  144.    </table>";
  145. }
  146.  
  147. echo "<hr /><h4>Misc</h4>";
  148. $ulocation = array();
  149. $ulocationq = $db->query("SELECT * FROM users");
  150. while ($r = $db->fetch_row($ulocationq)) {
  151.     $username = $r['username'];
  152.     $ulocation[$r['userid']] = array();
  153.     $ulocation[$r['userid']][0] = $r['locationy'];
  154.     $ulocation[$r['userid']][1] = $r['locationx'];
  155. }
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192. if ($ir['donatordays']) {
  193.     $range = 50;
  194. } else {
  195.     $range = 20;
  196. }
  197.  
  198. $x1 = rand(1, $range);
  199. $y1 = rand(1, 50);
  200. $x2 = rand(1, $range);
  201. $y2 = rand(1, 50);
  202. $x3 = rand(1, $range);
  203. $y3 = rand(1, 50);
  204. $x4 = rand(1, $range);
  205. $y4 = rand(1, 50);
  206.  
  207.  
  208. // Display Missions
  209. $mission = $db->query("SELECT * FROM mapmission");
  210. while ($mapm = $db->fetch_row($mission)) {
  211.     $id = $mapm['id'];
  212.     $mmy = $mapm['locationy'];
  213.     $mmx = $mapm['locationx'];
  214.     $missionnamelink = $mapm['missionlink'];
  215.     if (($locationy == $mmy) && ($locationx == $mmx)) {
  216.         echo "<a href='move.php?action=" . $id . "'>" . $missionnamelink . "</a>";
  217.     }
  218. }
  219.  
  220. // Display Towns
  221. $town = $db->query("SELECT * FROM maptowns");
  222. while ($t = $db->fetch_row($town)) {
  223.     $name = $t['townID'];
  224.     $tmy = $t['locationy'];
  225.     $tmx = $t['locationx'];
  226.     if (($locationy == $tmy) && ($locationx == $tmx)) {
  227.         echo "<h3>Town of $name<br /> <a href='movetown1.php'><u>Check it Out</u></a><br /></h3>";
  228.     }
  229. }
  230.  
  231.  
  232.  
  233.  
  234. if (($locationy == $y1) && ($locationx == $x1)) { echo "<h3>Hmm.. Whats that?<br /> <a href='move.php?action=search1'><u>Check it Out</u></a><br /></h3>"; }
  235. if (($locationy == $y2) && ($locationx == $x2)) { echo "<h3>Hmm.. Whats that?<br /> <a href='move.php?action=search2'><u>Check it Out</u></a><br /></h3>"; }
  236. if (($locationy == $y3) && ($locationx == $x3)) { echo "<h3>Hmm.. Whats that?<br /> <a href='move.php?action=search1'><u>Check it Out</u></a><br /></h3>"; }
  237. if (($locationy == $y4) && ($locationx == $x4)) { echo "<h3>Hmm.. Whats that?<br /> <a href='move.php?action=search2'><u>Check it Out</u></a><br /></h3>"; }
  238.  
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245. $i = 1;
  246. foreach($ulocation as $loc)
  247. {
  248.        if (($locationy == $loc[1]) && ($locationx == $loc[0]) && ($i != $user_id)) {
  249.                echo "<h3>Another User is Here.</h3>
  250.               <a href='viewuser.php?u=".$i."'>View user ID ".$i."</a><br />
  251.               <a href='attack.php?ID=".$i."'>Attack user ID ".$i."</a><br />
  252.               <a href='mailbox.php?action=compose&ID=".$i."'>Mail user ID ".$i."</a><br />
  253.  
  254. ";
  255.        }
  256.        $i++;
  257. }
  258. echo "<hr />
  259. <u><b>Legend</b></u><br />
  260. <table width='110px'>
  261. <tr>
  262. <td>You</td>
  263. <td> - </td>
  264. <td><img src='/images/punki.jpg' width='20' height='20'></td>
  265. </tr>
  266. <tr>
  267. <td>Users</td>
  268. <td> - </td>
  269. <td><img src='/images/cop.jpg' width='20' height='20'></td>
  270. </tr>
  271. <tr>
  272. <td>Town</td>
  273. <td> - </td>
  274. <td><img src='/images/city.png' width='20' height='20'></td>
  275. </tr>
  276. <tr>
  277. <td>Missions</td>
  278. <td> - </td>
  279. <td><img src='/images/mission.png' width='20' height='20'></td>
  280. </tr>
  281. </table>
  282. <hr />";
  283.  
  284.  
  285.  
  286.  
  287.  
  288.  
  289.  
  290.  
  291.  
  292.  
  293.  
  294.  
  295.  
  296.  
  297.  
  298.  
  299.  
  300. function do_staff()
  301. {
  302.     global $db, $ir, $c;
  303.     if ($ir['user_level'] != 2) {
  304.         die("403");
  305.     }
  306.     echo "<br /><br />
  307.    This Is Brand new so give me a chance to get all these options added and written.<br />
  308.    The Plan with this section is to be able to edit and create new missions to be put on the maps.<br />
  309.    If this goes to plan we should have all options controlling the map and all of its functions.<br />
  310.    <br /><br />Please do not use links below. These Missions links do work but are not yet ready for the map.<br /><br />
  311.    <i>Mission</i><br />
  312.    <a href='move.php?action=staffcreate'>Create Mission</a><br />
  313.    <a href='move.php?action=staffedit'>Edit Mission</a><br />
  314.    <a href='move.php?action=staffdelete'>Delete Mission</a><br /><br />
  315.    <i>Towns</i><br />
  316.    <a href='move.php?action=stafftowncreate'>Create Town</a><br />
  317.    <a href='move.php?action=stafftownedit'>Edit Town</a><br />
  318.    <a href='move.php?action=stafftowndelete'>Delete Town</a><br /><br />
  319.    <i>Other</i><br />
  320.    <a href='move.php?action=staffmoveuser'>Move User's Location</a><br />
  321.    <br />
  322.    <a href='move.php'>Back to Map</a><br />";
  323. }
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.  
  335.  
  336.  
  337.  
  338.  
  339.  
  340.  
  341.  
  342. // Move Functions
  343. function do_move1($direction, $locationUpdate, $moveUpdate)
  344. {
  345.     global $db, $userid;
  346.     $db->query("UPDATE users SET $locationUpdate, moves=moves$moveUpdate WHERE userid=$userid");
  347.     echo "Moved $direction<br /><meta http-equiv='refresh' content='0;URL=move.php' /> ";
  348. }
  349. do_move1('North', 'locationy=locationy-1', '-1');
  350. do_move1('North West', 'locationy=locationy-1, locationx=locationx-2', '-1');
  351. do_move1('North East', 'locationy=locationy-1, locationx=locationx+2', '-1');
  352. do_move1('East', 'locationx=locationx+1', '-1');
  353. do_move1('West', 'locationx=locationx-1', '-1');
  354. do_move1('South West', 'locationy=locationy+1, locationx=locationx-1', '+2');
  355. do_move1('South East', 'locationy=locationy+1, locationx=locationx+1', '-2');
  356. do_move1('South', 'locationy=locationy+1', '-1');
  357.  
  358.  
  359. // searches
  360. function do_search1_ad()
  361. {
  362. global $db, $userid;
  363. $db->query("UPDATE users SET money=money+1000000 WHERE userid='$userid'");
  364. echo "You Found 1000000 coins.<a href='move.php'>Continue</a>";
  365. }
  366. function do_search2_ad()
  367. {
  368. global $db, $userid;
  369. $db->query("UPDATE users SET crystals=crystals+10000 WHERE userid='$userid'");
  370. echo "You Found 10000 gold.<a href='move.php'>Continue</a>";
  371. }
  372.  
  373.  
  374.  
  375.  
  376.  
  377. // Staff Section
  378. function do_staff()
  379. {
  380. global $db,$ir, $c;
  381. if($ir['user_level'] != 2)
  382. {
  383. die("403");
  384. }
  385. echo "<br /><br />
  386. This Is Brand new so give me a chance to get all these options added and written.<br />
  387. The Plan with this section is to be able to edit and create new missions to be put on the maps.<br />
  388. If this goes to plan we should have all options controlling the map and all of its functions.<br />
  389. <br /><br />Please do not use links below. These Missions links do work but are not yet ready for the map.<br /><br />
  390. <i>Mission</i><br />
  391. <a href=move.php?action=staffcreate>Create Mission</a><br />
  392. <a href=move.php?action=staffedit>Edit Mission</a><br />
  393. <a href=move.php?action=staffdelete>Delete Mission</a><br /><br />
  394. <i>Towns</i><br />
  395. <a href=move.php?action=stafftowncreate>Create Town</a><br />
  396. <a href=move.php?action=stafftownedit>Edit Town</a><br />
  397. <a href=move.php?action=stafftowndelete>Delete Town</a><br /><br />
  398. <i>Other</i><br />
  399. <a href=move.php?action=staffmoveuser>Move Users Location</a><br />
  400. <br />
  401. <a href=move.php>Back to Map</a><br />
  402. ";
  403. }
  404.  
  405.  
  406. function staff_create()
  407. {
  408.     global $ir;
  409.     if ($ir['user_level'] != 2) {
  410.         die("Restricted Area");
  411.     }
  412.     ?>
  413.     <h3>Create Mission(s)</h3>
  414.     Welcome to the mission section. Here you can create your mission to add to the maps.<br />
  415.     <form action="move.php?action=staffcreatedo" method="post">
  416.         Location Y: <input type="text" name="locationy" /><br />
  417.         Location X: <input type="text" name="locationx" /><br />
  418.         Mission Name: <input type="text" name="missionname" /><br />
  419.         Mission Length: <input type="text" name="missionlength" value="1" /><br />
  420.         Start Mission Link Text: <input type="text" name="missionlink" /><br />
  421.         Mission Text: <textarea rows="6" cols="60" name="missiontext"></textarea><br /><hr />
  422.         Leave Mission Next Step Blank to End Mission.<br />
  423.         Mission Next Step: <textarea rows="6" cols="60" name="missionnext"></textarea><br />
  424.         Mission Next Step Location:<br />
  425.         Location Y: <input type="text" name="locationynext" /><br />
  426.         Location X: <input type="text" name="locationxnext" /><br /><hr />
  427.         Mission Reward<br />
  428.         Cash: <input type="text" name="cash" /><br />
  429.         Gold: <input type="text" name="crystals" /><br />
  430.         Reward rewarded after mission?: <input type="text" name="rewardnumber" value="1"><br />
  431.         <input type="submit" value="Add Mission" />
  432.     </form>
  433.     <?php
  434. }
  435.  
  436. function staff_create_do()
  437. {
  438.     global $db, $ir;
  439.     if ($ir['user_level'] != 2) {
  440.         die("Restricted Area");
  441.     }
  442.  
  443.     $locationY = (int)$_POST['locationy'];
  444.     $locationX = (int)$_POST['locationx'];
  445.     $missionName = $db->escape($_POST['missionname']);
  446.     $missionLength = (int)$_POST['missionlength'];
  447.     $missionLink = $db->escape($_POST['missionlink']);
  448.     $missionText = $db->escape($_POST['missiontext']);
  449.     $missionNext = $db->escape($_POST['missionnext']);
  450.     $locationYNext = (int)$_POST['locationynext'];
  451.     $locationXNext = (int)$_POST['locationxnext'];
  452.     $cash = (int)$_POST['cash'];
  453.     $crystals = (int)$_POST['crystals'];
  454.     $rewardNumber = (int)$_POST['rewardnumber'];
  455.  
  456.     $query = "INSERT INTO mapmission (locationy, locationx, missionname, missionlength, missionlink, missiontext, missionnext, locationynext, locationxnext, cash, crystals, rewardnumber)
  457.              VALUES ($locationY, $locationX, '$missionName', $missionLength, '$missionLink', '$missionText', '$missionNext', $locationYNext, $locationXNext, $cash, $crystals, $rewardNumber)";
  458.     $db->query($query);
  459.  
  460.     echo "Mission Created<br /><a href='move.php'>Back to Map<a/>";
  461. }
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470. function staff_edit()
  471. {
  472.     global $ir;
  473.     if ($ir['user_level'] != 2) {
  474.         die("Restricted Area");
  475.     }
  476.     ?>
  477.     <form action="move.php?action=staffeditdo" method="post">
  478.         Item: <?php echo mission_dropdown($c,'mission'); ?><br />
  479.         <input type="submit" value="Edit Mission" />
  480.     </form>
  481.     <?php
  482. }
  483.  
  484. function staff_edit_do()
  485. {
  486.     global $db, $ir;
  487.     if ($ir['user_level'] != 2) {
  488.         die("Restricted Area");
  489.     }
  490.     $missionId = (int)$_POST['mission'];
  491.     $d = $db->query("SELECT * FROM mapmission WHERE id={$missionId}");
  492.     $miss = $db->fetch_row($d);
  493.     ?>
  494.     <h3>Edit Mission(s)</h3>
  495.     Welcome to the mission section. Here you can edit your mission to fix typos or update your mission.<br />
  496.     <form action="move.php?action=staffeditcom" method="post">
  497.         <input type="hidden" name="id" value="<?php echo $miss['id']; ?>" />
  498.         Location Y: <input type="text" name="locationy" value="<?php echo $miss['locationy']; ?>" /><br />
  499.         Location X: <input type="text" name="locationx" value="<?php echo $miss['locationx']; ?>" /><br />
  500.         Mission Name: <input type="text" name="missionname" value="<?php echo $db->escape($miss['missionname']); ?>" /><br />
  501.         Mission Length: <input type="text" name="missionlength" value="<?php echo $miss['missionlength']; ?>" /><br />
  502.         Start Mission Link Text: <input type="text" name="missionlink" value="<?php echo $db->escape($miss['missionlink']); ?>" /><br />
  503.         Mission Text: <textarea rows="6" cols="60" name="missiontext"><?php echo $db->escape($miss['missiontext']); ?></textarea><br /><hr />
  504.         Leave Mission Next Step Blank to End Mission.<br />
  505.         Mission Next Step: <textarea rows="6" cols="60" name="missionnext"><?php echo $db->escape($miss['missionnext']); ?></textarea><br />
  506.         Mission Next Step Location:<br />
  507.         Location Y: <input type="text" name="locationynext" value="<?php echo $miss['locationynext']; ?>" /><br />
  508.         Location X: <input type="text" name="locationxnext" value="<?php echo $miss['locationxnext']; ?>" /><br /><hr />
  509.         Mission Reward<br />
  510.         Cash: <input type="text" name="cash" value="<?php echo $miss['cash']; ?>" /><br />
  511.         Gold: <input type="text" name="crystals" value="<?php echo $miss['crystals']; ?>" /><br />
  512.         Reward rewarded after mission?: <input type="text" name="rewardnumber" value="<?php echo $miss['rewardnumber']; ?>" /><br />
  513.         <input type="submit" value="Edit Mission" />
  514.     </form>
  515.     <?php
  516. }
  517.  
  518. function staff_edit_com()
  519. {
  520.     global $db, $ir;
  521.     if ($ir['user_level'] != 2) {
  522.         die("Restricted Area");
  523.     }
  524.     $locationY = (int)$_POST['locationy'];
  525.     $locationX = (int)$_POST['locationx'];
  526.     $missionName = $db->escape($_POST['missionname']);
  527.     $missionLength = (int)$_POST['missionlength'];
  528.     $missionLink = $db->escape($_POST['missionlink']);
  529.     $missionText = $db->escape($_POST['missiontext']);
  530.     $missionNext = $db->escape($_POST['missionnext']);
  531.     $locationYNext = (int)$_POST['locationynext'];
  532.     $locationXNext = (int)$_POST['locationxnext'];
  533.     $cash = (int)$_POST['cash'];
  534.     $crystals = (int)$_POST['crystals'];
  535.     $rewardNumber = (int)$_POST['rewardnumber'];
  536.  
  537.     $query = "UPDATE mapmission SET locationy={$locationY}, locationx={$locationX}, missionname='{$missionName}', missionlength={$missionLength}, missionlink='{$missionLink}', missiontext='{$missionText}', missionnext='{$missionNext}', locationynext={$locationYNext}, locationxnext='{$locationXNext}', cash='{$cash}', crystals='{$crystals}', rewardnumber='{$rewardNumber}' WHERE id={$_POST['id']}";
  538.     $db->query($query);
  539.  
  540.     echo "Mission Edited<br /><a href='move.php'>Back to Map<a/>";
  541. }
  542.  
  543.  
  544.  
  545.  
  546.  
  547.  
  548.  
  549.  
  550.  
  551.  
  552. function staff_delete()
  553. {
  554.     global $db, $ir;
  555.     if ($ir['user_level'] > 2) {
  556.         die("Restricted Area");
  557.     }
  558.     ?>
  559.     <h3>Deleting Mission</h3>
  560.     The Mission will be permanently removed from the game.<br />
  561.     <form action="move.php?action=staffdeletedo" method="post">
  562.         Item: <?php echo mission_dropdown($c,'mission'); ?><br />
  563.         <input type="submit" value="Delete Mission" />
  564.     </form>
  565.     <?php
  566. }
  567.  
  568. function staff_delete_do()
  569. {
  570.     global $db, $ir;
  571.     if ($ir['user_level'] > 2) {
  572.         die("Restricted Area");
  573.     }
  574.     $missionId = (int)$_POST['mission'];
  575.     $d = $db->query("SELECT * FROM mapmission WHERE id={$missionId}");
  576.     $miss = $db->fetch_row($d);
  577.     $db->query("DELETE FROM mapmission WHERE id={$missionId}");
  578.     echo "The {$db->escape($miss['mission'])} Mission was removed from the game.";
  579. }
  580.  
  581.  
  582.  
  583.  
  584.  
  585.  
  586.  
  587. function staff_town_create()
  588. {
  589.     global $db, $ir;
  590.     if ($ir['user_level'] != 2) {
  591.         die("Restricted Area");
  592.     }
  593.     ?>
  594.     <h3>Create Town</h3>
  595.     Welcome to the create town section, Here you can create your town to add to the maps.<br />
  596.     <form action="move.php?action=stafftowncreatedo" method="post">
  597.         Town Name: <input type="text" name="townID" /><br />
  598.         Location Y: <input type="text" name="locationx" /><br />
  599.         Location X: <input type="text" name="locationy" /><br />
  600.         <input type="submit" value="Add Town" />
  601.     </form>
  602.     <?php
  603. }
  604.  
  605. function staff_town_create_do()
  606. {
  607.     global $db, $ir;
  608.     if ($ir['user_level'] != 2) {
  609.         die("Restricted Area");
  610.     }
  611.     $townID = $db->escape($_POST['townID']);
  612.     $locationy = (int)$_POST['locationy'];
  613.     $locationx = (int)$_POST['locationx'];
  614.     $db->query("INSERT INTO maptowns SET townID='{$townID}', locationy={$locationy}, locationx={$locationx}");
  615.     echo "Town Created<br /><a href='move.php'>Back to Map<a/>";
  616. }
  617.  
  618.  
  619. function staff_town_edit()
  620. {
  621.     global $db, $ir, $c;
  622.     if ($ir['user_level'] != 2) {
  623.         die("Restricted Area");
  624.     }
  625.     ?>
  626.     <form action="move.php?action=stafftowneditdo" method="post">
  627.         Item: <?php echo town_dropdown($c, 'town'); ?><br />
  628.         <input type="submit" value="Edit Town" />
  629.     </form>
  630.     <?php
  631. }
  632.  
  633. function staff_town_edit_do()
  634. {
  635.     global $db, $ir, $c;
  636.     if ($ir['user_level'] != 2) {
  637.         die("Restricted Area");
  638.     }
  639.     $townID = $db->escape($_POST['town']);
  640.     $d = $db->query("SELECT * FROM maptowns WHERE townID='{$townID}'");
  641.     $miss = $db->fetch_row($d);
  642.     ?>
  643.     <h3>Edit Town</h3>
  644.     Welcome to the town section, Here you can edit your town's ID and location.<br />
  645.     <form action="move.php?action=stafftowneditcom" method="post">
  646.         <input type="hidden" name="id" value="<?php echo $miss['id']; ?>" />
  647.         Town name: <input type="text" name="townID" value="<?php echo $miss['townID']; ?>" /><br />
  648.         Location Y: <input type="text" name="locationy" value="<?php echo $miss['locationy']; ?>" /><br />
  649.         Location X: <input type="text" name="locationx" value="<?php echo $miss['locationx']; ?>" /><br />
  650.         <input type="submit" value="Edit Town" />
  651.     </form>
  652.     <?php
  653. }
  654.  
  655. function staff_town_edit_com()
  656. {
  657.     global $db, $ir, $c;
  658.     if ($ir['user_level'] != 2) {
  659.         die("Restricted Area");
  660.     }
  661.     $townID = $db->escape($_POST['townID']);
  662.     $locationy = (int)$_POST['locationy'];
  663.     $locationx = (int)$_POST['locationx'];
  664.     $db->query("UPDATE maptowns SET townID='{$townID}', locationy={$locationy}, locationx={$locationx}");
  665.     echo "Town Edited<br /><a href='move.php'>Back to Map<a/>";
  666. }
  667.  
  668.  
  669.  
  670. function staff_town_delete()
  671. {
  672.     global $db, $ir, $c, $h, $userid;
  673.     if ($ir['user_level'] > 2) {
  674.         die("Restricted Area");
  675.     }
  676.     ?>
  677.     <h3>Deleting Town</h3>
  678.     The Town Location will be permanently removed from the game.<br />
  679.     <form action="move.php?action=stafftowndeletedo" method="post">
  680.         Item: <?php echo town_dropdown($c, 'town'); ?><br />
  681.         <input type="submit" value="Delete Town" />
  682.     </form>
  683.     <?php
  684. }
  685.  
  686. function staff_town_delete_do()
  687. {
  688.     global $db, $ir, $c, $h, $userid;
  689.     if ($ir['user_level'] > 2) {
  690.         die("Restricted Area");
  691.     }
  692.     $townID = $db->escape($_POST['town']);
  693.     $d = $db->query("SELECT * FROM maptowns WHERE townID='{$townID}'");
  694.     $miss = $db->fetch_row($d);
  695.     $db->query("DELETE FROM maptowns WHERE townID='{$townID}'");
  696.     echo "The {$miss['townID']} Town was removed from the game.";
  697. }
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706. function staff_move_user()
  707. {
  708.     global $db, $ir, $c, $h, $userid;
  709.     if ($ir['user_level'] != 2) {
  710.         die("Restricted Area");
  711.     }
  712.     ?>
  713.     <h3>Editing Users Location</h3>
  714.     Enter user's ID<br />
  715.     <form action="move.php?action=staffmoveuserdo" method="post">
  716.         User: <input type="text" name="user" value="0" /><br />
  717.         <input type="submit" value="Edit User Location" />
  718.     </form>
  719.     <?php
  720. }
  721.  
  722. function staff_move_user_do()
  723. {
  724.     global $db, $ir, $c, $h, $userid;
  725.     if ($ir['user_level'] != 2) {
  726.         die("403");
  727.     }
  728.     $userID = $db->escape($_POST['user']);
  729.     $d = $db->query("SELECT * FROM users WHERE userid='{$userID}'");
  730.     $user = $db->fetch_row($d);
  731.     ?>
  732.     <h3>Editing User's Location</h3>
  733.     <form action="move.php?action=staffmoveusercom" method="post">
  734.         <input type="hidden" name="userid" value="<?php echo $userID; ?>" /><br />
  735.         <br /><br />
  736.         location x: <input type="text" name="locationx" value="<?php echo $user['locationx']; ?>" /><br />
  737.         location y: <input type="text" name="locationy" value="<?php echo $user['locationy']; ?>" /><br />
  738.         <input type="submit" value="Edit user location" />
  739.     </form>
  740.     <br />
  741.     <?php
  742. }
  743.  
  744. function staff_move_user_com()
  745. {
  746.     global $db, $ir, $c, $h, $userid;
  747.     if ($ir['user_level'] != 2) {
  748.         die("Restricted Area");
  749.     }
  750.     $userID = $db->escape($_POST['userid']);
  751.     $locationX = $db->escape($_POST['locationx']);
  752.     $locationY = $db->escape($_POST['locationy']);
  753.     $db->query("UPDATE users SET locationx='{$locationX}', locationy='{$locationY}' WHERE userid='{$userID}'");
  754.     echo "User has been moved to location <font color='green'>{$locationX}</font>, <font color='red'>{$locationY}</font><meta http-equiv='refresh' content='2;URL=move.php' />";
  755. }
  756.  
  757.  
  758.  
  759.  
  760.  
  761.  
  762.  
  763.  
  764.  
  765.  
  766.  
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788.  
  789. // Map interaction functions
  790. function do_leave()
  791. {
  792.    echo "You Left, Returning to Map.<meta http-equiv='refresh' content='1;URL=move.php' /> ";
  793. }
  794.  
  795.  
  796.  
  797. $h->endpage();
  798. ?>
Tags: move.php
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement