Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/mm/ada/
Upload File :
Current File : /var/www/html/mmishra/mm/ada/inner.php

<?
$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 = "";
$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;
}

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");
} else 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);
	echo 'c' . $user . $role . $sid;
  	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: inner.php?conf=$target");
    		}
  	} else { // login failed or account locked
    		if ($use_cookie == 0) {
    	  		header("Location: inner.php?conf=login&target=$target");
    		} else {// dont give an error to the user for login attempt from a cookie, just delete the cookie.
      			setcookie("auto_login", "", time()-3600);
    		}
  	}
} else {
	//echo 'b' . $user . $role;
}
// 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&nbsp;also:&nbsp;";
                		while($o = mysql_fetch_object($subr)) {
                        		$t = str_replace(" ", "&nbsp;", $o->title);
                        		$seealso .= "[&nbsp;<a href='inner.php?conf=$o->href'>$t</a>&nbsp;] ";
                		}
                		$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>
        <div id="search_site">
        <?  search_site(); ?>
        </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>