| Current Path : /var/www/html/mmishra/indem/iiita/ |
| Current File : /var/www/html/mmishra/indem/iiita/inner.php.bak |
<?
$HTTP_SERVER_VARS['chk_home']=1;
require("html.php");
require("functions.php");
dbConnect();
$conf=$_REQUEST["conf"];
if (!$conf) $conf = 'search';
$target=$_REQUEST["target"];
$txtID=$_POST['txtID'];
$txtPWD=$_POST['txtPWD'];
$user = "";
$s_id = "";
$role = "";
$cid = "";
$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;
}
//deactivate idle session > 20 min.
//mysql_query("delete from log where last_activity>NOW()-1200");
//deactivate idle session > 20 min.
//if (!mysql_num_rows(mysql_query("select * from auth where s_id='$s_id'"))) {
// session_unset();
// $user = "";
// session_start();
//}
// update last activity
//if ($s_id) mysql_query("update auth set last_activity=NOW() where s_id='$s_id'");
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';
}
$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);
$content = $o->content;
if ($o->content_type == 'Static') {
$static = 1;
$q = mysql_fetch_object(mysql_query("select * from sublinks where href like '%conf=$conf'"));
if ($q) {
$subr = mysql_query("select * from sublinks where parent_id='$q->parent_id' and id <> '$q->id'");
$sl = mysql_num_rows($subr);
if ($sl > 0) { //see also
$str = "<div align='right'>See also: ";
while($o = mysql_fetch_object($subr)) {
$c++;
$t = str_replace(" ", " ", $o->title);
$str .= "<a href='$o->href'>$t</a>";
if ($c < $sl) $str .= ", ";
}
$str .= "</div>";
}
} else {
$sl = 0; // we are NOT here because of a sublink on main page
}
} else if ($o->content_type == 'URL') {
$static = 2;
} 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>ADA-<?=$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">
<?
greetings();
?>
</div>
<div id="showdate">
<?
showdate();
?>
</div>
<div id="banner">
<?
include "banner.inc";//banner();
?>
</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><br>";
if ($sl > 0) echo $str;
if ($static == 1) {
if ($hilite != "") echo hilite($content, $hilite);
else echo $content;
if ($sl > 0) echo $str; //see also
if ($role == 'Admin') {
echo "<div align='right'>[
<a href='inner.php?conf=editstat&id=$conf'>Edit content</a>
]</div>";
}
} else if ($static == 2) {
echo "Please visit this link $content";
} 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 id="search_site">
<?
search_site();
?>
</div>-->
</div>
<div id="footer">
<?
footer($user, $role, $conf)
?>
</div>
</div>
</form>
</body>
</html>