mlovell Posted May 4, 2010 Share Posted May 4, 2010 When i try to install my game it shows the boxes to put my database name, etc. in but when i fill it out and press finish setup it just shows the same page with blank boxes and doesnt actually install the game this is my install.php code <?php include("inc.functions.php"); ?> <link rel=stylesheet href=style.css> <body> <center> <?php $fname = "inc.config.php"; //make sure file is writable if not chmod it do_chmod($fname); ?> <?php if($write){ //write configuration if($_POST["dbname"] && $_POST["dbhost"] && $_POST["dbuser"] && $_POST["dbpass"]){ $file_pointer = fopen($fname, "w"); fwrite($file_pointer,"<? \$dbname=\"" . $_POST["dbname"] . "\"; \$dbhost=\"" . $_POST["dbhost"] . "\"; \$dbuser=\"" . $_POST["dbuser"] . "\"; \$dbpass=\"" . $_POST["dbpass"] . "\"; ?>"); fclose($file_pointer); }else{ echo "Fill all fields of the form"; } //create database if not existant require("inc.config.php"); $link = mysql_connect($dbhost,$dbuser,$dbpass); $dbsel = mysql_select_db("$dbname",$link); if($dbsel != "1"){ mysql_create_db ("$dbname") or die ("Could not create database"); } mysql_select_db("$dbname",$link) or die ("Could not select database"); //insert tables $filename = 'phpfootball.sql'; do_import($filename); //create admin if($_POST["suiteuser"] && $_POST["suitepass"]){ $suitepass = md5($suitepass); $query = "INSERT INTO Accounts (Username,Password,Userlevel) VALUES ('$suiteuser','$suitepass','admin')"; $result = mysql_query($query) or die ("died while inserting to table<br>Debug info: $query"); }else{ echo "Fill all fields of the form"; } //messages echo "<b>Setup complete<br>Delete this file now<br></b>"; echo "<form action=index.php method=POST><input type=submit class=button name=submit value=\"Proceed to main index and login\"></form>"; } ?> <?php if (!$write){echo " <form name=form method=post action=\"{$_SERVER['PHP_SELF']}?write=1\"> <table width=50% cellpadding=0 cellspacing=1 bordercolorlight=#666666 bordercolordark=#CCCCCC> <tr><td colspan=2 class=tdark><center>PHP Football Instalation Script</center></td></tr> <tr><td colspan=2 class=tddd> </td></tr> <tr><td class=tddd>Database Name</td><td class=td><center><input size=56% type=text name=dbname class=input ></center></td></tr> <tr><td class=tddd>Database Hostname</td><td class=td><center><input size=56% type=text name=dbhost class=input ></center></td></tr> <tr><td colspan=2 class=tddd> </td></tr> <tr><td class=tddd>Database User</td><td class=td><center><input size=56% type=text name=dbuser class=input ></center></td></tr> <tr><td class=tddd>Database Password</td><td class=td><center><input size=56% type=text name=dbpass class=input ></center></td></tr> <tr><td colspan=2 class=tddd> </td></tr> <tr><td class=tddd>Admin Username</td><td class=td><center><input size=56% type=text name=suiteuser class=input ></center></td></tr> <tr><td class=tddd>Admin Password</td><td class=td><center><input size=56% type=text name=suitepass class=input ></center></td></tr> <tr><td colspan=2><br><center><input type=submit value=\"Finish Setup\" class=submit></center></td></tr> </table></form> ";} ?> </center> Quote Link to comment Share on other sites More sharing options...
Muddy_Funster Posted May 4, 2010 Share Posted May 4, 2010 change you bottom if statement to if(!isset($_GET['write']) and see how it goes Quote Link to comment Share on other sites More sharing options...
mlovell Posted May 4, 2010 Author Share Posted May 4, 2010 Parse error: syntax error, unexpected '{' in /home/a2527473/public_html/install.php on line 58 Quote Link to comment Share on other sites More sharing options...
mlovell Posted May 4, 2010 Author Share Posted May 4, 2010 anyone have any idea? starting to bug me now Quote Link to comment Share on other sites More sharing options...
Muddy_Funster Posted May 5, 2010 Share Posted May 5, 2010 your line 58 : <form name=form method=post action=\"{$_SERVER['PHP_SELF']}?write=1\"> has double quotes in it that are not escaping the way you intend. Change it to this: <form name=form method=post action=".$_SERVER['PHP_SELF']."?write=1\"> and let me know how that does. Quote Link to comment Share on other sites More sharing options...
mlovell Posted May 5, 2010 Author Share Posted May 5, 2010 did nothing when the install page comes up it tells me to put the details in when i press finish setup at the bottom it takes me back onto the same page again 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.