<?php
define("USER_PW", "987654321");
session_start();
$form=new Form;
echo '<form method="post" action=""><table>
<tr class="head">
<td>Heslo</td><td><input type="password" name="pass" value="'.$form->value("pass").'"> '.$form->error("pass").'</td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="submit" value="Login"></td>
</tr></table></form>';
if(isset($_POST["submit"])){
$pass=trim(htmlspecialchars($_POST["pass"]));
if($pass==""){
$form->setError("pass", "* Password is empty");
}
if($pass!=USER_PW){
$form->setError("pass", "* Password is not set");
}
if($form->num_errors > 0){
$_SESSION['value_array'] = $_POST;
$_SESSION['error_array'] = $form->getErrorArray();
}else{
$_SESSION['set_admin'] = true;
header("Location: index.php");
exit();
}
$_SESSION['set_admin'] = false;
header("Location: index.php");
exit();
}
?>
|