| Current Path : /var/www/html/mmishra/indem/iiita/ |
| Current File : /var/www/html/mmishra/indem/iiita/inner1.php |
<?
$HTTP_SERVER_VARS['chk_home']=1;
require("html.php");
require("functions.php");
dbConnect();
$conf=$_REQUEST["conf"];
$target=$_REQUEST["target"];
$txtID=$_POST['txtID'];
$txtPWD=$_POST['txtPWD'];
$user = "";
$s_id = "";
$role = "";
$use_cookie = 0;
session_start();
if (isset($HTTP_SESSION_VARS['user'])){
$user = $HTTP_SESSION_VARS['user'];
$s_id = $HTTP_SESSION_VARS['s_id'];
} else if (isset($HTTP_SESSION_VARS['auto_login'])){
$cred = explode(" ", $HTTP_SESSION_VARS['auto_login']);
$txtID = $cred[0];
$txtPWD = base64_decode($cred[1]);
$use_cookie = 1;
}
if (isset($_REQUEST['logout'])){
mysql_query("delete from auth where s_id='$s_id'");
session_unset();
session_destroy();
$HTTP_SESSION_VARS['user'] = ""; $HTTP_SESSION_VARS['s_id'] = ""; $HTTP_SESSION_VARS['role'] = "";
$user = ""; $s_id = ""; $role = "";
if ($mode == "forget") setcookie("auto_login", "", time()-3600);
header("Location: index.php");
exit;
}
if ($use_cookie == 1 || isset($_POST['login'])){
$txtID = $_POST["txtID"];
$txtPWD = $_POST["txtPWD"];
$chkRem = $_POST["chkRem"];
$role = authenticate($txtID, $txtPWD);
$s_id = uniq_sid($txtID, $txtPWD);
if ($role == "admin" || $role == "user"){
$user = $txtID;
session_register("user", "s_id", "role");
if ($use_cookie == 0){
if ($chkRem) setcookie("auto_login", $txtID . " " . base64_encode($txtPWD), time()+31536000);
else setcookie("auto_login", "", time()-3600);
if (!$target) $target = 'cpanel';
header("Location: inner.php?conf=$target");
exit;
}
}else{ // login failed or account locked
if ($use_cookie == 0){
header("Location: inner.php?conf=login&target=$target");
exit;
} else {// dont give an error to the user for login attempt from a cookie, just delete the cookie.
setcookie("auto_login", "", time()-3600);
}
}
}
// user is logged in and still trying to go the login page
if ($conf == "login" && $user) {
if (!$target) $conf = 'cpanel';
}
if ($conf) hitmeter($conf);
$o = mysql_fetch_object(mysql_query("select * from webpages where id='$conf'"));
if ($o){ // if this is the restricted page, verify login
if ($o->access_scope == "admin" && !$user) {
header("Location: inner.php?conf=login&target=$conf");
exit;
}
$title = strtoupper($o->title);
$counter = $o->counter;
$content = $o->content;
if ($o->content_type == 'static') {
$static = 1;
$subr = mysql_query("select * from menus where href='$conf'");
if (mysql_num_rows($subr)) {
$o = mysql_fetch_object($subr);
$menuid = $o->referer;
$subr = mysql_query("select * from menus where referer=$menuid order by zindex");
if (mysql_num_rows($subr)) { //see also
$seealso = "<div align='right'>See also: ";
while($o = mysql_fetch_object($subr)) {
$t = str_replace(" ", " ", $o->title);
$seealso .= "[ <a href='inner.php?conf=$o->href'>$t</a> ] ";
}
$seealso .= "</div>";
}
}
} else if ($o->content_type == 'url') {
$static = 2;
header("Location: $content");
} else if ($o->content_type == 'file') {
$static = 3;
header("Location: documents/$content");
} else {
$static = 0;
}
} else {
$static = 1;
$title = "<b id='title'>Oops !</b><br>";
$content = "The page is under construction, Please visit later on.";
}
//maintain logs
logAccess($user, $_SERVER['HTTP_REFERER'], $_SERVER['REQUEST_URI']);
?>
<html>
<head>
<meta name="Author" content="iiita">
<link rel="shortcut icon" href="favicon.ico">
<?php
$ttl = ucwords(strtolower($title));
require("stylesheet.php");
?>
<title><? echo setup('title') . ' [' . $ttl . ']'; ?></title>
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<meta name="keywords" content="ADA,IIIT,IIITA,Allahabad,MMishra,Scheme,Property,Uttar Pradesh,INDIA>
<meta name="description" content="allahabad development authority">
<LINK REL="SHORTCUT ICON" href="images/logo.ico">
<script language="javascript" src="code.js">
</script>
</head>
<body onload="hide_login();">
<form name="frmStatic" action="inner.php?conf=<?=$conf?>" method="post" enctype="multipart/form-data">
<div id="content">
<div id="greetings">
<?
echo "<marquee scrolldelay=200>" . setup('greeting') . "</marquee>";
?>
</div>
<div id="showdate">
<?
showdate();
?>
</div>
<div id="banner">
<?
include "banner.inc";
?>
</div>
<script language="javascript">
<!--
function land(ref, target) {
lowtarget = target.toLowerCase();
if (lowtarget == "_self") {
window.location = loc;
} else {
if (lowtarget == "_top") {
top.location = loc;
} else {
if (lowtarget == "_blank") {
window.open(loc);
} else {
if (lowtarget == "_parent") {
parent.location = loc;
} else {
parent.frames[target].location = loc;
};
}
}
}
}
function jump(menu) {
ref = menu.choice.options[menu.choice.selectedIndex].value;
splitc = ref.lastIndexOf("*");
target = "";
if (splitc != -1) {
loc = ref.substring(0,splitc);
target = ref.substring(splitc+1,1000);
} else {
loc = ref;
target = "_self";
};
if (ref != "") {
land(loc,target);
}
}
//-->
</script>
<div id="inner"> <!--This is the Inner Division to display body content from database-->
<?php
echo "<b id='title'>$title</b> (Hits so far: $counter)<br>";
if ($seealso) echo $seealso;
if ($static == 1) {
if ($hilite != "") echo hilite($content, $hilite);
else echo $content;
//if ($seealso) echo $seealso; //see also
if ($role == 'admin') {
echo "<div align='right'><hr>[
<a href='inner.php?conf=editpage&id=$conf'>Edit content</a>
]</div>";
}
} else {
include "$content";
}
?>
</div> <!--Inner division Ends-->
<div id="left">
<a href='/'>Home</a> | <a href='inner.php?conf=contact'>Contact</a><br>
<div id="menu">
<?
include "menus.inc";
?>
</div>
<div id="fixed_links">
<?
include "fixed_links.inc";
?>
</div>
</div>
<div id="footer">
<?
footer($user, $role, $conf)
?>
</div>
</div>
</form>
</body>
</html>