<?
include "../functions.php";
include "../mysqlcon.php";

$admin_info = mysql_fetch_assoc(mysql_query("SELECT * FROM ims_admin"));
$n = basename($_SERVER['PHP_SELF']);

if($admin_info[debug_mode] == "on") {
error_reporting(E_ALL ^ E_NOTICE);
} else {
error_reporting(0);
}


if($n != "login.php") {
if(isset($_COOKIE['admin_cookie']) AND isset($_COOKIE['pass_cookie']) AND isset($_COOKIE['admk_cookie'])) {
if(stripslashes($_COOKIE['admin_cookie']) == encrypt($admin_info[login_name]) & stripslashes($_COOKIE['pass_cookie']) == encrypt($admin_info[password]) & stripslashes($_COOKIE['admk_cookie']) == encrypt($admin_info[special_code])) {
$admin_username = $_COOKIE['admin_cookie'];
$admin_password = $_COOKIE['pass_cookie'];
$other_cookie = $_COOKIE['admk_cookie'];
} else {
header("Location: login.php");
exit;
}
} else {
header("Location: login.php");
exit;
}
}









// SET ADMIN HEADER
$header = "
<html>
<head>
<title>Image Management System - Administration Panel</title>
<META HTTP-EQUIV='Pragma' CONTENT='no-cache'>
<link rel='STYLESHEET' type='text/css' href='../styles.css'>
<script language='javascript'>
<!--
self.name='main';
function adduser() {
var w = 475;
var h = 585;
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
var page='users_add.php?task=$task&page=$page&s=$s&o=$o&t=$t';
var features = 'width='+w+',height='+h+',top='+wint+',left='+winl+'menubar=no,location=no,status=no,resizeable=no,scrollbars=yes';
win3=window.open(page,\"\",features)
}
function addplan() {
var w = 475;
var h = 435;
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
var page='plans_add.php';
var features = 'width='+w+',height='+h+',top='+wint+',left='+winl+'menubar=no,location=no,status=no,resizeable=no,scrollbars=yes';
win3=window.open(page,\"\",features)
}
function getuser(user) {
var w = 475;
var h = 575;
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
var page='user_info.php?u_id=' + user + '&task=$task&page=$page&s=$s&o=$o&t=$t';
var features = 'width='+w+',height='+h+',top='+wint+',left='+winl+'menubar=no,location=no,status=no,resizeable=no,scrollbars=yes';
win3=window.open(page,\"\",features)
}
function getuserpending(user) {
var w = 449;
var h = 350;
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
var page='user_info_pending.php?u_id=' + user + '&task=$task&page=$page&o=$o';
var features = 'width='+w+',height='+h+',top='+wint+',left='+winl+'menubar=no,location=no,status=no,resizeable=no,scrollbars=yes';
win3=window.open(page,\"\",features)
}
function getplan(plan) {
"; if($admin_info[approve_deny] == "yes") { 
$header .= "
var w = 475;
var h = 365;
";
} else {
$header .= "
var w = 475; 
var h = 345;
"; } 
$header .= "
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
var page='plan_info.php?p_id=' + plan;
var features = 'width='+w+',height='+h+',top='+wint+',left='+winl+'menubar=no,location=no,status=no,resizeable=no,scrollbars=yes';
win3=window.open(page,\"\",features)
}
function add_cat(form) {
if(form.new_category.value == '') {
alert('You must enter a category.');
return false;
}
return true;
}
function mod_cat(form) {
if(form.mod_category.value == '') {
alert('You must enter a category.');
return false;
}
return true;
}
function add_quest(form) {
if(form.new_category[0].selected == true) {
alert('You must choose a category.');
return false;
}
if(form.new_question.value == '') {
alert('You must enter a question.');
return false;
}
if(form.new_answer.value == '') {
alert('You must enter an answer.');
return false;
}
return true;
}
function mod_quest(form) {
if(form.mod_category[0].selected == true) {
alert('You must choose a category.');
return false;
}
if(form.mod_question.value == '') {
alert('You must enter a question.');
return false;
}
if(form.mod_answer.value == '') {
alert('You must enter an answer.');
return false;
}
return true;
}
function warning() {
var agree = confirm('Warning! This will overwrite all data currently in your IMS tables! Do you wish to continue?');
if(agree)
 return true;
else
 return false;
}
// -->
</script>

</head>
<body>


<table width='685' cellpadding='0' cellspacing='0' style='margin-bottom: 4px;'>
<tr><td><img src='../icons/admin_title.gif' border='0'></td></tr>
</table>

<table cellpadding='0' cellspacing='0'>
<tr>

<td width='135' valign='top' NOWRAP>

<div style='margin: 0px;'><img src='../icons/left-top.gif' border='0'></div>
<table cellpadding='0' cellspacing='0'>
<tr>
<td valign='top' width='126' style='background: #F5F5F5; border: 1px solid #5E5E5E; border-top: none; border-bottom: none;'>
<!-- SHOW ADMIN MENU -->

  <table width='100%' cellpadding='0' cellspacing='0' style='border-bottom: 1px solid #777777;'>
  <tr>
  <td valign='bottom' width='10' style='padding-left: 5px; padding-bottom: 3px;'><a href='index.php'><img src='../icons/homefolder"; if($n == "index.php") { $header .= "2"; } $header .= ".gif' border='0'></a>&nbsp;</td>
  <td valign='top' style='padding-bottom: 4px; padding-left: 2px;'><a href='index.php' class='admin_menu'>Admin Home</a></td>
  </tr>
  </table>

  <table width='100%' cellpadding='0' cellspacing='0' style='margin-top: 4px; border-bottom: 1px solid #777777;'>
  <tr>
  <td valign='bottom' width='10' style='padding-left: 5px; padding-bottom: 3px;'><a href='settings_general.php'><img src='../icons/sfolder"; if($n == "settings_general.php") { $header .= "2"; } $header .= ".gif' border='0'></a>&nbsp;</td>
  <td valign='top' style='padding-bottom: 4px; padding-left: 2px;'><a href='settings_general.php' class='admin_menu'>General Settings</a></td>
  </tr>
  </table>

  <table width='100%' cellpadding='0' cellspacing='0' style='margin-top: 4px; border-bottom: 1px solid #777777;'>
  <tr>
  <td valign='bottom' width='10' style='padding-left: 5px; padding-bottom: 3px;'><a href='users.php'><img src='../icons/sfolder"; if($n == "users.php" | $n == "user_info.php") { $header .= "2"; } $header .= ".gif' border='0'></a>&nbsp;</td>
  <td valign='top' style='padding-bottom: 4px; padding-left: 2px;'><a href='users.php' class='admin_menu'>User Manager</a></td>
  </tr>
  </table>

  <table width='100%' cellpadding='0' cellspacing='0' style='margin-top: 4px; border-bottom: 1px solid #777777;'>
  <tr>
  <td valign='bottom' width='10' style='padding-left: 5px; padding-bottom: 3px;'><a href='users_pending.php'><img src='../icons/sfolder"; if($n == "users_pending.php" | $n == "confirm.php") { $header .= "2"; } $header .= ".gif' border='0'></a>&nbsp;</td>
  <td valign='top' style='padding-bottom: 4px; padding-left: 2px;'><a href='users_pending.php' class='admin_menu'>Pending Signups</a></td>
  </tr>
  </table>

  <table width='100%' cellpadding='0' cellspacing='0' style='margin-top: 4px; border-bottom: 1px solid #777777;'>
  <tr>
  <td valign='bottom' width='10' style='padding-left: 5px; padding-bottom: 3px;'><a href='email.php'><img src='../icons/sfolder"; if($n == "email.php") { $header .= "2"; } $header .= ".gif' border='0'></a>&nbsp;</td>
  <td valign='top' style='padding-bottom: 4px; padding-left: 2px;'><a href='email.php' class='admin_menu'>Email Users</a></td>
  </tr>
  </table>

  <table width='100%' cellpadding='0' cellspacing='0' style='margin-top: 4px; border-bottom: 1px solid #777777;'>
  <tr>
  <td valign='bottom' width='10' style='padding-left: 5px; padding-bottom: 3px;'><a href='plans.php'><img src='../icons/sfolder"; if($n == "plans.php") { $header .= "2"; } $header .= ".gif' border='0'></a>&nbsp;</td>
  <td valign='top' style='padding-bottom: 4px; padding-left: 2px;'><a href='plans.php' class='admin_menu'>Pricing Plans</a></td>
  </tr>
  </table>

  <table width='100%' cellpadding='0' cellspacing='0' style='margin-top: 4px; border-bottom: 1px solid #777777;'>
  <tr>
  <td valign='bottom' width='10' style='padding-left: 5px; padding-bottom: 3px;'><a href='faq.php'><img src='../icons/sfolder"; if($n == "faq.php") { $header .= "2"; } $header .= ".gif' border='0'></a>&nbsp;</td>
  <td valign='top' style='padding-bottom: 4px; padding-left: 2px;'><a href='faq.php' class='admin_menu'>FAQ Manager</a></td>
  </tr>
  </table>

  <table width='100%' cellpadding='0' cellspacing='0' style='margin-top: 4px; border-bottom: 1px solid #777777;'>
  <tr>
  <td valign='bottom' width='10' style='padding-left: 5px; padding-bottom: 3px;'><a href='settings_demo.php'><img src='../icons/sfolder"; if($n == "settings_demo.php") { $header .= "2"; } $header .= ".gif' border='0'></a>&nbsp;</td>
  <td valign='top' style='padding-bottom: 4px; padding-left: 2px;'><a href='settings_demo.php' class='admin_menu'>Demo Settings</a></td>
  </tr>
  </table>

  <table width='100%' cellpadding='0' cellspacing='0' style='margin-top: 4px; border-bottom: 1px solid #777777;'>
  <tr>
  <td valign='bottom' width='10' style='padding-left: 5px; padding-bottom: 3px;'><a href='settings_users.php'><img src='../icons/sfolder"; if($n == "settings_users.php") { $header .= "2"; } $header .= ".gif' border='0'></a>&nbsp;</td>
  <td valign='top' style='padding-bottom: 4px; padding-left: 2px;'><a href='settings_users.php' class='admin_menu'>User Settings</a></td>
  </tr>
  </table>

  <table width='100%' cellpadding='0' cellspacing='0' style='margin-top: 4px; border-bottom: 1px solid #777777;'>
  <tr>
  <td valign='bottom' width='10' style='padding-left: 5px; padding-bottom: 3px;'><a href='settings_html.php'><img src='../icons/sfolder"; if($n == "settings_html.php") { $header .= "2"; } $header .= ".gif' border='0'></a>&nbsp;</td>
  <td valign='top' style='padding-bottom: 4px; padding-left: 2px;'><a href='settings_html.php' class='admin_menu'>HTML Settings</a></td>
  </tr>
  </table>

  <table width='100%' cellpadding='0' cellspacing='0' style='margin-top: 4px; border-bottom: 1px solid #777777;'>
  <tr>
  <td valign='bottom' width='10' style='padding-left: 5px; padding-bottom: 3px;'><a href='backup.php'><img src='../icons/sfolder"; if($n == "backup.php") { $header .= "2"; } $header .= ".gif' border='0'></a>&nbsp;</td>
  <td valign='top' style='padding-bottom: 4px; padding-left: 2px;'><a href='backup.php' class='admin_menu'>Backup/Restore</a></td>
  </tr>
  </table>

  <table width='100%' cellpadding='0' cellspacing='0' style='margin-top: 4px;'>
  <tr>
  <td valign='bottom' width='10' style='padding-left: 5px; padding-bottom: 0px;'><a href='logout.php'><img src='../icons/sfolder.gif' border='0'></a>&nbsp;</td>
  <td valign='top' style='padding-bottom: 0px; padding-left: 2px;'><a href='logout.php' class='admin_menu'>Logout</a></td>
  </tr>
  </table>

</td></tr></table>
<div style='margin: 0px; margin-bottom: 10px;'><img src='../icons/left-bottom.gif' border='0'></div>

</td>

<td valign='top'>

<div style='margin: 0px;'><img src='../icons/bg3_top.gif' border='0'></div>
<table cellpadding='0' cellspacing='0'>
<tr><td class='content3' width='525'>

<!-- BEGIN CONTENT -->
";











// SET ADMIN FOOTER
$footer = "
<!-- END CONTENT -->
</td></tr></table>
<div style='margin: 0px;'><img src='../icons/bg3_bottom.gif' border='0'></div>
<div style='margin: 0px; margin-top: 2px; padding-left: 10px; color: #777777'>
Copyright © 2002-2004, Webligo Developments. All rights reserved. 
</div>

</td>
</tr>
</table>

</body>
</html>
";


?>