Hi, Guys…I got struck in middle of my project…Here am going to give the scenario,pls provide me the resolution to sort out.
At the time of login the user should ask to select his case by a pop up window(using java script,php,mysql).This should be given by the admin,whereas here the admin also getting same pop up window which he is not supposed to.
I want to disable the pop up window in admin space,only it should be available during user session.
regards,
Nandha.
//Code//
<?
include ‘config/connect.php’;
session_start();
ob_start();
$userper_caseid=$_SESSION[‘userper_caseid’];
$uname=$_SESSION[‘user_name’];
$Submit=$_POST[‘Submit’];
if($Submit==“Submit”)
{
$updatecase2=mysql_query(“update users_permission set user_view_status=‘0’ where username=‘$uname’”);
//$id=$_REQUEST[‘id’];
$user_view_status=$_POST[‘user_view_status’];
$coid=count($user_view_status);
//echo $coid;
//exit;
if($coid>0)
{
//echo "hai";
//exit;
for($i=0;$i<count($user_view_status);$i++)
{
$user_case=$user_view_status[$i];
$updatecase=mysql_query("update users_permission set user_view_status='1' where id='$user_case' and username='$uname'");
$updatecase1=mysql_query("update users_permission set user_view_status='0' where id!='$user_case' and username='$uname'");
//echo $uname;
//exit;
}
}
//echo "hey";
//exit;
//echo $updatecase2;
//exit;
header("Location:clientwin.php");
}
//$a=$_SESSION[‘id’];
//$selcaseids=“select * from users_permission where id=‘id’”;
//$secaid=mysql_query(selcaseids);
//$sefetca=mysql_fetch_assoc(secaid);
//$casel=$sefetca[‘userper_caseid’];
?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=“http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=“Content-Type” content=“text/html; charset=utf-8” />
<title>Jon Duncan-DMS</title>
<link rel=“stylesheet” type=“text/css” href=“css/menu.css” />
<link rel=“stylesheet” type=“text/css” href=“css/accordion_style.css” />
<link rel=“stylesheet” type=“text/css” href=“js/style.css” />
<!–[if lte IE 7]>
<style type=“text/css”>
html .jqueryslidemenu{height: 1%;} /Holly Hack for IE7 and below/
</style>
<![endif]–>
<style type=“text/css”>
<!–
@import url(“css/style.css”);
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-image: url(images/body_bg.jpg);
background-repeat: repeat-x;
background-color: #FCFDFF;
}
–>
</style>
<style type=“text/css”>
<!–
@import url(“css/style.css”);
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-image: url(images/body_bg.jpg);
background-repeat: repeat-x;
}
.style1 {font-family: Arial, Helvetica, sans-serif}
.style2 { font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
}
–>
</style>
</head>
<body>
<div class=“maincontainer”>
<?php //include(‘includes/mainheader.php’);?>
<div class=“mainconten”>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top"> </td>
</tr>
<tr>
<td valign="top"><div align="right"><a href="javascript:(clientwin.close()">close</a></div></td>
</tr>
<tr>
<td align="center" valign="top"><div align="center">
<form name="" action="" method="post">
<p> </p>
<table width="361" height="140" class="gridtable">
<tr>
<td width=“91” class=“header”>Select Case : </td>
<td width=“258”>
<label>
<select name=“user_view_status” id=“user_view_status” multiple=“multiple” style=“width:100px;”>
<option value="">Select Cases</option>
<?php
//$id=$_POST['id'];
$selcaseids="select * from users_permission";
$secaid=mysql_query($selcaseids);
while($sefetca=mysql_fetch_assoc($secaid))
{
$id=$sefetca['id'];
$casel=$sefetca['userper_caseid'];
?>
<option value="<?php echo $id;?>" selected="selected" ><?php echo $casel;?></option>
<?php } ?>
</select>
</label>
</td></tr>
<tr>
<td></td>
<td>
<p>
<label>
<input type=“submit” name=“Submit” id=“Submit” value=“Submit” />
</label>
</p>
</td>
</tr>
</table>
<p> </p>
<p> </p>
</form>
</div></td>
</tr>
<tr>
<td valign="top"> </td>
</tr>
<tr>
<td valign="top"> </td>
</tr>
<tr>
<td valign="top"> </td>
</tr>
</table>
</div>
<div id=“footer”>
<table width=“80%” border=“0” cellspacing=“0” cellpadding=“0”>
<tr>
<td width=“33%” align=“right” valign=“top”> </td>
<td ><? //include(‘designs/footer.php’);?>
</td>
</tr>
</table>
</div>
</div>
</body>
</html>
INDEX.PHP
<?php
error_reporting(E_ALL && E_PARSE);
session_start();
ob_start();
include ‘classes/user.class.php’;
$login=$_POST[‘log’];
if(isset($_POST[“log”]) || isset($_POST[“log_x”]))
{
$user_name=($_POST['user_name']);
$password=($_POST['password']);
$selectQuery="SELECT * FROM dms_usermaster WHERE user_name='".$user_name."' and password='".$password."' and status='active'";
$resultSet=mysql_query($selectQuery)or die ('I cannot connect to the selectQuery: ' . mysql_error());
$numRows=mysql_num_rows($resultSet);
$rowSet=mysql_fetch_assoc($resultSet);
$rowSet['user_name'];
// $usertype=$rowSet['user_name'];
$u_role=$rowSet['u_role'];
// $selectQuery1="SELECT * FROM dms_role_type WHERE dms_role_type_master='".$user_name."' and password='".$password."' and status='active'";
if($numRows>0)
{
//$_SESSION['uname']=$uname;
$_SESSION['password']= $rowSet['password'];
$_SESSION['user_name']= $rowSet['user_name'];
$_SESSION['u_role']= $rowSet['u_role'];
header("location: home.php");
}
/* if($numRows>0 && $u_role=="Stafff")
{
//$_SESSION['uname']=$uname;
$_SESSION['password']= $rowSet['password'];
$_SESSION['user_name']= $rowSet['user_name'];
$_SESSION['u_role']= $rowSet['u_role'];
header("location: userhome.php");
}*/
else{
$errorMSG="Username and Password do not match. Please try again.";
}
}
?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=“http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=“Content-Type” content=“text/html; charset=utf-8” />
<title>Jon Duncan-DMS</title>
<style type=“text/css”>
<!–
@import url(“index_files/layout.css”);
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
background-image: url(index_files/bg2.jpg);
background-repeat: repeat;
}
–>
</style>
<script type=“text/javascript”>
<!–
function myPopup2() {
window.open( “clientwin.php”, “myWindow”,
“status = 1, height = 300, width = 300, resizable = 0” )
}
//–>
</script>
<script>
function PopupCenter(pageURL, title,w,h) {
var left = (screen.width/2)-(w/2);
var top = (screen.height/2)-(h/2);
var targetWin = window.open (pageURL, title, ‘toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=’+w+‘, height=’+h+‘, top=’+top+‘, left=’+left);
}
</script>
<script type=“text/javascript”>
function checkForm(form1) {
if(document.form1.user_name.value=="")
{
alert("Please Enter The UserName");
document.form1.user_name.select()
return false;
}
if(document.form1.password.value=="")
{
alert("Please Enter The Password");
document.form1.password.select()
return false;
}
}
</script>
</head>
<body>
<div align=“center” id=“loginarea”>
<div class=“loginboxe”>
<form id=“form1” name=“form1” method=“post” action=“” onsubmit=“return checkForm(form1)”>
<table width=“313” border=“0” cellspacing=“0” cellpadding=“0”>
<tr>
<td align="left" valign="middle"><?php if($errorMSG!="")
{
?><?php echo "Username and Password incorrect"; ?>
<?php } ?> </td>
</tr>
<tr>
<td align="left" valign="middle">User Name :
<input name="user_name" type="text" class="homelog" id="user_name" />
<script>document.getElementById('user_name').focus()</script>
</td>
</tr>
<tr>
<td align="left" valign="middle">Password :
<input name="password" type="password" class="homelog" id="password" /></td>
</tr>
<tr>
<td align="center" valign="middle"><div align="center">
<input name="log" type="image" id="log" value="Submit" src="index_files/login.png" onclick="myPopup2()"/>
</div></td>
</tr>
</table>
<p><a href=“javascript:void(0);” onclick=“PopupCenter(‘forgot.php’, ‘myPop1’,400,200);”>
Forgot Password</a></p>
</form>
</div>
</div>
</body>
</html>