Location: PHPKode > projects > BlogNEasy > install.php
<?php
/*++++++++++++++++++++++++++++++++++++++++++++++++++++
| BlogNEasy
| Copyright 2011 Fernando Baptista
| http://www.Lightneasy.org
++++++++++++++++++++++++++++++++++++++++++++++++++++++
| Install module
| Version 0.9
++++++++++++++++++++++++++++++++++++++++++++++++++++++
| Released under the terms & conditions of v2 of the
| GNU General Public License. For details refer to
| the included gpl.txt file or visit http://gnu.org
++++++++++++++++++++++++++++++++++++++++++++++++++++++
*/
?>
<html><head><title>BlogNEasy Install</title></head>
<body style="background: #606060;">
<div style="width: 550px; margin: auto; background: #1E90FF; color: #fff; padding: 10px;">
<h1 style="text-align: center;">BlogNEasy Install</h1>
<div style="background: #f0f0f0; padding-left: 30px; padding-top: 10px; color: #000;">
<?php
clearstatcache();
if($_POST['submit'] == "Create Data Files") {
unset($_POST['submit']);
if($_POST['password']!="" && $_POST['password1']!="" && $_POST['password']==$_POST['password1']) {
$pass=sha1($_POST['password']);
$admin=$_POST['admin'];
$email=$_POST['email'];
$wemail=$_POST['wemail'];
$oldumask = umask(0);
if(!is_dir("data")) mkdir("data", 0755) or die ("could not create data folder");
if(!is_dir("uploads")) mkdir("uploads", 0755) or die ("could not create uploads folder");
umask($oldumask);
$fp=fopen("data/config.php","w");
fwrite($fp,"<?php\n");
fwrite($fp,'$set[\'password\']="'.$pass.'";'."\n");
fwrite($fp,'$set[\'template\']="default";'."\n");
fwrite($fp,'$set[\'title\']="BlogNEasy";'."\n");
fwrite($fp,'$set[\'subtitle\']="Blogging is easy";'."\n");
fwrite($fp,'$set[\'keywords\']="Blog script, PHP, Free blog, Open Source";'."\n");
fwrite($fp,'$set[\'description\']="BlogNEasy is a light and simple blog system that uses no database";'."\n");
fwrite($fp,'$set[\'author\']="Fernando Baptista";'."\n");
fwrite($fp,'$set[\'footer\']="Copyright &amp;copy; 2011 BlogNEasy";'."\n");
fwrite($fp,'$set[\'timeoffset\']="0";'."\n");
fwrite($fp,'$set[\'fromname\']="'.$admin.'";'."\n");
fwrite($fp,'$set[\'fromemail\']="'.$wemail.'";'."\n");
fwrite($fp,'$set[\'toemail\']="'.$email.'";'."\n");
fwrite($fp,'$set[\'language\']="en_US";'."\n");
fwrite($fp,'$set[\'catchpa\']="1";'."\n");
fwrite($fp,'$set[\'editorpath\']="./fckeditor/";'."\n");
fwrite($fp,'$set[\'indexfile\']="index.php";'."\n");
fwrite($fp,'$set[\'dateformat\']="%m/%d/%y - %I:%M %p";'."\n");
fwrite($fp,"?>\n");
fclose($fp);


$fp=fopen("data/categories.dat","w");
fwrite($fp,"1|General|General|1||\n");
fclose($fp);

$fp=fopen("data/posts.dat","w");
fwrite($fp,"1|$admin|$wemail|First Post|<p>This is my first post.</p>|".time()."|1|1||\n");
fclose($fp);

$fp=fopen("data/extra.htm","w");
fwrite($fp,"<h2>Extra Text</h2>\n<p>This is the extra text.</p>\n<p>This is a light, fast blog script that uses <strong>no database</strong>.</p>
<p>It is perfect for a personal blog, as long as you don\'t intend to make thousands of posts. If so, then use the database version.</p>\n");
fclose($fp);
?>
<h4>Installation Successfull!</h4>
<p>You should now delete the file install.php inside LightNEasy folder, for security reasons.</p>
<p align="center"><a href="index.php">Start BlogNEasy!</a></p>
<?php
} else {
?>
<h4>Please try Again!</h4>
<p>All fields have to be filled</p>
<p>Passwords are either empty or dont match!</p>
<?php
	entryform();
}
} else {
?>
<h4>BlogNEasy will now attempt to create the folders and data files</h4>
<p>Please note eventual error messages,and take apropriate measures.</p>
<p>If you get an error message, please set data folder permissions to 777</p>
<?php
	entryform();
}
?>
<p>&nbsp;</p>
</div>
</div>
</body>
</html>
<?php
function entryform() { ?>
<form name="form1" action="" method="post"><table>
<tr><td>Enter password:</td><td><input type="password" name="password" value=""></td></tr>
<tr><td>Repeat password:</td><td><input type="password" name="password1" value=""></td></tr>
<tr><td>Admin name:</td><td><input type="text" name="admin" value=""></td></tr>
<tr><td>Admin email:</td><td><input type="text" name="email" value=""></td></tr>
<tr><td>Reply-to email:</td><td><input type="text" name="wemail" value=""></td></tr>
<tr><td>&nbsp;</td><td><input type="submit" name="submit" value="Create Data Files" /></td></tr>
</table></form>
<?php }
?>
Return current item: BlogNEasy