Location: PHPKode > projects > Blog Script for PHP > blog-script-for-php/install.php
<?php $_SERVER['NOTMPL']=1; require_once(dirname(__FILE__).'/index.php'); ?> <html><head> <style type="text/css" media="screen"> <!-- body{background:#ffffff;color:#000000;font-family:Georgia,Times New Roman,Times;margin-left:10%;margin-right:10%;} h1,h2,h3,h4{color:#990000;font-weight:lighter;} A,A:active,A:link,A:visited,A:hover{text-decoration:none;cursor:pointer;} A:link{color:#3366cc; background:#ffffff; } A:visited{color:#0000cc; background:#ffffff; } A:active{color:#ffffff; background:#ff0000;} A:hover{color:#ffffff; background:#6699cc;} --> </style> <title>Installation</title> </head> <body bgcolor=#ffffff link=#3366cc vlink=#3366cc text=#000000> <?php if(isset($_POST['email']) && isset($_POST['passw']) && isset($_POST['name'])) { if(!AN3($_POST['email'])) die("Email addres is not valid!"); if(!AO4($_POST['passw'])) die("Bad password! Only numbers and english letters are allowed."); if(!AN3($_POST['email'])) die("Email addres is not valid!"); if(!AP5($_POST['name'])) die("Name is not valid! HTML tags are not allowed!"); $IB9=0; $name1 = PREFIX.'User'; $query1 = "CREATE TABLE $name1 ( user INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, email TEXT NOT NULL, password TEXT NOT NULL, name TEXT NOT NULL, info TEXT, notifications INT UNSIGNED NOT NULL DEFAULT 1, level INT UNSIGNED DEFAULT 0, register_time DATETIME NOT NULL)"; $name2 = PREFIX.'Message'; $query2 = "CREATE TABLE $name2 ( cnt INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY, idx INT UNSIGNED NOT NULL, user INT UNSIGNED NOT NULL, t DATETIME NOT NULL, header TEXT, body LONGTEXT NOT NULL)"; if(BZ1($name1,$query1) && BZ1($name2,$query2)) { echo "</p>Tables sucessfully created</p>"; $DF3 = "INSERT INTO ".PREFIX."User (email,password,name,info,level,register_time) VALUES ('{$_POST['email']}','{$_POST['passw']}','{$_POST['name']}','',2,NOW())"; $EL5 = @ Mysql_Query($DF3); if($EL5) { @ Mysql_free_result($EL5); } else { AC2('could not INSERT user info database'); exit; } $CS0['level']=2; $CS0['user']=1; $CS0['name']=$_POST['name']; $CP7['number']=AT9("Hello, world!", "This is your first blog message. You may edit or delete it in order to start blogging."); AU0("This is your first comment."); echo "<img src=http://www.bloly.com/install_pic.php border=0 width=1 height=1>Bloly Blog successfully installed. <a href=index.php>click here</a> to continue."; echo "<script>\nsetTimeout(\"window.location='index.php'\",3000);\n</script>\n"; } else { if($IB9) { echo "<p>It seems everything is already installed.</p>"; echo "<p>You must DROP tables if you want to reinstall it.</p>"; echo "<a href=index.php>click here</a> to continue."; } else { AC2("Could not install"); } } } else { if(!isset($_POST['passw'])) $_POST['passw']=substr(md5(microtime()),1,6); if(!isset($_POST['name'])) $_POST['name']='Blog owner'; if(!isset($_POST['email'])) $_POST['email']=''; ?> <h1>Install Bloly Blog</h1> <p>Fill in the following form. Specified user will have administrator rights.</p> <form method=post action="<?=$PHP_SELF?>"> <table border=0> <tr><td>Your name</td><td><input type=text name=name value="<?php echo $_POST['name'];?>" size=30></td></tr> <tr><td>Choose the password</td><td><input type=text name=passw value="<?php echo $_POST['passw'];?>" size=30></td></tr> <tr><td>Type your email address</td><td><input type=text name=email value="<?php echo $_POST['email'];?>" size=30></td></tr> <tr><td>&nbsp;</td><td><input type=submit value="Install &gt;&gt;"></td></tr> </table></form> <?php } ?> </body> </html>
Return current item: Blog Script for PHP