cohan1279 Posted July 18, 2006 Share Posted July 18, 2006 Hi I just started trying to learn alittle about php and mysql. Im trying to get an open sorce code (a game called promisance) to work, but im haveing problems with mysql.this is the begining of install instructionsTo install Promisance, you will need:1. A webserver (Apache is preferred)2. PHP4 version 4.0.5 or greater; you may use a module for your webserver, but the CGI binary is required for the turns script3. PHP GD library 1.8 or greater for the '# players registered' image generator4. MySQL version 3.23.36 or greater5. Knowledge necessary to configure crontab jobs.Installing Promisance can be done in nine easy steps:1. Extract Promisance to its own path, one visible from your web server.2. If you wish to add new races or eras, edit prom.sql to your liking. Note that if you wish to add additional eras, you must also edit: * funcs.php: line 201, to define exploration multipliers line 252, to define any era bonuses while taking turns * magicfun.php: line 87, to define the magic spell names * promisance.css: line 119, to define the era-specific colors3. Create a MySQL database for Promisance. If you cannot create a database (e.g. you do not have permission), you may rename the SQL tables by editing prom.sql and const.php accordingly.4. Create the MySQL tables: $ mysql -uusername -p[password] databasename <prom.sql5. Edit const.php to your liking (taking care to set the database host/login/password variables)6. Browse to the folder in which you have installed Promisance. Click the 'Signup' link and create your account. You will be given the following privileges: * 'Set User' to any other user in the game. * User Administration - check for multis, disable/delete accounts, etc. * Clan Administration - edit any clan as if you are the founder. * View Empire Communications - filter through all messages sent in-game; this is ideal for bringing attention to usage of profanity or any other violations of game rules.7. Copy the following text into the public page from which you will allow users to create accounts and log into Promisance:<img style="background-color:white;width:48px;height:16px" src="/promisance/promisance.php?action=count&digits=3&style=1" alt="[num]"> Players Registered<br><form method="post" action="/promisance/promisance.php?action=login"><div>Username: <input type="text" name="login_username" size="8"><br>Password: <input type="password" name="login_password" size="8"><br><input type="submit" name="do_login" value="Login"></div></form><a href="/promisance/promisance.php?action=signup"><b>- Create Empire -</b></a><br><a href="/promisance/promisance.php?action=top10"><b>- Top 10 Players -</b></a><br>8. Make a crontab entry to run the turns script: "/usr/local/bin/php turns.php" substituting the proper path to the PHP CGI binary. Schedule it according to the settings you chose in const.php.9. If you wish to use the game's directory as a front page, you may edit index.php, removing the Header("...") command and replacing it with code to generate your own front page.Notes: The first account created is given administrative privileges.It is flagged such that other empires are not capable of attacking orsending aid to you. As such, you will also be unable to access the warcenter and you will not be allowed to join clans. Through User Administration, you may appoint other users to beadministrators, giving them the same abilities and restrictions asyou.im stuck on the create msql table #5..... what do i do? also #4 with edit prom.sql? Here is the const.php i believe it set right becouse it conects to the database ( before i set the database name, password ,and all, the game would say the database was down)<? // All the constants in the game$dbhost = 'db4.awardspace.com'; // MySQL server hostname$dbuser = 'cohan1219_cohan'; // MySQL username$dbpass = 'cohan1219'; // MySQL password$dbname = 'cohan1219_cohan'; // MySQL database name$version = '4.3'; // Game version number$playerdb = 'players'; // Player table name$clandb = 'clan'; // Clan table name$racedb = 'races'; // Races table name$eradb = 'eras'; // Eras table name$lotterydb = 'lottery'; // Lottery table name$marketdb = 'market'; // Public Market table name$messagedb = 'messages'; // Messages table name$newsdb = 'news'; // News table name$config[protection] = 200; // Duration of protection$config[initturns] = 100; // Turns given on signup$config[maxturns] = 250; // Max accumulated turns$config[maxstoredturns] = 100; // Max stored turns$config[valturns] = 150; // How long before validation is necessary$config[minvacation] = 72; // Minimum vacation duration$config[vacationdelay] = 12; // Delay before empire is protected$signupsclosed = 0; // Signups closed?$lockdb = 0; // Lock the players database?$lastweek = 0; // Last week of the game? don't allow loans$turnsper = 1; // X turns$perminutes = 10; // per Y minutes$turnoffset = 0; // in case we don't run exactly 0 minutes after the hour // Note: perminutes must divide evenly into 60$maxtickets = 3; // Maximum # of lottery tickets per empire$tick_curjp = 0; // DO NOT MODIFY THESE$tick_lastjp = 1; // DO NOT MODIFY THESE$tick_lastnum = 2; // DO NOT MODIFY THESE$tick_lastwin = 3; // DO NOT MODIFY THESE$tick_jpgrow = 4; // DO NOT MODIFY THESE$trplst[0] = 'armtrp'; // an array of troop names so for loops can be used when all types are referenced$trplst[1] = 'lndtrp'; // DO NOT MODIFY THESE$trplst[2] = 'flytrp'; // DO NOT MODIFY THESE$trplst[3] = 'seatrp'; // DO NOT MODIFY THESE$trplst[4] = 'food'; // this commonly follows the troop listings$config[armtrp] = 500; // Base market costs$config[lndtrp] = 1000;$config[flytrp] = 2000;$config[seatrp] = 3000;$config[food] = 30;$config[loanbase] = 5; // Base savings/loan rates$config[savebase] = 4;$config[buildings] = 2500; // Base building cost$config[market] = 6; // Hours to arrive on market$config[bmperc] = 8450; // Percentage of troops that can be sold on black market (divide by 100 for percentage)$config[mktshops] = 0.20; // Percentage of black market cost bonus for which shops are responsible$config[indc] = 2.8; // Industry output multiplier$config[jackpot] = 100000000; // Base jackpot$styles = array(1=>"promisance.css");$stylenames = array(1=>"Default Theme"); // News text$config[news] = '<span style="color:white">Welcome to Promisance!</span>'; // Name of primary script file. DO NOT MODIFY$config[main] = 'promisance.php'; // Site/path in which the game resides$config[sitedir] = ''; // server title$config[servname] = 'promisance'; // where we go when we logout$config[home] = 'http://www.promisance.com'; // link to forum for this game$config[forums] = 'http://www.promisance.com'; // administrative contact$config[adminemail] = 'ppurgett@users.sourceforge.net'; // From address of validation emails$config[valemail] = 'nobody@promisance.com';$time = time(); // not really constants, but stuff used for all pages$datetime = date('r');$cookie = $HTTP_COOKIE_VARS;?>and here is the prop.sql. first off i do not know what im supoosed to edit here as i see nothing about the database as it says in #4 in the install and is this where im supoosed to create the table as in #5 in the install and how do i?###### Table structure for table 'clan'###CREATE TABLE clan ( num smallint unsigned NOT NULL auto_increment, founder mediumint unsigned NOT NULL default 0, asst mediumint unsigned NOT NULL default 0, fa1 mediumint unsigned NOT NULL default 0, fa2 mediumint unsigned NOT NULL default 0, ally1 smallint unsigned NOT NULL default 0, ally2 smallint unsigned NOT NULL default 0, ally3 smallint unsigned NOT NULL default 0, war1 smallint unsigned NOT NULL default 0, war2 smallint unsigned NOT NULL default 0, war3 smallint unsigned NOT NULL default 0, pic tinytext NOT NULL, url tinytext NOT NULL, motd text NOT NULL, members smallint NOT NULL default 1, name tinytext NOT NULL, tag tinytext NOT NULL, password tinytext NOT NULL, PRIMARY KEY (num)) TYPE=MyISAM;###### Table structure for table 'eras'###CREATE TABLE eras ( id tinyint unsigned NOT NULL auto_increment, name tinytext NOT NULL, peasants tinytext NOT NULL, food tinytext NOT NULL, runes tinytext NOT NULL, armtrp tinytext NOT NULL, lndtrp tinytext NOT NULL, flytrp tinytext NOT NULL, seatrp tinytext NOT NULL, wizards tinytext NOT NULL, homes tinytext NOT NULL, shops tinytext NOT NULL, industry tinytext NOT NULL, barracks tinytext NOT NULL, labs tinytext NOT NULL, farms tinytext NOT NULL, towers tinytext NOT NULL, o_armtrp tinyint unsigned NOT NULL default 0, d_armtrp tinyint unsigned NOT NULL default 0, o_lndtrp tinyint unsigned NOT NULL default 0, d_lndtrp tinyint unsigned NOT NULL default 0, o_flytrp tinyint unsigned NOT NULL default 0, d_flytrp tinyint unsigned NOT NULL default 0, o_seatrp tinyint unsigned NOT NULL default 0, d_seatrp tinyint unsigned NOT NULL default 0, PRIMARY KEY (id)) TYPE=MyISAM;###### Table structure for table 'lottery'###CREATE TABLE lottery ( num int unsigned NOT NULL default 0, ticket int unsigned NOT NULL default 0, cash bigint unsigned NOT NULL default 0, KEY num (num), KEY ticket (ticket)) TYPE=MyISAM;###### Table structure for table 'market'###CREATE TABLE market ( id int unsigned NOT NULL auto_increment, type tinytext NOT NULL, seller mediumint unsigned NOT NULL default 0, amount bigint unsigned NOT NULL default 0, price int unsigned NOT NULL default 0, time int NOT NULL default 0, PRIMARY KEY (id), KEY price (price), KEY time (time)) TYPE=MyISAM;###### Table structure for table 'messages'###CREATE TABLE messages ( id int unsigned NOT NULL auto_increment, time int NOT NULL default 0, src mediumint unsigned NOT NULL default 0, dest mediumint unsigned NOT NULL default 0, msg text NOT NULL, replied tinyint unsigned NOT NULL default 0, deleted tinyint unsigned NOT NULL default 0, PRIMARY KEY (id), KEY dest (dest), KEY time (time), KEY deleted (deleted)) TYPE=MyISAM;###### Table structure for table 'news'###CREATE TABLE news ( time int NOT NULL default 0, num_s mediumint unsigned NOT NULL default 0, clan_s smallint unsigned NOT NULL default 0, num_d mediumint unsigned NOT NULL default 0, clan_d smallint unsigned NOT NULL default 0, event smallint unsigned NOT NULL default 0, data0 bigint NOT NULL default 0, data1 bigint NOT NULL default 0, data2 bigint NOT NULL default 0, data3 bigint NOT NULL default 0, data4 bigint NOT NULL default 0, data5 bigint NOT NULL default 0, data6 bigint NOT NULL default 0, data7 bigint NOT NULL default 0, data8 bigint NOT NULL default 0, KEY time (time), KEY num_s (num_s), KEY clan_s (clan_s), KEY num_d (num_d), KEY clan_d (clan_d), KEY event (event)) TYPE=MyISAM;###### Table structure for table 'players'###CREATE TABLE players (#Account Identifiers username tinytext NOT NULL, password tinytext NOT NULL, name tinytext NOT NULL, email tinytext NOT NULL,#Account Stats IP tinytext NOT NULL, signedup int NOT NULL default 0, ismulti tinyint unsigned NOT NULL default 0, disabled tinyint unsigned NOT NULL default 0, valcode tinytext NOT NULL, validated tinyint unsigned NOT NULL default 0, online tinyint unsigned NOT NULL default 0, vacation smallint unsigned NOT NULL default 0, idle int NOT NULL default 0, free int NOT NULL default 0, style tinyint unsigned NOT NULL default 0,#Basic Empire Data empire tinytext NOT NULL, num mediumint unsigned NOT NULL auto_increment, race tinyint unsigned NOT NULL default 1, era tinyint unsigned NOT NULL default 1, rank mediumint unsigned NOT NULL default 0,#Clan Data clan smallint unsigned NOT NULL default 0, forces tinyint unsigned NOT NULL default 0, allytime int NOT NULL default 0,#Military Data attacks int unsigned NOT NULL default 0, offsucc int unsigned NOT NULL default 0, offtotal int unsigned NOT NULL default 0, defsucc int unsigned NOT NULL default 0, deftotal int unsigned NOT NULL default 0, kills int unsigned NOT NULL default 0,#Turns Data turns int unsigned NOT NULL default 0, turnsstored int unsigned NOT NULL default 0, turnsused int unsigned NOT NULL default 0,#Basic Stats networth bigint unsigned NOT NULL default 0, cash bigint unsigned NOT NULL default 100000, food bigint unsigned NOT NULL default 10000, peasants int unsigned NOT NULL default 500,#Army Data armtrp bigint unsigned NOT NULL default 100, lndtrp bigint unsigned NOT NULL default 15, flytrp bigint unsigned NOT NULL default 10, seatrp bigint unsigned NOT NULL default 0, health tinyint unsigned NOT NULL default 100,#Magic Data wizards int unsigned NOT NULL default 0, runes int unsigned NOT NULL default 500, shield int NOT NULL default 0, gate int NOT NULL default 0,#Industry Percentages ind_armtrp tinyint unsigned NOT NULL default 25, ind_lndtrp tinyint unsigned NOT NULL default 25, ind_flytrp tinyint unsigned NOT NULL default 25, ind_seatrp tinyint unsigned NOT NULL default 25,#Land Data land int unsigned NOT NULL default 250, shops int unsigned NOT NULL default 5, homes int unsigned NOT NULL default 20, industry int unsigned NOT NULL default 0, barracks int unsigned NOT NULL default 5, labs int unsigned NOT NULL default 0, farms int unsigned NOT NULL default 15, towers int unsigned NOT NULL default 0, freeland int unsigned NOT NULL default 205,#Financial Data tax tinyint unsigned NOT NULL default 10, savings bigint unsigned NOT NULL default 0, loan bigint unsigned NOT NULL default 0,#Private Market Data pmkt_armtrp bigint unsigned NOT NULL default 5000, pmkt_lndtrp bigint unsigned NOT NULL default 5000, pmkt_flytrp bigint unsigned NOT NULL default 5000, pmkt_seatrp bigint unsigned NOT NULL default 5000, pmkt_food bigint unsigned NOT NULL default 100000, bmperarmtrp smallint unsigned NOT NULL default 0, bmperlndtrp smallint unsigned NOT NULL default 0, bmperflytrp smallint unsigned NOT NULL default 0, bmperseatrp smallint unsigned NOT NULL default 0,#Misc Data aidcred tinyint unsigned NOT NULL default 5, msgcred tinyint unsigned NOT NULL default 5, msgtime int NOT NULL default 0, newstime int NOT NULL default 0, PRIMARY KEY (num), KEY networth (networth), KEY rank (rank)) TYPE=MyISAM;###### Table structure for table 'races'###CREATE TABLE races ( id tinyint unsigned NOT NULL auto_increment, name tinytext NOT NULL, offense float(5,3) NOT NULL default 1.000, defense float(5,3) NOT NULL default 1.000, bpt float(5,3) NOT NULL default 1.000, costs float(5,3) NOT NULL default 1.000, magic float(5,3) NOT NULL default 1.000, ind float(5,3) NOT NULL default 1.000, pci float(5,3) NOT NULL default 1.000, expl float(5,3) NOT NULL default 1.000, mkt float(5,3) NOT NULL default 1.000, food float(5,3) NOT NULL default 1.000, runes float(5,3) NOT NULL default 1.000, farms float(5,3) NOT NULL default 1.000, PRIMARY KEY (id)) TYPE=MyISAM;###### Predefined lottery entries, MUST be present!###INSERT INTO lottery ( num, ticket, cash ) VALUES ( 0 , 0 , 100000000), # current JP ( 0 , 1 , 100000000), # last JP ( 0 , 2 , 0 ), # last num ( 0 , 3 , 0 ), # last winner ( 0 , 4 , 0 ); # amount JP grew (if no winner)###### Races are defined here.###INSERT INTO races ( name , offense, defense, bpt , costs, magic, ind , pci , expl , mkt , food , runes, farms) VALUES ('Human' , 1.000 , 1.000 , 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000, 1.000), ('Elf' , 0.860 , 0.980 , 0.900, 1.000, 1.180, 0.880, 1.020, 1.120, 1.000, 1.000, 1.120, 0.940), ('Dwarf' , 1.060 , 1.160 , 1.160, 1.080, 0.840, 1.120, 1.000, 0.820, 1.080, 1.000, 1.000, 1.000), ('Troll' , 1.240 , 0.900 , 1.080, 1.000, 0.880, 1.000, 1.040, 1.140, 1.120, 1.000, 0.920, 0.920), ('Gnome' , 0.840 , 1.100 , 1.000, 0.940, 1.000, 0.900, 1.100, 0.880, 0.760, 1.000, 0.880, 1.000), ('Gremlin', 1.100 , 0.940 , 1.000, 1.000, 0.900, 0.860, 0.800, 1.000, 0.920, 0.860, 1.000, 1.180), ('Orc' , 1.160 , 1.000 , 1.040, 1.140, 0.960, 1.080, 1.000, 1.220, 1.000, 1.100, 0.860, 0.920), ('Drow' , 1.140 , 1.060 , 0.880, 1.100, 1.180, 1.000, 1.000, 0.840, 1.000, 1.000, 1.060, 0.940), ('Goblin' , 0.820 , 0.840 , 1.000, 0.820, 1.000, 1.140, 1.000, 1.000, 1.060, 0.920, 1.000, 1.000);###### Eras are defined here, MUST BE IN CHRONOLOGICAL ORDER!###INSERT INTO eras ( name , peasants , food , runes , armtrp , lndtrp , flytrp , seatrp , wizards , homes , shops , industry , barracks , labs , farms , towers , o_armtrp, d_armtrp, o_lndtrp, d_lndtrp, o_flytrp, d_flytrp, o_seatrp, d_seatrp) VALUES ('Past' ,'Peasants' ,'Grains' ,'Mana' ,'Footmen' ,'Catapults' ,'Zeppelins' ,'Galleons' ,'Wizards' ,'Huts' ,'Markets' ,'Blacksmiths','Keeps' ,'Mage Towers' ,'Farms' ,'Guard Towers' , 1 , 2 , 3 , 2 , 7 , 5 , 7 , 6 ), ('Present','Civilians','Nutrients','Energy' ,'Infantry','Tanks' ,'Jets' ,'Battleships' ,'Telepaths' ,'Apartments','Business Centers','Factories' ,'Bases' ,'PSI Centers' ,'Plantations' ,'Bunkers' , 2 , 1 , 2 , 6 , 5 , 3 , 6 , 8 ), ('Future' ,'Drones' ,'Batteries','Bandwidth','Cyborgs' ,'Juggernauts','Hovercrafts','Dreadnoughts','Master AIs','Giliads' ,'E-Commerce Sites','Replicators','Storage Bays','Supercomputers','Power Plants','Laser Turrets', 1 , 2 , 5 , 2 , 6 , 3 , 7 , 7 ); As of now when i try to log in it gives this error.Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/www/cbc1219.awardspace.com/funcs.php on line 41Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/www/cbc1219.awardspace.com/funcs.php on line 41Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/www/cbc1219.awardspace.com/funcs.php on line 41Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/www/cbc1219.awardspace.com/funcs.php on line 82FATAL ERROR: Failed to update player data networth=0,username='test',password='b0baee9d279d34fa1dfd71aadb908c3f',name='chris cohan',email='cohan1279@yahoo.com',IP='71.154.1.129',signedup=1153253898,disabled=0,valcode='80b002265d031e3ea50ee0dccb000a18',idle=1153253898,empire='testing',race='',era=1,rank='',turns=100,msgtime=1153253898,newstime=1153253898 for user #!Welcome to Promisance, testing (#)!Please Login and manage your new empire!I beleive this error is due to me not finishing the install (not knowing how to edit prom.sql or createing the table $ mysql -uusername -p[password] databasename <prom.sql ) and not a problem with funcs.phpIf anyone could please tell me how to create the sql table and edit prom.sql as in install instuctions #4 and #5 i would be very happy! Quote Link to comment https://forums.phpfreaks.com/topic/14972-complete-noob-help-please/ Share on other sites More sharing options...
fenway Posted July 18, 2006 Share Posted July 18, 2006 Yikes... this is definitely not the right place for this type of question. From the errors, it looks like there are errors in the php code, or the DB setup... but that's a question for whomever supplied you with the code. Quote Link to comment https://forums.phpfreaks.com/topic/14972-complete-noob-help-please/#findComment-60149 Share on other sites More sharing options...
cohan1279 Posted July 18, 2006 Author Share Posted July 18, 2006 well getting help from the author is the problem... there doesnt seem to be any support for it anymore (not in a few years) i really just need to know how to create the sql table. somebodys got to know how i need to do that. Quote Link to comment https://forums.phpfreaks.com/topic/14972-complete-noob-help-please/#findComment-60174 Share on other sites More sharing options...
fenway Posted July 18, 2006 Share Posted July 18, 2006 Well, I ran the SQL statements on 4.1.13a, and there were no errors, so this is now a PHP problem only. Quote Link to comment https://forums.phpfreaks.com/topic/14972-complete-noob-help-please/#findComment-60214 Share on other sites More sharing options...
cohan1279 Posted July 18, 2006 Author Share Posted July 18, 2006 ok thanks. mybe I can get this figured out. Quote Link to comment https://forums.phpfreaks.com/topic/14972-complete-noob-help-please/#findComment-60228 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.