<?php
/*
 * @author Balaji
 * @name: Turbo SEO Analyzer PHP Script
 * @copyright © 2014 ProThemes.Biz
 *
 */

error_reporting(1);
require_once("config.php");

$admin_user = htmlentities(Trim($_POST['admin_user']));
$admin_pass = Md5(htmlentities(Trim($_POST['admin_pass'])));

$con = mysqli_connect($mysql_host,$mysql_user,$mysql_pass,$mysql_database);

  if (mysqli_connect_errno())
  {
  echo "Failed to connect:". mysqli_connect_error()."<br>";
  }

$sql = "CREATE TABLE admin 
(
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY(id),
user VARCHAR(250),
pass VARCHAR(250)
)";
    // Execute query
    if (mysqli_query($con,$sql)) {
    echo "Admin Table created successfully <br>";
    } else {
    echo "Error creating table: " . mysqli_error($con)."<br>";
     }
     
    $query = "INSERT INTO admin (user,pass) VALUES ('$admin_user','$admin_pass')"; 
    mysqli_query($con,$query);
    
$sql = "CREATE TABLE admin_history 
(
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY(id),
last_date VARCHAR(255),
ip VARCHAR(255)
)";
    // Execute query
    if (mysqli_query($con,$sql)) {
    echo "Admin History Table created successfully <br>";
    } else {
    echo "Error creating table: " . mysqli_error($con)."<br>";
     }
   $query = "INSERT INTO admin_history (last_date,ip) VALUES ('14th June 2014','23.54.2.43')"; 
   mysqli_query($con,$query);
   $query = "INSERT INTO admin_history (last_date,ip) VALUES ('14th June 2014','26.32.34.33')"; 
   mysqli_query($con,$query);
   $query = "INSERT INTO admin_history (last_date,ip) VALUES ('15th June 2014','31.7.42.03')"; 
   mysqli_query($con,$query);
   
   
   $sql = "CREATE TABLE page_view 
(
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY(id),
date VARCHAR(255),
tpage VARCHAR(255),
tvisit VARCHAR(255)
)";
    // Execute query
    if (mysqli_query($con,$sql)) {
    echo "Page view Table created successfully <br>";
    } else {
    echo "Error creating table: " . mysqli_error($con)."<br>";
     }
     
        $query = "INSERT INTO page_view(date,tpage,tvisit) VALUES ('14th June 2014','9','1')"; 
         mysqli_query($con,$query);
        $query = "INSERT INTO page_view(date,tpage,tvisit) VALUES ('15th June 2014','14','1')"; 
         mysqli_query($con,$query);


   
   $sql = "CREATE TABLE ads 
(
id INT(255),
text_ads mediumtext,
ads_1 mediumtext,
ads_2 mediumtext
)";
    // Execute query
    if (mysqli_query($con,$sql)) {
    echo "Ads Table created successfully <br>";
    } else {
    echo "Error creating table: " . mysqli_error($con)."<br>";
     }
     
     $query = "INSERT INTO ads (id,text_ads,ads_1,ads_2) VALUES ('1','<br />
Try Pro IP locator Script Today! CLICK HERE <br /><br />

Get 20,000 Unique Traffic for $5 [Limited Time Offer] - Buy Now! CLICK HERE<br /><br />

Custom OpenVPN GUI - Get Now for $15 ! CLICK HERE<br />','<center>
 <div >
<img class=\"imageres\" src=\"img/ad700.png\">
</div>  <br /> <br /> </center> ','<center>
 <div >
<img class=\"imageres\" src=\"img/ad700.png\">
</div>  <br /> <br /> </center>')"; 
     mysqli_query($con,$query);
     
     
   $sql = "CREATE TABLE site_info 
(
id INT(255),
title VARCHAR(255),
des mediumtext,
keyword mediumtext,
site_name VARCHAR(255),
email VARCHAR(255),
twit VARCHAR(4000),
face VARCHAR(4000),
gplus VARCHAR(4000),
ex_1 mediumtext,
ex_2 mediumtext,
ps_1 mediumtext,
ps_2 mediumtext,
ps_3 mediumtext,
ga VARCHAR(255)
)";
    // Execute query
    if (mysqli_query($con,$sql)) {
    echo "Site Info Table created successfully <br>";
    } else {
    echo "Error creating table: " . mysqli_error($con)."<br>";
     }
     
     $query = "INSERT INTO site_info (id,title,des,keyword,site_name,email,twit,face,gplus,ex_1,ex_2,ps_1,ps_2,ps_3,ga) VALUES ('0','Turbo SEO Analyzer - All-in-one SEO Tool','Analyze your web pages with our Turbo SEO Analyzer and Build SEO reports as PDF.','seo,analyzer,woorank,alexa,google','Turbo SEO Analyzer','admin@prothemes.biz','https://twitter.com/','https://www.facebook.com/','https://plus.google.com/','Google.com','ProThemes.biz','google.com','prothemes.biz','codecanyon.net','UA-')"; 
     mysqli_query($con,$query);


   $sql = "CREATE TABLE lang 
(
id INT(255),
type VARCHAR(255)
)";
    // Execute query
    if (mysqli_query($con,$sql)) {
    echo "Language Table created successfully <br>";
    } else {
    echo "Error creating table: " . mysqli_error($con)."<br>";
     }
     
     $query = "INSERT INTO lang (id,type) VALUES ('0','en.php')"; 
     mysqli_query($con,$query);
     
   $sql = "CREATE TABLE ban_user 
(
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY(id),
ip VARCHAR(255),
last_date VARCHAR(255)
)";
    // Execute query
    if (mysqli_query($con,$sql)) {
    echo "Ban User Table created successfully <br>";
    } else {
    echo "Error creating table: " . mysqli_error($con)."<br>";
     }
     
     $query = "INSERT INTO ban_user (id,ip,last_date) VALUES ('1','2.2.2.2','17th June 2014')"; 
     mysqli_query($con,$query);
     
      $sql = "CREATE TABLE ban_site 
