View file install.php

File size: 10.39Kb
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css" media="all,handheld">
</head>
<body bgcolor="black" text="lightgrey">
<div style="max-width: 800px; margin: auto">
<?php
/********************************
* Mobile Blog v3.2 beta Script  *
* Fully modified by er.o        *
* http://errorisme.com          *
* Copyright (c) 2010            *
* Original Script created by    *
* Huteri Manza                  *
* http://huteri.net             *
********************************/
require("config.php");
if(isset($_POST["submit"]))
{
$_POST["name"]=trim($_POST["name"]);
$_POST["password"]=trim($_POST["password"]);
$_POST["repassword"]=trim($_POST["repassword"]);
$_POST["blog_name"]=trim($_POST["blog_name"]);
$_POST["blog_url"]=trim($_POST["blog_url"]);
$_POST["blog_dir"]=trim($_POST["blog_dir"]);
if($_POST["blog_dir"]!='/') $_POST["blog_dir"]=$_POST["blog_dir"].'/';
if(empty($_POST["name"]) || empty($_POST["password"]) || empty($_POST["repassword"]) || empty($_POST["blog_name"]) || empty($_POST["blog_url"]))
die("<title>Installation Failed</title>Data not complete<br><a href=install.php>back</a>");
if($_POST["password"]!=$_POST["repassword"])
die("<title>Installation Failed</title>Password mismatch<br><a href=install.php>back</a>");

mysql_query("CREATE TABLE blog (
  id smallint(5) unsigned NOT NULL AUTO_INCREMENT,
  title varchar(150) NOT NULL DEFAULT 'No Title',
  bloglink varchar(150) NOT NULL,
  text varchar(20000) NOT NULL,
  cat_id smallint(5) unsigned NOT NULL,
  user_id varchar(100) NOT NULL,
  time datetime DEFAULT NULL,
  uptime datetime DEFAULT NULL,
  hit smallint(5) unsigned NOT NULL DEFAULT '0',
  hittoday smallint(5) unsigned DEFAULT '0',
  blogcmtonoff enum('0','1') NOT NULL DEFAULT '1',
  PRIMARY KEY (id)
) ENGINE=MyISAM") OR DIE("Failed to create blog Table: ".mysql_error());
mysql_query("CREATE TABLE comment (
  id mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
  name varchar(100) NOT NULL,
  message varchar(1000) NOT NULL,
  time datetime DEFAULT NULL,
  url varchar(100) DEFAULT NULL,
  ip VARCHAR ( 20 ) NOT NULL,
  browser VARCHAR ( 200 ) NOT NULL,
  blog_id smallint(5) unsigned NOT NULL,
  PRIMARY KEY (id)
) ENGINE=MyISAM") or die("Failed to create comment Table: ".mysql_error());
mysql_query("CREATE TABLE kategori (
  id mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
  kategori varchar(100) NOT NULL,
  catlink varchar(100) NOT NULL,
  PRIMARY KEY (id)
) ENGINE=MyISAM") or die("Failed to create kategori Table: ".mysql_error());
mysql_query("CREATE TABLE user (
  id smallint(5) unsigned NOT NULL AUTO_INCREMENT,
  name varchar(100) NOT NULL,
  password varchar(100) NOT NULL,
  blog_name varchar(100) NOT NULL,
  blog_url varchar(100) NOT NULL,
  blog_dir varchar(100) NOT NULL DEFAULT '/',
  signature varchar(500) NOT NULL DEFAULT '[b]Admin was here.[/b]',
  blogperpage tinyint(3) unsigned NOT NULL DEFAULT '5',
  linkperpage tinyint(3) unsigned NOT NULL DEFAULT '4',
  idx_hitonoff tinyint(1) unsigned NOT NULL DEFAULT '1',
  idx_komenonoff tinyint(1) unsigned NOT NULL DEFAULT '1',
  idx_searchsize tinyint(3) unsigned NOT NULL DEFAULT '17',
  idx_textperblog smallint(5) unsigned NOT NULL DEFAULT '100',
  idx_searchmaxlenght smallint(5) unsigned NOT NULL DEFAULT '50',
  blg_komenperpage tinyint(3) unsigned NOT NULL DEFAULT '10',
  blg_komennamesize tinyint(3) unsigned NOT NULL DEFAULT '18',
  blg_komennamelenght smallint(5) unsigned NOT NULL DEFAULT '20',
  blg_komenurlsize smallint(5) unsigned NOT NULL DEFAULT '18',
  blg_komenurllenght smallint(5) unsigned NOT NULL DEFAULT '100',
  blg_komenpesancols smallint(5) unsigned NOT NULL DEFAULT '20',
  blg_komenpesanrows smallint(5) unsigned NOT NULL DEFAULT '8',
  blg_komenpesanlenght smallint(5) unsigned NOT NULL DEFAULT '500',
  cmt_komenperpage tinyint(3) unsigned NOT NULL DEFAULT '10',
  cmt_linkperpage tinyint(3) unsigned NOT NULL DEFAULT '4',
  wr_titlesize tinyint(3) unsigned NOT NULL DEFAULT '40',
  wr_titlelenght smallint(5) unsigned NOT NULL DEFAULT '150',
  wr_textcols smallint(5) unsigned NOT NULL DEFAULT '50',
  wr_textrows smallint(5) unsigned NOT NULL DEFAULT '15',
  wr_textlenght smallint(5) unsigned NOT NULL DEFAULT '20000',
  style tinyint(3) NOT NULL DEFAULT '1',
  header varchar(2000) NOT NULL DEFAULT '<a href=\"/\"><big><b>Errorisme Mobile Blog</b></big></a>',
  announcement varchar(5000) NOT NULL DEFAULT '<div class=\"blog\"><div class=\"bl_title\"><b>Announcement</b></div><div class=\"bl_box\">Hello World!!!</div></div>',
  footer varchar(2000) NOT NULL DEFAULT '2010 &copy; <a href=\"http://errorisme.com\" target=\"_blank\"><b>Errorisme Corp.</b></a><br>\n\nOriginal script by <a href=\"http://huteri.net\" target=\"_blank\"><b>Huteri</b></a>',
  about varchar(1500) NOT NULL DEFAULT '[b]Hello World!![/b]',
  bbcodeonoff tinyint(1) unsigned not null default '1',
  smileyonoff tinyint(1) unsigned not null default '1',
  footon varchar(1000) NOT NULL DEFAULT 'eMobileBlog v3.2 beta<br>2010 &copy; <a href=\"http://errorisme.com\" target=\"_blank\"><b>Errorisme Corp.</b></a><br>\n\nOriginal script by <a href=\"http://huteri.net\" target=\"_blank\"><b>Huteri</b></a>',
  backcolor varchar(20) NOT NULL DEFAULT '',
  textcolor varchar(20) NOT NULL DEFAULT '',
  time date DEFAULT '0000-00-00',
  hit int(10) unsigned NOT NULL DEFAULT '0',
  hittoday smallint(5) unsigned NOT NULL DEFAULT '0',
  idx_lastcmtonoff enum('1','2') NOT NULL DEFAULT '1',
  idx_mosthitonoff enum('1','2') NOT NULL DEFAULT '1',
  idx_mosthittodayonoff enum('1','2') NOT NULL DEFAULT '1',
  idx_jmllastcmt tinyint(3) unsigned NOT NULL DEFAULT '5',
  idx_jmlmosthit tinyint(3) unsigned NOT NULL DEFAULT '5',
  idx_jmlmosthittoday tinyint(3) unsigned NOT NULL DEFAULT '3',
  idx_lastcmtname smallint(5) unsigned NOT NULL DEFAULT '10',
  idx_lastcmtpesan smallint(5) unsigned NOT NULL DEFAULT '50',
  idx_hittodayonoff enum('1','2') NOT NULL DEFAULT '1',
  idx_cmttodayonoff enum('1','2') NOT NULL DEFAULT '1',
  idx_updatenot varchar(100) NOT NULL DEFAULT '[<font color=\"red\">Update</font>] ',
  blg_seealsoonoff enum('1','2') NOT NULL DEFAULT '1',
  blg_seealsojml tinyint(3) unsigned NOT NULL DEFAULT '3',
  blg_seealsoorder enum('random','kategori') NOT NULL DEFAULT 'kategori',
  PRIMARY KEY (id)
) ENGINE=MyISAM") or die("Failed To create user Table: ".mysql_error());
mysql_query("CREATE TABLE style (
  id smallint(5) unsigned NOT NULL AUTO_INCREMENT,
  stylename varchar(20) NOT NULL,
  css varchar(20) NOT NULL,
  PRIMARY KEY (id)
) ENGINE=MyISAM") OR DIE("Failed to create style Table: ".mysql_error());
mysql_query("CREATE TABLE user_online (
  session char(100) NOT NULL default '',
  time int(11) NOT NULL default '0',
  user_ip varchar(20) NOT NULL,
  user_browser varchar(200) NOT NULL,
  user_location varchar(200) NOT NULL
) TYPE=MyISAM") or die("Failed to create user_online Table: ".mysql_error());

mysql_query("insert into style (id, stylename, css) values ('1','Default','style.css')") or die("Failed Insert Data".mysql_error());
mysql_query("insert into user (id, name, password, blog_name, blog_url, blog_dir, time) values ('50','Admin','admin', 'Errorisme Blog', 'http://errorisme.com', '', curdate()),('1','{$_POST["name"]}', '{$_POST["password"]}', '{$_POST["blog_name"]}', '{$_POST["blog_url"]}', '{$_POST["blog_dir"]}', curdate())") or die("Failed Insert Data".mysql_error());
mysql_query("insert into kategori (kategori, catlink) values ('General', 'general')") or die("Failed To insert category".mysql_error());
mysql_query("INSERT INTO `blog` (`id`, `title`, `bloglink`, `text`, `cat_id`, `time`, `uptime`, `user_id`, `hit`) VALUES ('1','Welcome to eMobileBlog v3.2 beta', 'welcome-to-emobileblog-v3-2-beta', 'Welcome to my MobileBlog.\r\nScript eMobileBlog v3.2 beta by [url=http://errorisme.com][b]Errorisme Corp.[/b][/url]\r\nOriginal script created by [url=http://huteri.net][b]Huteri Manza.[/b][/url] \r\n\r\nVisit http://errorisme.com', '1', now(), now(), '50', '0')") or die(mysql_error());
mysql_query("INSERT INTO `comment` (`id`, `name`, `message`, `time`, `url`, `ip`, `browser`, `blog_id`) VALUES ('1', 'Errorisme Corp.', 'Hi, this is a comment.\r\nTo delete a comment, just login, view the post and delete it.', now(), 'http://errorisme.com', '0.0.0.0', 'Errorisme Custom Browser', '1')") or die(mysql_error());

echo '<title>Installation Success</title>
<div class="divbody">
<div class="heading1"><h1>Installation Success</h1></div><div class="bl_box">Congratulation. eMobileBlog v3.2 beta was successfully installed.<br>For security reason, delete install.php file from your server immedietely.<br>';
if ($_POST["blog_dir"]!="/") 
{
echo '<br>You choose <b>'.$_POST['blog_dir'].'</b> directory in this instalation. Please edit your .htaccess file:<br>
Change &quot;<font class="error">RewriteBase /</font>&quot; line with &quot;<font class="saved">RewriteBase '.$_POST['blog_dir'].'</font>&quot; (without quotes).<br><br>
';
}
echo "<a href=./?login><b>Login</b></a> or <a href=\"./\"><b>View Your Blog</b></a></div>
";
}
else
{
echo '<title>eMobileBlog v3.2 beta Instalation</title>
<div class="divbody">
<div class="heading1"><center><h1>eMobileBlog v3.2 beta Installation</h1></center></div>
<div class="bl_title"><b>Create your administrator account</b></div><div class="bl_box">
<form action="install.php" method="post">
<table border="0">
<tr><td>Username</td><td>:</td><td><input type="text" name="name" maxlenght="100"></td></tr>
<tr><td>Password</td><td>:</td><td><input type="password" name="password" maxlenght="100"></td></tr>
<tr><td>Confirm Password</td><td>:</td><td><input type="password" name="repassword" maxlenght="100"></td></tr>
<tr><td>Blog Name</td><td>:</td><td><input type="text" name="blog_name" maxlenght="100" value="Errorisme Mobile Blog"></td></tr>
<tr><td>Blog URL</td><td>:</td><td><input type="text" name="blog_url" maxlenght="100" value="http://'.$_SERVER['HTTP_HOST'].'"></td></tr>
</table>
<input type="hidden" name="blog_dir" value="'.str_replace('\\','/',dirname($_SERVER['SCRIPT_NAME'])).'">
<input type="submit" value="Submit" name="submit"></div>
';
}
?>
</div>
<div class="footer">2010 &copy; <a href="http://errorisme.com" target="_blank"><b>Errorisme Corp.</b></a><br>
Original script by <a href="http://huteri.net" target="_blank"><b>Huteri</b></a></div>
<div class="none"><small>Powered by <a href="http://errorisme.com" title="eMobileBlog v3.2 beta"><b>eMobileBlog</b></a></small></div>
</div>
</body>
</html>