skooda Posted March 20, 2012 Share Posted March 20, 2012 <?php include "globals.php"; print "<h3>Create a City</h3><br />"; $back="<br /><a href='javascript:history.back();'>Back</a><br />"; $q=mysql_query("SELECT * FROM `cities` WHERE `cityowner` = '$userid'"); if($ir['donatordays'] == 0) { print "You must be a donator to run a city<br />"; print $back; } else if($ir['money'] < 2500000) { print "You do not have enough money to buy a city!<br /> You need \$2,500,000 before you can purchase one!<br />"; print $back; } else if(mysql_num_rows($q)) { print "You already own a city, You cannot own two cities."; print $back; } else { //-- cityname,citydesc if($_POST['cityname'] and $_POST['citydesc']) { $cityname=str_replace(array("<",">"),array("",""), $_POST['cityname']); $citydesc=str_replace(array("<",">"),array("",""), $_POST['citydesc']); mysql_query("INSERT INTO `cities` (`cityid`, `cityname`, `citydesc`, `cityminlevelon`, `cityminlevel`, `cityowneron`, `cityowner`, `citymost`, `cityprice`, `citydays`, `citytax`, `citytaxprice`) VALUES ('NULL', '$cityname', '$citydesc', '0', '0', '1', '$userid', '0', '100', '0', '0', '0');"); print "You have successfully created your city<br /> <a href='cityadmin.php'>Your City Admin Panel</a><br />"; } else { print "<form action='createcity.php' method='post'> <table width=90% border=1> <tr><th>City Name</th><td><input type='text' name='cityname' value=''></td></tr> <tr><th>City Description</th><td><textarea name='citydesc' cols=30 rows=8></textarea></td></tr> <tr><td colspan=2><input type='submit' value='Create City'></td></tr> </table> </form>"; } } $h->endpage(); ?> The problem is that when you create the city it dont take away the money from the user who purchase it. Quote Link to comment Share on other sites More sharing options...
corruptcity || skalman Posted March 20, 2012 Share Posted March 20, 2012 You havent added the query that updates the users money when creates a city Quote Link to comment Share on other sites More sharing options...
skooda Posted March 20, 2012 Author Share Posted March 20, 2012 (edited) yea i have DROP TABLE `cities` ; CREATE TABLE `cities` ( `cityid` int(11) NOT NULL auto_increment, `cityname` varchar(255) NOT NULL default '', `citydesc` longtext NOT NULL, `cityminlevelon` int(11) NOT NULL, `cityminlevel` int(11) NOT NULL default '0', `cityowneron` INT( 11 ) NOT NULL, `cityowner` INT( 11 ) NOT NULL, `citymost` INT( 11 ) NOT NULL, `cityprice` INT( 11 ) NOT NULL, `citydays` INT( 11 ) NOT NULL, `citytax` INT( 11 ) NOT NULL, `citytaxprice` INT( 11 ) NOT NULL, PRIMARY KEY (`cityid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ; INSERT INTO `cities` (`cityid`, `cityname`, `citydesc`, `cityminlevelon`, `cityminlevel`, `cityowneron`, `cityowner`, `citymost`, `cityprice`, `citydays`, `citytax`, `citytaxprice`) VALUES ('1', 'Default City', 'The games default city', '1', '1', '0', '0', '0', '0', '0', '0', '0'); Edited March 20, 2012 by skooda Quote Link to comment Share on other sites More sharing options...
rulerofzu Posted March 20, 2012 Share Posted March 20, 2012 No you havnt thats just for them getting the city. You need a update users Quote Link to comment Share on other sites More sharing options...
skooda Posted March 20, 2012 Author Share Posted March 20, 2012 How will I do that Quote Link to comment Share on other sites More sharing options...
HauntedDawg Posted March 20, 2012 Share Posted March 20, 2012 Above: print "You have successfully created your city place: mysql_query('UPDATE `users` SET `money` = `money` - 2500000 WHERE `userid` = '.$ir['userid']); Quote Link to comment Share on other sites More sharing options...
skooda Posted March 20, 2012 Author Share Posted March 20, 2012 Above: print "You have successfully created your city place: mysql_query('UPDATE `users` SET `money` = `money` - 2500000 WHERE `userid` = '.$ir['userid']); Thanks it work. 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.