// ************************** misc other variables - do not change **********************
// ************************************ below here! *************************************
// ************************* unless you know what you're doing **************************
$dir=substr(__FILE__, 0, strrpos(__FILE__, "/")+1);
// load config
include_once($dir."config.inc.php");
include_once($dir."FCKeditor/fckeditor.php") ;
$teaser=teaserempty;
$calendar = "Demi's January calendar goes online. Each month a new calendar is updated and ready for download. Click Here To Download->>";
$dat=$dir."data.dat";
$templatefile=$dir."templatesindex.inc.php";
$log=$dir."log.dat.php";
$pathtowysiwyg=$pathtoscript."wysiwyg/";
setlocale(LC_TIME, $datelang);
$me= $_SERVER['PHP_SELF'];
$empty=false;
$now=time();
$version="1.6.2";
if (!isset($_GET['hash']) || $_GET['hash']=="") {
srand($now);
for ($i=0; $i<16 ; $i++) $secret.=chr(rand(60, 127));
$secret=md5($secret);
$hash=md5($_SERVER['HTTP_USER_AGENT'].$now.$secret);
}else $hash= $_GET['hash'];
$getvars="?hash=$hash";
if (isset($_REQUEST['do'])) $do=$_REQUEST['do'];
if (isset($_REQUEST['id'])) $id=$_REQUEST['id'];
if (isset($_REQUEST['action'])) $action=$_REQUEST['action'];
if (isset($_REQUEST['title'])) $title=$_REQUEST['title'];
if (isset($_REQUEST['name'])) $name=$_REQUEST['name'];
if (isset($_REQUEST['pwd'])) $pwd=$_REQUEST['pwd'];
if (isset($_REQUEST['email'])) $email=$_REQUEST['email'];
if (isset($_REQUEST['www'])) $www=$_REQUEST['www'];
if (isset($_REQUEST['story'])) $story=$_REQUEST['story'];
if (isset($_REQUEST['teaser'])) $teaser=$_REQUEST['teaser'];
if (isset($_REQUEST['time'])) $time=$_REQUEST['time'];
if (isset($_REQUEST['date'])) $date=$_REQUEST['date'];
// ************************** functions ***********************
// ************************************************************
function getkey($index, $stuff){
foreach ($stuff->data as $key => $item){
if ($item['id']==$index){
$ret=$key;
break;
}
}
return $ret;
}
function validemail($addr){
return eregi("^[a-z0-9]+([_.-][a-z0-9]+)*@([a-z0-9]+([.-][a-z0-9]+)*)+\\.[a-z]{2,4}$", $addr);
}
function jsRedirect($url){
echo "";
}
function clearoldadmins() {
global $log, $now, $adminexpire;
include($log);
if (count($admins)>0){
$i=0;
$fp=fopen($log, "w");
fputs($fp, "\n");
foreach ($admins as $line){
if ($now-$line['time']<$adminexpire)
fputs($fp, "\$admins[$i]['time']=".$line[time]."; \$admins[$i]['hash']='".$line['hash']."';\n");
$i++;
}
fputs($fp, "?>");
fclose($fp);
}
}
function saveposts($stuff){
global $dat;
$fp=fopen($dat, "w");
foreach ($stuff as $item){
$line=$item['id']."|".$item['time']."|".$item['mode']."|".$item['title']."|".$item['story']."|".$item['teaser']."\n";
fputs($fp, $line);
}
fclose($fp);
}
function isloggedin() {
global $log, $now, $adminexpire;
include($log);
$logged=false;
if (count($admins)>0){
foreach ($admins as $line){
if ($line['hash']==md5($_GET['hash'])) $logged=true;
}
}
return $logged;
}
function showmenu() {
global $txtsign, $txtview, $txtadmin, $me, $getvars;
echo "