Post by Llama! on Sept 9, 2005 15:46:06 GMT
Hello!
In this tutorial we will make in install (with more files). Later I will make a tut where you learn it with the $_GET function for 1 file installer.
Now create index.php with the following text:
As you can see it links to install1.php, so create that:
Create install2.php now, the part where we insert the first data.
Now we add a last message, create install3.php:
Now edit all (2 in total) database connections and upload.
Hope you understand if not just shout
In this tutorial we will make in install (with more files). Later I will make a tut where you learn it with the $_GET function for 1 file installer.
Now create index.php with the following text:
Welcome to my installer!
<br><br>
<a href="install1.php">Click here to start the installation.</a>
As you can see it links to install1.php, so create that:
<?php
$con = mysql_connect("localhost", "user", "pass");
mysql_select_db("db_naam", $con);
mysql_query("CREATE TABLE users (
id int(11) NOT NULL auto_increment primary key,
name varchar(20) NOT NULL
);"); //create the table "users" with the fields ID and NAME
echo "The table <i>users</i> has been created!
<br><br>
<a href=\"install2.php\">Click here to continue.</a>";
?>
Create install2.php now, the part where we insert the first data.
<?php
$con = mysql_connect("localhost", "user", "pass");
mysql_select_db("db_naam", $con);
echo "Fill in the following form:
<br>
<form action=\"".$_SERVER['PHP_SELF']."\" method=\"POST\">
Name: <input type=\"text\" name=\"name\">
<br>
<input type=\"submit\" name=\"submit\" value=\"Submit\">";
if($_POST["submit"])
{
if(empty($_POST["name"]))
{
echo "Please go back, the name was empty.";
}else{
mysql_query("INSERT INTO users ('name') VALUES('".$_POST['name']."')"); //ads the name + id wich goes automaticly because we did auto_increment
echo "The user ".$_POST['name']." was added to the table <i>users</i>.
<br><br>
<a href=\"install3.php\">Click here to continue to the last step!</a>";
}
}
?>
Now we add a last message, create install3.php:
Thanks for using our script! This was made with the tut of mikeo!<br>
<b>Delete all install files now or people can make new admin accounts!</b>
Now edit all (2 in total) database connections and upload.
Hope you understand if not just shout