(
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY(id),
site VARCHAR(255),
last_date VARCHAR(255)
)";
    // Execute query
    if (mysqli_query($con,$sql)) {
    echo "Ban Site Table created successfully <br>";
    } else {
    echo "Error creating table: " . mysqli_error($con)."<br>";
     }
     
     $query = "INSERT INTO ban_site (id,site,last_date) VALUES ('1','example.com','17th June 2014')"; 
     mysqli_query($con,$query);
     $query = "INSERT INTO ban_site (id,site,last_date) VALUES ('2','prothemes.biz','17th June 2014')"; 
     mysqli_query($con,$query);
     
     
           $sql = "CREATE TABLE pages 
(
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY(id),
last_date VARCHAR(255),
page_name VARCHAR(255),
page_title mediumtext,
page_content text
)";
    // Execute query
    if (mysqli_query($con,$sql)) {
    echo "Pages Table created successfully <br>";
    } else {
    echo "Error creating table: " . mysqli_error($con)."<br>";
     }
     
     $query = "INSERT INTO pages (id,last_date,page_name,page_title,page_content) VALUES ('1','17th June 2014','About','About US','<p><strong>Nothing to say</strong></p><br><br><br><br><br><br><br><br><br><br>')"; 
     mysqli_query($con,$query);
    
               
   $sql = "CREATE TABLE sitemap 
(
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY(id),
site text,
des text,
date VARCHAR(255)
)";
    // Execute query
    if (mysqli_query($con,$sql)) {
    echo "Sitemap Table created successfully <br> <br>";
    } else {
    echo "Error creating table: " . mysqli_error($con)."<br>";
     }
   
    $query = "INSERT INTO sitemap(site,des,date) VALUES ('prothemes.biz','This web site has Google PageRank 0 out of 10 maxmium and is not listed in DMOZ. The age of prothemes.biz is 0 years, 281 days. Overall site looking Good. According to the Alexa.com, this site has 287713 rank in the world wide web. Low Alexa rank indicates that the site is visited by a lot of visitors and most popular in the Internet.','2014-08-04')"; 
  mysqli_query($con,$query);   
    $query = "INSERT INTO sitemap(site,des,date) VALUES ('google.com','This web site has Google PageRank 9 out of 10 maxmium and is listed in DMOZ. The age of prothemes.biz is 16 years, 323 days. Overall site looking Good. According to the Alexa.com, this site has 1 rank in the world wide web. Low Alexa rank indicates that the site is visited by a lot of visitors and most popular in the Internet.','2014-08-04')"; 
  mysqli_query($con,$query);  
  
     $sql = "CREATE TABLE sitemap_options 
(
id INT(255),
priority VARCHAR(255),
changefreq VARCHAR(255)
)";
    // Execute query
    if (mysqli_query($con,$sql)) {
    echo "Sitemap Options Table created successfully <br>";
    } else {
    echo "Error creating table: " . mysqli_error($con)."<br>";
     }
     
     $query = "INSERT INTO sitemap_options (id,priority,changefreq) VALUES ('1','0.9','weekly')"; 
     mysqli_query($con,$query);
           
   $sql = "CREATE TABLE user_history 
(
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY(id),
last_date VARCHAR(255),
ip VARCHAR(255),
site VARCHAR(255)
)";
    // Execute query
    if (mysqli_query($con,$sql)) {
    echo "User History Table created successfully <br> <br>";
    } else {
    echo "Error creating table: " . mysqli_error($con)."<br>";
     }
   
    $query = "INSERT INTO user_history(last_date,ip,site) VALUES ('14th June 2014','23.54.72.77','prothemes.biz')"; 
  mysqli_query($con,$query);   
    $query = "INSERT INTO user_history(last_date,ip,site) VALUES ('14th June 2014','23.54.72.77','bluepay.com')"; 
  mysqli_query($con,$query);   
    $query = "INSERT INTO user_history(last_date,ip,site) VALUES ('14th June 2014','23.54.72.77','codecanyon.net')"; 
  mysqli_query($con,$query);   
    $query = "INSERT INTO user_history(last_date,ip,site) VALUES ('14th June 2014','23.54.72.77','mobikwik.com')"; 
  mysqli_query($con,$query);  
      $query = "INSERT INTO user_history(last_date,ip,site) VALUES ('14th June 2014','23.54.72.77','interserver.net')"; 
  mysqli_query($con,$query);  
      $query = "INSERT INTO user_history(last_date,ip,site) VALUES ('14th June 2014','23.54.72.77','stackoverflow.com')"; 
  mysqli_query($con,$query);  
    $query = "INSERT INTO user_history(last_date,ip,site) VALUES ('14th June 2014','23.54.72.77','google.com')"; 
  mysqli_query($con,$query);  
  
  $c_date = date('Y-m-d');
    $data = '<?xml version="1.0" encoding="UTF-8"?>
        <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    <url>
        <loc>http://'.$_SERVER['SERVER_NAME'].'/</loc>
        <priority>1.0</priority>
        <changefreq>daily</changefreq>
        <lastmod>'.$c_date.'</lastmod>
</url>
</urlset>';
file_put_contents("sitemap.xml",$data);
    echo "Sitemap file created successfully <br> <br>";

  unlink('install.php');
  unlink('process.php');
  unlink('finish.php');
  
  echo 'Installation Complete! <br> <br>';  
?>
  <a href="index.php" class="btn btn-info" >Index Page</a>   <a href="login.php" class="btn btn-info">Admin Panel</a>
