| Current Path : /var/www/html/mmishra/indem/old/indem/iiita/ |
| Current File : /var/www/html/mmishra/indem/old/indem/iiita/index.php |
<?php
require("functions.php");
dbConnect();
$conf = $_REQUEST["conf"];
//if (!$conf) $conf = 'search';
$target = $_REQUEST["target"];
$txtID = $_POST['txtID'];
$txtPWD = $_POST['txtPWD'];
$user = "";
$sid = "";
$role = "";
$use_cookie = 0;
session_start();
if (isset($HTTP_SESSION_VARS['user'])){
$user = $HTTP_SESSION_VARS['user'];
$sid = $HTTP_SESSION_VARS['sid'];
} 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 sid='$sid'"))) {
// session_unset();
// $user = "";
// session_start();
//}
// update last activity
//if ($sid) mysql_query("update auth set last_activity=NOW() where sid='$sid'");
if (isset($_REQUEST['logout'])){
mysql_query("delete from auth where sid='$sid'");
session_unset();
session_destroy();
$HTTP_SESSION_VARS['user'] = ""; $HTTP_SESSION_VARS['sid'] = ""; $HTTP_SESSION_VARS['role'] = "";
$user = ""; $sid = ""; $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);
$sid = uniq_sid($txtID, $txtPWD);
if ($role == "admin" || $role == "User"){
$user = $txtID;
session_register("user", "sid", "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: index.php?conf=$target");
exit;
}
}else{ // login failed or account locked
if ($use_cookie == 0){
header("Location: index.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';
}
$rs = mysql_query("select * from webpages where id='$conf'");
$o = mysql_fetch_object($rs);
if ($o) { // if this is the restricted page, verify login
if ($o->access_scope == "admin" && !$user) {
header("Location: index.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 = setup('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']);
$title = 'IIITA-' . ucwords(strtolower($title));
?>
<html>
<head>
<title><?=$title?></title>
<meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<meta name="keywords" content="IIITA,Allahabad,MMishra,Recruitment,Information,BTech,MTech,MBA,MS,INDIA">
<META HTTP-EQUIV=Rrefresh CONTENT=120>
<META HTTP-EQUIV=Pragma CONTENT=no-cache>
<META HTTP-EQUIV=Cache-Control CONTENT=no-cache>
<script language="text/JavaScript" src="functions.js"></script>
<script language="JavaScript" src="JSCookMenu.js"></script>
<script language="JavaScript" src="theme.js"></script>
<script language="javascript" src="code.js"></script>
<script type="text/javascript" src="rss/ajax.js"></script>
<script type="text/javascript" src="rss/rss.js"></script>
<link rel="SHORTCUT ICON" href="images/logo.ico">
<link rel='stylesheet' type='text/css' href='style.css'>
<link rel='stylesheet' type='text/css' href='theme.css'>
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" style="background: url(images/logo2.jpg) no-repeat; background-position: top left">
<form name="frmStatic" action="index.php?conf=<?=$conf?>" method="post" enctype="multipart/form-data">
<center>
<!--
onload="javascript: window.open('popup.php', 'Cheers Up...', 'left=220,top=50,width=797,height=490,scrollbars=no')">
-->
<?php include 'ajax.inc'; ?>
<?php include 'tooltips.inc'; ?>
<marquee scrolldelay=200 style="font-family: verdana; font-size: 10px">
<?php echo showdate() . " ". setup('greeting'); ?>
</marquee>
<table width="780" border="0" align="center" cellpadding="0" cellspacing="0">
<tr height="20" valign="bottom" style="background: url(images/t1-4.gif)">
<td rowspan="2" align="center"> <?php gallery(); ?> </td>
<td style="background: url(images/t1-2.jpg) no-repeat" width="157" class="hmenu"> </td>
<td nowrap style="background: url(images/t1-4.gif)" width="393" class="hmenu"> <?php include "topmenus.inc"; ?> </td>
</tr>
<tr height="100">
<td colspan="2" style="background: url(images/t1-6.jpg) no-repeat; border-right: solid #333399 1px" align="center">
<?php include "banner.inc"; ?>
</td>
</tr>
<tr valign="top">
<td rowspan="2" style="padding: 10px; border-left:solid 1px orange; background: url(images/t2-1.gif) no-repeat">
<div style="color:white">
<a href="index.php?conf=contact">contact@iiita.ac.in</a><br>
Deoghat, Jhalwa<br>Allahabad, UP<br>India-211012
</div>
<br>
<dir style="left:0px;margin-top:30px;">
<?php search(); ?>
<br><br>
<?php include "usrmenus.inc"; ?>
<br><br>
<?php include "stdmenus.inc"; ?>
</dir> </td>
<td colspan="2" align="center" style="background: url(images/t2-1a.gif) repeat-x; padding-bottom:5px; color:white;" width="545" height="21">
A center of excellence in IT, established by Ministry of HRD, Govt. of India
</td>
</tr>
<tr valign="top" height="250"><!--main page -->
<td colspan="2" style="background: url(images/logo1.jpg) no-repeat" width="545">
<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">
<?php
if (!$conf) {
if (!file_exists("introduction.inc")) touch ("introduction.inc");
include "introduction.inc";
if (!file_exists("notices.inc")) touch ("notices.inc");
echo "<br><b>Notification</b><br>";
include "notices.inc";
} else {
echo "<b>$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='?conf=editpage&id=$conf'>Edit content</a> ]</div>";
}
} else if ($static == 2) {
echo "Please visit this link $content";
} else {
include "$content";
}
}
?>
</div>
</td>
</tr>
<tr height="20">
<td colspan="3" align="center" style="border-left: solid orange 1px">
<b>News</b>
<marquee direction="left" scrolldelay="1" scrollamount="1">
<?php include "news.inc"; ?>
</marquee>
</td>
</tr>
<tr height='20' valign="bottom">
<td colspan="2" nowrap style="background: url(images/t5-1.gif) no-repeat; padding-left:10px; padding-bottom:5px; border-top: solid blue 1px" class="bottom">
<?php include "botmenus.inc"; ?>
</td><td nowrap align='right' style="padding-bottom:5px; padding-right:5px; border-top:solid blue 1px; border-right:solid blue 1px">
<?php footer($user, $role, $conf); ?>
</td>
</tr></table>
<font size=-2><?php echo setup('footer'); ?></font>
</center>
</form>
</body>
</html>