<?php
/*
tinbox, Open Source E-Learning
http://www.tinbox.org
Copyright (c) 2004 Kevin Brennan
Released under the GNU General Public License
*/
require('../config.php');
require(PPATH.INCLUDES.'logging.php');
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">";
echo "<html>";
echo "<head>";
echo "<title>".BRAND_NAME." Account Administration</title>";
echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">";
echo "<meta http-equiv=\"cache-control\" content=\"no-cache\">";
echo "<meta http-equiv=\"pragma\" content=\"no-cache\">";
echo "<link rel=StyleSheet href=\"".THEME."style.css\" TYPE=\"text/css\" >";
echo "</head>";
echo "<body leftmargin=\"0\" topmargin=\"0\" marginwidth=\"0\" marginheight=\"0\" onload=\"self.focus()\">";
$link = mysql_connect(DB_SERVER, DB_USER, DB_PSW);
mysql_select_db(DB_DB);
$failedlogin = 0;
if ($email != "" && $psw != "" )
{
$result = mysql_query("select idx from admin_users where email='".$email."' and psw='".$psw."' and access_ac=1");
if ($row = mysql_fetch_object($result))
$idx=$row->idx;
else
$failedlogin = 1;
}
if (isset($idx) && $idx != "")
{
$sql = "select us.name, us.email from admin_users us where idx='".$idx."'";
if ($row = mysql_fetch_object(mysql_query($sql)))
{
// banner
echo "<table class=\"box\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
echo "<tr><td width=\"400\"><img src=\"".THEME."banner1.gif\"></td>";
echo "<td width=\"70%\" class=\"banner\"> </td>";
echo "<td nowrap class=\"banner\"><a class=\"banner\" href=\"mailto:".SYSADMIN."\"> >> Support </a></td>";
echo "<td nowrap class=\"banner\"><a class=\"banner\" href=\"javascript:popup('help.html')\"> >> Help </a></td>";
echo "<td nowrap class=\"logout\"><a class=\"logout\" href=\"javascript:logout()\"> >> Log Out << </a></td>";
echo "</tr>";
echo "</table>";
// box start
echo "<table class=\"box\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
echo "<tr><th align=\"left\" width=\"90%\"><img src=\"".THEME."logo.gif\"></th><th>";
// Logged on box
echo "<table class=\"box\" border=\"0\" align=\"right\" cellpadding=\"0\" cellspacing=\"0\" width=\"250\">";
echo "<tr><th colspan=\"3\"><img src=\"".THEME."boxh_loggedon.gif\"></th></tr>";
echo "<tr><th colspan=\"3\"><img src=\"".THEME."boxt_250.gif\"></th></tr>";
echo "<tr><td width=\"5\"></td><td class=\"text\">";
echo "<h3><span title=\"".$row->email."\">".$row->name."</span></h3>";
$sql = "select count(*) as cnt_accounts from account_main";
$row = mysql_fetch_object(mysql_query($sql));
echo "Accounts: ".$row->cnt_accounts;
echo "</td><td width=\"5\"></td></tr>";
echo "<tr><th colspan=\"3\"><img src=\"".THEME."boxb_250.gif\"></th></tr>";
echo "</table>";
// box end
echo "</th><th> ";
// hidden menuform
echo "<form action=\"\" method=\"post\" class=\"tabform\" name=\"tabform\">";
echo "<input type=\"hidden\" name=\"menu\" value=\"".$menu."\"><input type=\"hidden\" name=\"idx\" value=\"".$idx."\"></form>";
echo "</th></tr></table>";
// header box end
if(!isset($menu) | $menu=="")
$menu="Accounts";
echo "<table class=\"tabmenu\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\">";
echo "<tr><td> </td><td>";
//Main Menu
// Tab Accounts
echo "<a href=\"javascript:tabmenu('Accounts')\">";
if($menu=="Accounts")
echo "<img src=\"".THEME."tabs_accounts.gif\" border=\"0\"></a>";
else
echo "<img src=\"".THEME."tab_accounts.gif\" border=\"0\"></a>";
// Tab Users
echo "<a href=\"javascript:tabmenu('Users')\">";
if($menu=="Users")
echo "<img src=\"".THEME."tabs_users.gif\" border=\"0\"></a>";
else
echo "<img src=\"".THEME."tab_users.gif\" border=\"0\"></a>";
//Tab Activity
echo "<a href=\"javascript:tabmenu('Activity')\">";
if($menu=="Activity")
echo "<img src=\"".THEME."tabs_statistics.gif\" border=\"0\"></a>";
else
echo "<img src=\"".THEME."tab_statistics.gif\" border=\"0\"></a>";
echo "</td></tr></table><hr>";
echo "<table class=\"box\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" width=\"98%\"><tr><td>";
switch($menu)
{
case "Accounts":
require('accounts.php');
break;
case "Users";
require('users.php');
break;
case "Activity";
require('activity.php');
break;
default:
require('accounts.php');
break;
}
echo "</td></tr></table><hr>";
}
else
{
echo "Not a valid account - contact the system administrator" ;
}
}
else
{
echo "<img src=\"".THEME."logo.gif\"><br><img src=\"".THEME."px.gif\" height=\"100\">";
echo "<table class=\"box\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" width=\"250\">";
echo "<tr><th> </th></tr><tr><th>";
echo "<form method=\"post\" action=\"\">";
echo "<table class=\"box\" border=\"0\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\" width=\"80%\">";
echo "<tr><td class=\"text\">Email:</td><td class=\"text\"><input type=\"text\" name=\"email\" size=\"20\" maxlength=\"50\"></td></tr>";
echo "<tr><td class=\"text\">Password:</td><td class=\"text\"><input type=\"password\" name=\"psw\" size=\"20\" maxlength=\"10\"></td></tr>";
echo "<tr><td align=\"right\" class=\"text\" colspan=\"2\"><input type=\"submit\" value=\"Go\"></td></tr>";
echo "</table>";
echo "</form>";
echo "</th></tr><tr><th> </th></tr></table>";
}
?>
<script type="text/javascript" language="javascript">
function popup(url)
{
/*window.open(url);*/
var popup = window.open(url,"","menubar=0,toolbar=0,locationbar=0,personalbar=0,scrollbars=1,statusbars=0,width=750,height=550");
}
function quickpop()
{
/*window.open(url);*/
var popup = window.open("quickstart.php?accountidx=<?php echo $accountidx; ?>","","menubar=0,toolbar=0,locationbar=0,personalbar=0,scrollbars=1,statusbars=0,width=500,height=200");
}
function tabmenu(option)
{
document.tabform.menu.value=option;
document.tabform.submit();
}
function logout()
{
if(confirm("Are you sure you want to log out?"))
{
document.tabform.idx.value="";
document.tabform.submit();
window.close();
}
}
</script>
</body>
</html>