3XTR3M3 Posted August 16, 2007 Share Posted August 16, 2007 When i try and make a city i just refreshes and doesnt make a city Quote Link to comment Share on other sites More sharing options...
mr smith Posted August 16, 2007 Share Posted August 16, 2007 Re: [V2] Staff_cities Help try replacing saff cities.php with this code. it allows you to create cities unfortunately once you make them you cant see them.. i am having the same trouble as you Quote Link to comment Share on other sites More sharing options...
mr smith Posted August 16, 2007 Share Posted August 16, 2007 Re: [V2] Staff_cities Help <?php include "sglobals.php"; if($ir['user_level'] > 2) { die("403"); } //This contains city stuffs switch($_GET['action']) { case "addcity": addcity(); break; case "editcity": editcity(); break; case "delcity": delcity(); break; default: print "Error: This script requires an action."; break; } function addcity() { global $db, $ir, $c, $h, $userid; $minlevel=abs((int) $_POST['minlevel']); $name=$_POST['name']; $desc=$_POST['desc']; if($minlevel and $desc and $name) { $q=$db->query("SELECT * FROM cities WHERE cityname='{$name}'"); if($db->num_rows($q)) { print "Sorry, you cannot have two cities with the same name."; $h->endpage(); exit; } $db->query("INSERT INTO cities VALUES(NULL, '$name', '$desc', '$minlevel')"); print "City {$name} added to the game."; stafflog_add("Created City $name"); } else { print "<h3>Add City</h3><hr /> <form action='staff_cities.php?action=addcity' method='post'> Name: <input type='text' name='name' /> Description: <input type='text' name='desc' /> Minimum Level: <input type='text' name='minlevel' /> <input type='submit' value='Add City' /></form>"; } } function editcity() { global $db, $ir, $c, $h, $userid; switch($_POST['step']) { case "2": $minlevel=abs((int) $_POST['minlevel']); $name=$_POST['name']; $desc=$_POST['desc']; $q=$db->query("SELECT * FROM cities WHERE cityname='{$name}' AND cityid!={$_POST['id']}"); if($db->num_rows($q)) { print "Sorry, you cannot have two cities with the same name."; $h->endpage(); exit; } $name=$_POST['name']; $q=$db->query("SELECT * FROM cities WHERE cityid={$_POST['id']}"); $old=$db->fetch_row($q); $db->query("UPDATE cities SET cityminlevel=$minlevel, citydesc='$desc', cityname='$name' WHERE cityid={$_POST['id']}"); print "City $name was edited successfully."; stafflog_add("Edited city $name"); break; case "1": $q=$db->query("SELECT * FROM cities WHERE cityid={$_POST['city']}"); $old=$db->fetch_row($q); print "<h3>Editing a City</h3><hr /> <form action='staff_cities.php?action=editcity' method='post'> <input type='hidden' name='step' value='2' /> <input type='hidden' name='id' value='{$_POST['city']}' /> Name: <input type='text' name='name' value='{$old['cityname']}' /> Description: <input type='text' name='desc' value='{$old['citydesc']}' /> Minimum Level: <input type='text' name='minlevel' value='{$old['cityminlevel']}' /> <input type='submit' value='Edit City' /></form>"; break; default: print "<h3>Editing a City</h3><hr /> <form action='staff_cities.php?action=editcity' method='post'> <input type='hidden' name='step' value='1' /> City: ".location_dropdown($c, "city")." <input type='submit' value='Edit City' /></form>"; break; } } function delcity() { global $db,$ir,$c,$h,$userid; if($_POST['city']) { $q=$db->query("SELECT * FROM cities WHERE cityid={$_POST['city']}"); $old=$db->fetch_row($q); if($old['cityid']==1) { die("This city cannot be deleted."); } $db->query("UPDATE users SET location=1 WHERE location={$old['cityid']}"); $db->query("UPDATE shops SET shopLOCATION=1 WHERE shopLOCATION={$old['cityid']}"); $db->query("DELETE FROM cities WHERE cityid={$old['cityid']}"); print "City {$old['cityname']} deleted."; stafflog_add("Deleted city {$old['cityname']}"); } else { print "<h3>Delete City</h3><hr /> Deleting a city is permanent - be sure. Any users and shops that are currently in the city you delete will be moved to the default city (ID 1).<form action='staff_cities.php?action=delcity' method='post'> City: ".location_dropdown($c, "city")." <input type='submit' value='Delete City' /></form>"; } } function report_clear() { global $db,$ir,$c,$h,$userid; if($ir['user_level'] > 3) { die("403"); } $_GET['ID'] = abs((int) $_GET['ID']); stafflog_add("Cleared player report ID {$_GET['ID']}"); $db->query("DELETE FROM preports WHERE prID={$_GET['ID']}"); print "Report cleared and deleted! [url='staff_users.php?action=reportsview']> Back[/url]"; } $h->endpage(); ?> Edit: Please use [code]...[/code] tags. Quote Link to comment Share on other sites More sharing options...
3XTR3M3 Posted August 17, 2007 Author Share Posted August 17, 2007 Re: [V2] Staff_cities Help I want it to work like it is though but im just wating see if any one noes how to fix the problem Quote Link to comment Share on other sites More sharing options...
3XTR3M3 Posted August 17, 2007 Author Share Posted August 17, 2007 Re: [V2] Staff_cities Help its the tavel bit its added them in db but not on travel agency some post the right travel aency Quote Link to comment Share on other sites More sharing options...
fbiss Posted September 28, 2007 Share Posted September 28, 2007 Re: [V2] Staff_cities Help I had this same problem, But i found the problem with mine. I changed this: (notice the missing ' next to minlevel ) Minimum Level: <input type='text' name=minlevel' value='{$old['cityminlevel']}' /> to: Minimum Level: <input type='text' name='minlevel' value='{$old['cityminlevel']}' /> Quote Link to comment Share on other sites More sharing options...
3XTR3M3 Posted September 28, 2007 Author Share Posted September 28, 2007 Re: [V2] Staff_cities Help my monorail looks like this <?php include "globals.php"; $_GET['to'] = abs((int) $_GET['to']); if(!$_GET['to']) { print "Welcome to the Monorail Station. It costs \$1000 for a ticket. Where would you like to travel today? "; $q=$db->query("SELECT * FROM cities WHERE cityid != {$ir['location']} AND cityminlevel <= {$ir['level']}"); print "<table width=75% cellspacing=1 class='table'><tr style='background:gray'><th>Name</th><th>Description</th><th>Min Level</th><th> </th></tr>"; while($r=$db->fetch_row($q)) { print "<tr><td>{$r['cityname']}</td><td>{$r['citydesc']}</td><td>{$r['cityminlevel']}</td><td>[url='monorail.php?to={$r[']Go[/url]</td></tr>"; } print "</table>"; } else { if($ir['money'] < 1000) { print "You don't have enough money."; } else if( ((int) $_GET['to']) != $_GET['to']) { print "Invalid city ID"; } else { $q=$db->query("SELECT * FROM cities WHERE cityid = {$_GET['to']} AND cityminlevel <= {$ir['level']}"); if(!$db->num_rows($q)) { print "Error, this city either does not exist or you cannot go there."; } else { $db->query("UPDATE users SET money=money-1000,location={$_GET['to']} WHERE userid=$userid"); $r=$db->fetch_row($q); print "Congratulations, you paid \$1000 and travelled to {$r['cityname']} on the monorail!"; } } } $h->endpage(); ?> Quote Link to comment Share on other sites More sharing options...
AlabamaHit Posted September 30, 2007 Share Posted September 30, 2007 Re: [V2] Staff_cities Help adding the ' fixed mine..Thanks I appreciate it :) Quote Link to comment Share on other sites More sharing options...
jeeppimp Posted February 26, 2008 Share Posted February 26, 2008 Re: [V2] Staff_cities Help 'Bump' I ran into this problem where I couldn't add cities also, here's a similar fix for V2. in staff_cities line-40 Minimum Level: <input type='text' name=minlevel' /> Change it with this. Minimum Level: <input type='text' name='minlevel' /> Quote Link to comment Share on other sites More sharing options...
erus Posted February 27, 2008 Share Posted February 27, 2008 Re: [V2] Staff_cities Help look 3 posts up from yours jeeppimp :lol: Quote Link to comment Share on other sites More sharing options...
jeeppimp Posted February 27, 2008 Share Posted February 27, 2008 Re: [V2] Staff_cities Help yeah, that line was fine in mine, I believe that was at line 77, my problem was at line 40 it was missing " ' " also Quote Link to comment Share on other sites More sharing options...
Jameoo Posted August 2, 2008 Share Posted August 2, 2008 Re: [V2] Staff_cities Help do it in phpmyadmin takees 20 seconds if that Quote Link to comment Share on other sites More sharing options...
Halo Posted August 14, 2008 Share Posted August 14, 2008 Re: [V2] Staff_cities Help Check your cases, or the <form action=... code Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.