| Current Path : /var/www/html/mmishra/mm/ada/backup/backup/ |
| Current File : /var/www/html/mmishra/mm/ada/backup/backup/inner.php |
<?
$HTTP_SERVER_VARS['chk_home']=1;
require("header.php");
require("db.php");
require("html.php");
dbConnect();
require("auth.php");
$conf=$_REQUEST["conf"];
$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['iiita_auto_login'])){
//$cred = explode(" ", $iiita_auto_login);
$cred = explode(" ", $HTTP_SESSION_VARS['iiita_auto_login']);
$txtID = $cred[0];
$txtPWD = base64_decode($cred[1]);
$use_cookie = 1;
}
if (mysql_num_rows(mysql_query("select * from auth where s_id='$s_id'")) == 0) {
session_unset();
// session_destroy(); see corresponding line in index.php for explanation on commenting this
$HTTP_SESSION_VARS['user'] = "";
$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("iiita_auto_login", "", time()-3600);
header("Location: index.php");
exit;
//}else if ($use_cookie == 1 || isset($HTTP_POST_VARS['login'])){
}
if ($use_cookie == 1 || isset($_POST['login'])){
$txtID = $_POST["txtID"];
$txtPWD = $_POST["txtPWD"];
$chkRem = $_POST["chkRem"];
$ch = authenticate($txtID, $txtPWD);
if ($ch != "FAILURE" && $ch != "BLOCKED"){
$user = $txtID;
$s_id = $ch;
$ro = mysql_fetch_object(mysql_query("select auth from userinfo where user_id='$user'"));
$role = $ro->auth;
session_register("user", "s_id", "role");
if ($use_cookie == 0){
if ($chkRem) setcookie("iiita_auto_login", $txtID . " " . base64_encode($txtPWD), time()+31536000);
else setcookie("iiita_auto_login", "", time()-3600);
if ($target == "") $target = "cpanel"; // by default, successful login goes to my ada
header("Location: inner.php?conf=$target");
exit;
} else echo "test";
}else{ // login failed or account locked
if ($use_cookie == 0){
header("Location: inner.php?conf=login&target=$target&msg=$ch");
exit;
} else {// dont give an error to the user for login attempt from a cookie, just delete the cookie.
setcookie("iiita_auto_login", "", time()-3600);
}
}
}
// user is logged in and still trying to go the login page
if ($conf=="login" && $user != ""){
if ($target != "") $conf = $target; else $conf="cpanel";
}
$arr = mysql_fetch_array(mysql_query("select * from webpages where id='$conf'"));
if ($arr){
// if this is the restricted page, verify login
if ($arr["private"] == "y" && $user == ""){
header("Location: inner.php?conf=login&target=$conf");
exit;
}
$title = strtoupper($arr["title"]);
$content = $arr["content"];
if ($arr["static"] == 'y'){
$static = 1;
} else {
$static = 0;
}
$o = mysql_fetch_object(mysql_query("select * from sublinks where href like '%conf=$conf'"));
if ($o){
$subr = mysql_query("select * from sublinks where parent_id='$o->parent_id' and id <> '$o->id'");
$sl = mysql_num_rows($subr);
} else {
$sl = 0; // we are NOT here because of a sublink on main page
}
} else {
$static = 1;
$title = "ERROR";
$content = "No content available.";
}
//maintain logs
logAccess($user, $_SERVER['HTTP_REFERER'], $_SERVER['REQUEST_URI']);
?>
<html>
<head>
<meta name="Author" content="iiita">
<link rel="shortcut icon" href="favicon.ico">
<?
$ttl = ucwords(strtolower($title));
require("stylesheet.php");
?>
<!--This is the official website of Allahabad Development Authority-->
<title>ADA-<?=$ttl?></title>
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<meta name="keywords" content="ADA,IIIT,IIITA,Allahabad,information>
<meta name="description" content="allahabad development authority">
<LINK REL="SHORTCUT ICON" href="images/logo.ico">
<script language="javascript" src="code.js">
</script>
</head>
<!--Layout-->
<body onload="hide_login();">
<div id="content">
<div id="greetings">
<?
greetings();
?>
</div>
<div id="top_date">
<?
showdate()
?>
</div>
<div id="banner">
<?
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-->
<?
if ($sl > 0) { // we can display aditional information
echo "<div align='right'>See also: ";
$c = 1;
while($o = mysql_fetch_object($subr)) {
$t = str_replace(" ", " ", $o->title);
echo "<a href='$o->href'>$t</a>";
if ($c++ < $sl) echo " | ";
}
echo "</div>\n\n";
}
echo "<h1>$title</h1>";
if ($static) {
if ($hilite != "") echo hilite($content, $hilite);
else echo $content;
if ($sl > 0) { // we can display aditional information
echo "<br><div align='right'>See also: ";
$c = 1;
mysql_data_seek($subr, 0);
while($o = mysql_fetch_object($subr)) {
$t = str_replace(" ", " ", $o->title);
echo "<a href='$o->href'>$t</a>";
if ($c++ < $sl) echo " | ";
}
echo "</div>\n";
}
} else include($content);
if ($user) {
echo "<div align='right'><br>[
<a href='inner.php?conf=editstat&id=$conf'>Edit content</a> ]
<br></div>";
}
?>
</div> <!--Inner division Ends-->
<div id="left">
<a href='/'>Home</a><br>
<div id ="menu">
<?
menu()
?>
</div>
<div id="link_above_login_box">
<?
link_above_login_box();
?>
</div>
<div id ="leftcorner">
<?
leftcorner()
?>
</div>
</div>
<div id="footer">
<?
footer($user)
?>
</div>
</div> <!--Content Division Ends-->
</body>
</html>