Make PHP Installer
Last Update:2018-07-26
Source: Internet
Author: User
First create two PHP files one is install.php the other is config.php which config.php is empty file
install.php contents are as follows: <! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd "> <body> <?php $files = "config.php"; if (!is_writable ($files)) // is_writable () Check whether the file is writable to determine file permissions { echo " Not writable "; }else{ echo "writable" } if (isset ($_post[' Install ')) { $conf Ig_str= "<?php"; $config _str.= "\ n"; $config _str.= ' $mysql _host = '. $_post[localhost]. '; $config _str.= "\ n"; $config _str.= ' $mysql _user = '. $_post[username]. '; $config _str.= "\ n"; $config _str.= ' $mysql _pass = '. $_post[password]. '; $config _str.= "\ n"; $config _str.= ' $mysql _dbname = '. $_post[mysql_db]. '; $config _str.= "\ n"; $config _str.= ' $mysql _table = '. $_post[table]. '; $config _str.= "\ n"; $config _str.= "?>"; $ff =fopen ($files, "w+"); //File operation open a file or create a new fwrite ($FF, $confIG_STR); // file operations write content to file include_once ("config.php"); if (!@ $link =mysql_connect ($mysql _host, $mysql _user, $mysql _pass)) //Determine if the connection database is successful { echo failed to connect to the database. Previous page <a href=install.php> </a> "; }else{ mysql_query ("CREATE database ' $mysql _dbname '"); // Creating Databases mysql_select_db ($mysql _dbname); $sql _query[]= "CREATE TABLE ' $mysql _dbname '". $mysql _table. " QQQ ' ( ' id ' INT (Ten) not NULL auto_increment, &nbs P ' AAA ' VARCHAR (MB) not NULL, ' xxx ' VARCHAR (MB) not NULL, &NBSP ; PRIMARY KEY ( ' id ') ENGINE = INNODB"; $sql _query[]= "CREATE TABLE ' $mysql _dbname '". $mysql _table. " SSSs ' ( ' id ' INT (Ten) not NULL auto_increment, &NB Sp ' AAA ' VARCHAR (MB) not NULL, ' xxx ' VARCHAR (MB) not NULL, &NBSP ; PRIMARY KEY ( ' id ') ENGINE = INNODB "; // This can be directly from their own phpmyadmin inside production in advance foreach ($sql _query as $val) {mysql_query ($val);} echo "Success"; rename ("install.php", "Install.lock"); //File Rename the file or delete the install.php configuration file at this time to improve security } }
?>