View file install.php

File size: 4.41Kb
<?php
error_reporting(0);
echo '<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="shortcut icon" href="/favicon.ico" />
<title>'.$headtitle.'</title>
<link rel="stylesheet" type="text/css" href="/style.css" />
</head><body><div class="logo" align="center"><a href="/"><img src="/web/logo.png" alt="logo"/></a></div>';

echo '<div class="ad" align="center">For Any Help Please Contact <b>prben10@gmail.com</b> or <b>fb.com/pranto007</b></div>';
echo '<div class="title">Install Script</div>';

if(!$_GET['step']){

//STEP 1 Start

if(isset($_POST['db_server']) AND isset($_POST['db_user']) AND isset($_POST['db_pass']) AND isset($_POST['db_name']) AND isset($_POST['sitename'])){

 $sitename=$_POST['sitename'];
 $db_server=$_POST['db_server'];
 $db_user=$_POST['db_user'];
 $db_pass=$_POST['db_pass'];
 $db_name=$_POST['db_name'];


 

$filename = 'localhost.sql';

$mysql_host = $db_server;
// MySQL username
$mysql_username = $db_user;
// MySQL password
$mysql_password = $db_pass;
// Database name
$mysql_database = $db_name;

// Connect to MySQL server
mysql_connect($mysql_host, $mysql_username, $mysql_password) or die('Error connecting to MySQL server: ' . mysql_error());
// Select database
mysql_select_db($mysql_database) or die('Error selecting MySQL database: ' . mysql_error());

// Temporary variable, used to store current query
$templine = '';
// Read in entire file
$lines = file($filename);
// Loop through each line
foreach ($lines as $line)
{
// Skip it if it's a comment
if (substr($line, 0, 2) == '--' || $line == '')
    continue;

// Add this line to the current segment
$templine .= $line;
// If it has a semicolon at the end, it's the end of the query
if (substr(trim($line), -1, 1) == ';')
{
    // Perform the query
    $do=mysql_query($templine);    
    $templine = '';
}
}

if($do){
 file_put_contents('sitename.txt',$sitename);
 $dataindb='<?php

/************************************

Script : Adnetwork
Website : http://facebook.com/pranto007

Script is created and provided by Pranto (http://facebook.com/pranto007)
**************************************/

$dbcon=mysql_connect(\''.$db_server.'\',\''.$db_user.'\',\''.$db_pass.'\');
$dbselect=mysql_select_db(\''.$db_name.'\',$dbcon);

if(!$dbcon OR !$dbselect){
 echo \'Database connection failed!\';
exit;
}

?>';
 file_put_contents('db.php',$dataindb);
 header('Location:install.php?step=2');
}
else {
 echo '<div class="error">Error in Installation!</div>';
}
}

echo '<div class="form"><form method="post">Sitename:<br/><input type="text" name="sitename"/><br/>MySql Host:<br/><input type="text" name="db_server" value="localhost"/><br/>MySql User:<br/><input type="text" name="db_user"/><br/>MySql User Password:<br/><input type="text" name="db_pass"/><br/>Database Name:<br/><input type="text" name="db_name"/><br/><input type="submit" value="Next"/></form></div>';

//Step 1 End

}
elseif($_GET['step']==2){

echo '<div class="ad">Admin Settings</div>';

//Step 2 Start

if(isset($_POST['admin_name']) AND isset($_POST['admin_pass']) AND isset($_POST['admin_email'])){

 $admin_name=$_POST['admin_name'];
 $admin_pass=$_POST['admin_pass'];
 $admin_email=$_POST['admin_email'];
 $admin_file='admin/admins/'.$admin_name.'-data.pra';
 $ins_admin=file_put_contents($admin_file,"$admin_name|-pr-|$admin_email|-pr-|$admin_pass|-pr-|");
 if($ins_admin){
  file_put_contents('admin/admins/main-admin.pran',$admin_name);
  header('Location:install.php?step=3');
 }
 else {
  echo '<div class="error">Error Creating Admin!</div>';
 }
 }
 
 echo '<div class="form"><form method="post">Admin Name:<br/><input type="text" name="admin_name"/><br/>Admin Password:<br/><input type="text" name="admin_pass"/><br/>Admin Email:<br/><input type="text" name="admin_email"/><br/><input type="submit" value="Next"/></form></div>';

 //END Step 2

}
elseif($_GET['step']==3){
 
 //Start Step 3



echo '<div class="title">Installation Finished!</div>';
echo '<div class="form">Installation Finished! <b>Please Go to folder country in script directory and input database details in import.php or country tracking will not work!<br/><br/><b>Admin Panel:</b> http://'.$_SERVER["HTTP_HOST"].'/admin<br/><b>Main Site:</b> '.$_SERVER["HTTP_HOST"].'<br/><br/></div>';

  unlink('localhost.sql');
  unlink('install.php');


//end step 3
}

echo '<div class="foot">Adnetwork Script installer by Pranto</div></body></html>';

?>