<?php
/*
 * @author Balaji
 */
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>";
  }
  
  $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>";


$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);
?>