OmnomIRC installer
"; echo ''; break; case 1://I am bender, please insert data echo 'I need a few pieces of information from you to set up OmnomIRC.
'; if (isset($_SESSION['error'])) { echo ($_SESSION['error']); unset($_SESSION['error']); } echo 'SQL Info:




'; echo '
'; echo ''; break; case 2://Confirmation if ($_POST['server']=="") $_SESSION['error'] = 'Please enter a server
'; if ($_POST['database']=="") $_SESSION['error'] = $_SESSION['error'] . 'Please enter a database
'; if ($_POST['username']=="") $_SESSION['error'] = $_SESSION['error'] . 'Please enter a username
'; if ($_POST['password']=="") $_SESSION['error'] = $_SESSION['error'] . 'Please enter a password
'; if ($_POST['hostname']=="") $_SESSION['error'] = $_SESSION['error'] . 'Please enter a hostname
'; $_SESSION['server'] = $_POST['server']; $_SESSION['database'] = $_POST['database']; $_SESSION['username'] = $_POST['username']; $_SESSION['password'] = $_POST['password']; $_SESSION['hostname'] = $_POST['hostname']; if (isset($_SESSION['error'])) { $_SESSION['stage'] = 0; echo ''; break; } $sql_connection=mysql_connect($_POST['server'],$_POST['username'],$_POST['password']); if (!$sql_connection) $_SESSION['error'] = $_SESSION['error'] . 'Could not connect to server. Please check your input again.
'; if (isset($_SESSION['error'])) { $_SESSION['stage'] = 0; echo ''; } if (mysql_select_db($_POST['database'],$sql_connection)) echo 'WARNING
Database ' . $_POST['database'] . ' already exists! If you continue, all data in it will be lost!
Click back to enter a new database name

'; echo 'Your data checks out! Hit next to install.'; echo '
'; echo ''; break; case 3://Success $randKey = rand(100,9999).'-'.Rand(10000,999999); $randKey = md5($randKey); $randKey = base64_encode($randKey); $randKey = md5($randKey); $config = ''; if (file_put_contents("config.php",$config)) echo "Config written
"; else echo "I could not write to the config file. Please check permissions and try again.
"; $jsconfig = 'HOSTNAME="'.$_SESSION['hostname'].'";'; if (file_put_contents("config.js",$jsconfig)) echo "JS Config written
"; else echo "Could not write JS config. Please check permissions and try again.
"; $sql_connection=mysql_connect($_SESSION['server'],$_SESSION['username'],$_SESSION['password']); if (!mysql_query("DROP DATABASE IF EXISTS " . $_SESSION['database'],$sql_connection)) echo "I could not drop the database. Do you have permission?
"; if (!mysql_query("CREATE DATABASE " . $_SESSION['database'],$sql_connection)) echo "I could not drop the database. Do you have permission?
"; if (!mysql_select_db($_SESSION['database'],$sql_connection)) echo "I could not select the database. Did it create properly?
"; $sql = file("dbinfo.sql"); foreach ($sql as $line) if (!mysql_query($line,$sql_connection)) echo "I could not import the data. Has anything else failed?
"; echo "Finished!
For security purposes, it is highly reccomended that you now delete the install.php file out of the folder when done."; break; default://wat $_SESSION['stage']=-1; echo "Something went wrong. Please try again."; break; } ?>