<?php

if (file_exists('optional.php')) {
	include ('optional.php');
}

define('PWFORM_SUBMITTED', isset($_POST['submit0']));
define('COOKIE_EXISTS', isset($_COOKIE['textadmin']));

if (PWFORM_SUBMITTED) {
	$string = $_POST['password'];
	$strip = array("<", ">", "\"", "'", "\\");
	$string = str_replace($strip, "", $string);
	$word = md5($string);
	setcookie('textadmin', $word, time() +31536000, '/');
} else {
	if (COOKIE_EXISTS) {
		$word = $_COOKIE['textadmin'];
	}
}

include ('functions.php');
if (file_exists('../inc/settings.php')) {
	include ('../inc/settings.php');
}

if (!file_exists('../../.htaccess')) {
	$cms_dir = 'cms/';
} else {
	$cms_dir = NULL;
}

$status = cleanText($_GET['status']);
if ((($status == 'logout') && COOKIE_EXISTS) || ($user == 'disappointed')) {
	$word = "";
	setcookie('textadmin', '', time() -3600, '/');
}

?>