<?php
$cat = (int)$_GET['cat'];
require_once('../../class/mysql.php');
if(isset($_POST['pass']))
{
$pass = $mysql->get_array($mysql->query("password", $mysql->perfix."gallery_cats", "ID = $cat LIMIT 1"));
if($_POST['pass'] == $pass['password'])
{
setcookie('gallery'.$cat, time(), strtotime("+7 days"), '/');
echo '<script>window.close();window.opener.location.reload();</script>';
die();
exit;
}
else
{
echo '<b>Wrong password!</b>';
}
}
?>
<style type="text/css">
<!--
body, td, th {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 10pt;
}
-->
</style>
<p>This is a password protected image gallery, please enter the password below to view it.</p>
<form name="form1" method="post" action="" autocomplete="off">
<table border="0" cellspacing="1" cellpadding="5">
<tr>
<td>Password</td>
<td><input type="password" name="pass" id="pass" /></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" name="button" id="button" value="Login" /></td>
</tr>
</table>
</form>