Jump to content

Recommended Posts

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>

 

Link to comment
https://forums.phpfreaks.com/topic/200689-trying-to-install-game/
Share on other sites

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.