Jump to content

Help with buy city


Recommended Posts

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>



The problem is that when you create the city it dont take away the money from the user who purchase it.

Link to comment
Share on other sites

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`)


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 by skooda
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...