By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,466 Members | 1,176 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,466 IT Pros & Developers. It's quick & easy.

How to do logout alert message ?

P: 52
How to do logout alert message when i press on the logout image

[PHP]<a href="../logout.php" target="_top" onClick="return logout()" "MM_nbGroup('down','group1','logout','',1)""MM_nbG roup('down','group1','logout','../button_images/logout_button_down.png',1)" onMouseOver="MM_nbGroup('over','logout','../button_images/logout_button_down.png','../button_images/logout_button_down.png',1)" onMouseOut="MM_nbGroup('out')" ><img name="logout" src="../button_images/logout_button_up.png" border="0" alt="Logout" onLoad="" > </a>
[/PHP]
[PHP]function logout()
{
var answer = confirm ("Do you really want to logout ?")
if (answer)
{
return true;
}
else
{
return false;
}
}[/PHP]

My onclick= "return logout()" on <a herf> gt problem as it cant be worked??
Wt can i do in order to have message when i press on the logout image.
Jul 24 '07 #1
Share this Question
Share on Google+
10 Replies


dafodil
100+
P: 392
Put a semicolon after the logout()
Try this:
onclick= "return logout();"
Jul 24 '07 #2

P: 52
Put a semicolon after the logout()
Try this:
onclick= "return logout();"
Still cannot
The function logout() did not work as it never pop out the confirm message
Jul 24 '07 #3

P: 22
You could always put it on your logout.php and have it confirm, before the initial php logout.
And do a "<body onload="
Example:
[php]
<?php
echo "<script>";
echo "<body onload=confirm_logout();>";
//Then logout would go here///
?>
[/php]
That should work just as good.
As doing it in the link as it does virtually the same as exit; if you don't confirm.

~Tyler
Jul 24 '07 #4

dafodil
100+
P: 392
I saw you put it inside the php code... Are you sure you put that code inside the <script language="javascript"> ..... </script>

Can I see whole your code for that
Jul 24 '07 #5

P: 52
I saw you put it inside the php code... Are you sure you put that code inside the <script language="javascript"> ..... </script>

Can I see whole your code for that
[PHP]
<?php session_start(); ?>


<?php require_once('../Connections/conn.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "edit_profile")) {
$updateSQL = sprintf("UPDATE user_profile SET id_no=%s, password=%s, access_type=%s, full_name=%s, email=%s, department=%s, contact_no=%s, hp_no=%s WHERE user_id=%s",
GetSQLValueString($_POST['id_no'], "int"),
GetSQLValueString($_POST['password'], "text"),
GetSQLValueString($_POST['access_type'], "text"),
GetSQLValueString($_POST['full_name'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['department'], "text"),
GetSQLValueString($_POST['contact_no'], "double"),
GetSQLValueString($_POST['hp_no'], "double"),
GetSQLValueString($_POST['user_id'], "text"));

mysql_select_db($database_conn, $conn);
$Result1 = mysql_query($updateSQL, $conn) or die(mysql_error());

$updateGoTo = "../admin/profile_updated_saved.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}

$colname_edit_profile = "1";
if (isset($_SESSION['MM_Username'])) {
$colname_edit_profile = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']);
}
mysql_select_db($database_conn, $conn);
$query_edit_profile = sprintf("SELECT * FROM user_profile WHERE user_id = '%s'", $colname_edit_profile);
$edit_profile = mysql_query($query_edit_profile, $conn) or die(mysql_error());
$row_edit_profile = mysql_fetch_assoc($edit_profile);
$totalRows_edit_profile = mysql_num_rows($edit_profile);
?>
<?php
$access_type = $_SESSION['MM_UserGroup'];
?>

<html>
<head>
<script language="javascript" type="text/javascript">
function logout()
{
var answer = confirm ("Do you really want to logout ?")
if (answer)
{
return true;
}
else
{
return false;
}
}
</script>
<title>QUALTY MANAGEMENT SYSTEM</title>
<meta http-equiv="Content-Type" content="text/html;">
<!--Fireworks MX 2004 Dreamweaver MX 2004 target. Created Wed Sep 13 14:53:43 GMT+0800 (Malay Peninsula Standard Time) 2006-->
<link href="../css/css.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
var i,p,q,nm,test,num,min,max,errors='',args=MM_valida teForm.arguments;
for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
if (val) { nm=val.name; if ((val=val.value)!="") {
if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
} else if (test!='R') { num = parseFloat(val);
if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
min=test.substring(8,p); max=test.substring(p+1);
if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
} } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
} if (errors) alert('The following error(s) occurred:\n'+errors);
document.MM_returnValue = (errors == '');
}

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_nbGroup(event, grpName) { //v6.0
var i,img,nbArr,args=MM_nbGroup.arguments;
if (event == "init" && args.length > 2) {
if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
nbArr[nbArr.length] = img;
for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = img.MM_dn = args[i+1];
nbArr[nbArr.length] = img;
} }
} else if (event == "over") {
document.MM_nbOver = nbArr = new Array();
for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
nbArr[nbArr.length] = img;
}
} else if (event == "out" ) {
for (i=0; i < document.MM_nbOver.length; i++) {
img = document.MM_nbOver[i]; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
} else if (event == "down") {
nbArr = document[grpName];
if (nbArr)
for (i=0; i < nbArr.length; i++) { img=nbArr[i]; img.src = img.MM_up; img.MM_dn = 0; }
document[grpName] = nbArr = new Array();
for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args[i])) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
nbArr[nbArr.length] = img;
} }
}
//-->
</script>
</head>
<body bgcolor="#ffffff" onLoad="MM_preloadImages('../button_images/Login_button_down.png','../button_images/Home_button_down.png','../button_images/Edit_Profile_button_down.png','../button_images/Staff_Record_button_down.png','../button_images/Feedback_button_down.png','../button_images/Change_Request_button_down.png','../button_images/logout_button_down.png')">
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
<!-- fwtable fwsrc="add_staff_page_layout.png" fwbase="add_staff.gif" fwstyle="Dreamweaver" fwdocid = "1867439519" fwnested="0" -->
<tr>
<td><img src="../image_add_staff/spacer.gif" width="137" height="1" border="0" alt=""></td>
<td><img src="../image_add_staff/spacer.gif" width="52" height="1" border="0" alt=""></td>
<td><img src="../image_add_staff/spacer.gif" width="237" height="1" border="0" alt=""></td>
<td><img src="../image_add_staff/spacer.gif" width="70" height="1" border="0" alt=""></td>
<td><img src="../image_add_staff/spacer.gif" width="70" height="1" border="0" alt=""></td>
<td><img src="../image_add_staff/spacer.gif" width="70" height="1" border="0" alt=""></td>
<td><img src="../image_add_staff/spacer.gif" width="70" height="1" border="0" alt=""></td>
<td><img src="../image_add_staff/spacer.gif" width="70" height="1" border="0" alt=""></td>
<td><img src="../image_add_staff/spacer.gif" width="24" height="1" border="0" alt=""></td>
<td><img src="../image_add_staff/spacer.gif" width="1" height="1" border="0" alt=""></td>
</tr>

<tr>
<td colspan="2"><a href="../main.php"><img name="layout_r1_c1" src="../images/layout_r1_c1.gif" width="189" height="80" border="0" alt=""></a></td>
<td height="80" colspan="7" valign="bottom" background="../images/bg.gif"><table width="611" border="0" cellspacing="0" cellpadding="0">
<tr valign="bottom">
<td width="200"><span class="white_text"> <span class="login_title_text"> </span></span></td>
<td width="200">&nbsp;</td>
<td width="211" align="right" class="white_text" >
<?php if(isset($_SESSION['MM_Username']))
{
echo "Welcome, ";
?>
<span class="login_title_text">
<?php
echo $_SESSION['MM_Username'];
echo "!";
}
?>
</span> </td>
</tr>
</table></td>
<td><img src="../images/spacer.gif" width="1" height="80" border="0" alt=""></td>
</tr>
<tr>
<td colspan="9"><span class="user_id"><?php
$hourdiff = "8"; // hours difference between server time and local time
$timeadjust = ($hourdiff * 3600);
$date = date("l, d F Y h:i a",time() + $timeadjust);
print ("$date");
?></span>&nbsp;</td>
<td><img src="../image_add_staff/spacer.gif" width="1" height="8" border="0" alt=""></td>
</tr>
<tr>
<td height="50" colspan="3"><table width="426" height="50" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="138"><span class="title"><a href="../main.php"><strong>
<?php if(isset($_SESSION['MM_Username']))
{
?>
</strong></a><img src="../images/Editptofile.jpg" width="150" height="50">
<?php
}
?>
</span></td>



<td class="title">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table></td>
<td><img name="add_staff_r3_c4" src="../image_add_staff/add_staff_r3_c4.gif" width="70" height="50" border="0" alt=""></td>
<td><img name="add_staff_r3_c5" src="../image_add_staff/add_staff_r3_c5.gif" width="70" height="50" border="0" alt=""></td>
<td><img name="add_staff_r3_c6" src="../image_add_staff/add_staff_r3_c6.gif" width="70" height="50" border="0" alt=""></td>
<td><img name="add_staff_r3_c7" src="../image_add_staff/add_staff_r3_c7.gif" width="70" height="50" border="0" alt=""></td>
<td><img name="add_staff_r3_c8" src="../image_add_staff/add_staff_r3_c8.gif" width="70" height="50" border="0" alt=""></td>
<td><img name="add_staff_r3_c9" src="../image_add_staff/add_staff_r3_c9.gif" width="24" height="50" border="0" alt=""></td>
<td><img src="../image_add_staff/spacer.gif" width="1" height="50" border="0" alt=""></td>
</tr>
<tr>
<td width="137" height="90"><img src="../image_add_staff/add_staff2.jpg" width="137" height="90"></td>
<td height="432" colspan="8" rowspan="3" valign="top">
<br>
<br> <a href="../index.php"><strong><span class="white_text">
</span></strong></a><a href="../main.php"><strong>
<?php if(isset($_SESSION['MM_Username']))
{
?>
</strong></a><br>
<form action="<?php echo $editFormAction; ?>" method="POST" name="edit_profile" id="edit_profile" onSubmit="MM_validateForm('full_name','','R','emai l','','RisEmail','contact_no','','RisNum','hp_no', '','RisNum','password','','R');return document.MM_returnValue">
<table width="663" border="1" cellpadding="0" cellspacing="0" bordercolor="#EFEFEF">
<tr>
<td width="100" bgcolor="#D6D6D6" class="medium_body_text_bold"><br>
Department:</td>
<td valign="middle" bgcolor="#E1E1E1" class="medium_body_text"><br>
<span class="medium_title_bold"><?php echo $row_edit_profile['department']; ?></span> <input name="department" type="hidden" id="department" value="<?php echo $row_edit_profile['department']; ?>"></td>
</tr>
<tr>
<td width="100" bgcolor="#D6D6D6" class="medium_body_text_bold"><br>
User Id: </td>
<td valign="middle" bgcolor="#E1E1E1" class="medium_body_text"><br>
<span class="medium_title_bold"><?php echo $row_edit_profile['user_id']; ?></span> <input name="user_id" type="hidden" id="user_id" value="<?php echo $row_edit_profile['user_id']; ?>"></td>
</tr>
<tr>
<td width="100" bgcolor="#D6D6D6" class="medium_body_text_bold"><br>
Password:</td>
<td valign="middle" bgcolor="#E1E1E1" class="medium_body_text">
<br>
<input name="password" type="password" id="password" value="<?php echo $row_edit_profile['password']; ?>" >
<span class="dot">*</span></td>
</tr>
<tr>
<td width="100" bgcolor="#D6D6D6" class="medium_body_text_bold"><br>
Access Type: </td>
<td valign="middle" bgcolor="#E1E1E1" class="medium_body_text"><br>
<span class="medium_title_bold"><?php echo $row_edit_profile['access_type']; ?></span> <input name="access_type" type="hidden" id="access_type" value="<?php echo $row_edit_profile['access_type']; ?>"></td>
</tr>
<tr>
<td width="100" bgcolor="#D6D6D6" class="medium_body_text_bold"><br>
Full Name: </td>
<td valign="middle" bgcolor="#E1E1E1" class="medium_body_text">
<br>
<input name="full_name" type="text" id="full_name" value="<?php echo $row_edit_profile['full_name']; ?>" maxlength="30">
<span class="dot">*</span></td>
</tr>
<tr>
<td width="100" bgcolor="#D6D6D6" class="medium_body_text_bold"><br>
Email:</td>
<td valign="middle" bgcolor="#E1E1E1" class="medium_body_text">
<br>
<input name="email" type="text" id="email" value="<?php echo $row_edit_profile['email']; ?>" maxlength="40">
<span class="dot">*</span></td>
</tr>
<tr>
<td width="100" bgcolor="#D6D6D6" class="medium_body_text_bold"><br>
Office no: </td>
<td valign="middle" bgcolor="#E1E1E1" class="medium_body_text">
<br>
<input name="contact_no" type="text" id="contact_no" value="<?php echo $row_edit_profile['contact_no']; ?>" maxlength="8">
<span class="dot">*</span></td>
</tr>
<tr>
<td width="100" bgcolor="#D6D6D6" class="medium_body_text_bold"><br>
Handphone no: </td>
<td valign="middle" bgcolor="#E1E1E1" class="medium_body_text">
<br>
<input name="hp_no" type="text" id="hp_no" value="<?php echo $row_edit_profile['hp_no']; ?>" maxlength="8">
<span class="dot">*</span></td>
</tr>
<tr>
<td width="100" bgcolor="#D6D6D6"></td>
<td valign="middle" bgcolor="#E1E1E1">
<input name="id_no" type="hidden" id="id_no3" value="<?php echo $row_edit_profile['id_no']; ?>">
<br>
<input type="submit" name="Submit" value="Save"> </td>
</tr>
</table>
<input type="hidden" name="MM_update" value="edit_profile">
</form>
<?php
}
?> <br> </td>
<td><img src="../image_add_staff/spacer.gif" width="1" height="90" border="0" alt=""></td>
</tr>
<tr>
<td width="137" height="309" valign="top"><table width="137" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<?php if(!isset($_SESSION['MM_Username']))
{
?> <a href="../index.php" target="_top" onClick="MM_nbGroup('down','group1','Login','../button_images/Login_button_down.png',1)" onMouseOver="MM_nbGroup('over','Login','../button_images/Login_button_down.png','../button_images/Login_button_down.png',1)" onMouseOut="MM_nbGroup('out')"><img src="../button_images/Login_button_up.png" alt="Login" name="Login" width="103" height="23" border="0" onload=""></a>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td></td>
</tr>
</table>
<?php
}
?></td>
</tr>
<tr>
<td>
<?php if(isset($_SESSION['MM_Username']))
{
?> <a href="../main.php" target="_top" onClick="MM_nbGroup('down','group1','Home','../button_images/Home_button_down.png',1)" onMouseOver="MM_nbGroup('over','Home','../button_images/Home_button_down.png','../button_images/Home_button_down.png',1)" onMouseOut="MM_nbGroup('out')"><img name="Home" src="../button_images/Home_button_up.png" border="0" alt="Home" onLoad=""></a><a href="../main.php"></a>

<?php
}
?> </td>
</tr>
<tr>
<td>
<?php if(isset($_SESSION['MM_Username']))
{
?> <a href="edit_profile.php" target="_top" onClick="MM_nbGroup('down','group1','EditProfile', '../button_images/Edit_Profile_button_down.png',1)" onMouseOver="MM_nbGroup('over','EditProfile','../button_images/Edit_Profile_button_down.png','../button_images/Edit_Profile_button_down.png',1)" onMouseOut="MM_nbGroup('out')"><img name="EditProfile" src="../button_images/Edit_Profile_button_up.png" border="0" alt="Edit Profile" onLoad=""></a>
<?php
}
?> </td>
</tr>
<tr>
<td>
<?php if(isset($_SESSION['MM_Username']))
{
?> <a href="../view_records.php" target="_top" onClick="MM_nbGroup('down','group1','ChangeRequest ','../button_images/Change_Request_button_down.png',1)" onMouseOver="MM_nbGroup('over','ChangeRequest','../button_images/Change_Request_button_down.png','../button_images/Change_Request_button_down.png',1)" onMouseOut="MM_nbGroup('out')"><img name="ChangeRequest" src="../button_images/Change_Request_button_up.png" border="0" alt="Change Request" onLoad=""></a>
<?php
}
?></td>
</tr>
<tr>
<td align="left">
<?php if ($access_type == "Admin")
{
?> <a href="../admin/view_staff_record.php" target="_top" onClick= "MM_nbGroup('down','group1','StaffRecord','../button_images/Staff_Record_button_down.png',1)" onMouseOver="MM_nbGroup('over','StaffRecord','../button_images/Staff_Record_button_down.png','../button_images/Staff_Record_button_down.png',1)" onMouseOut="MM_nbGroup('out')"><img name="StaffRecord" src="../button_images/Staff_Record_button_up.png" border="0" alt="Staff Record" onLoad=""></a>
<?php
}
?> </td>
</tr>
<tr>
<td align="left"> <?php if ($access_type == "Staff" || $access_type == "super_user")
{
?> <a href="feedback.php" target="_top" onClick="MM_nbGroup('down','group1','FeedBack','../button_images/Feedback_button_down.png',1)" onMouseOver="MM_nbGroup('over','FeedBack','../button_images/Feedback_button_down.png','../button_images/Feedback_button_down.png',1)" onMouseOut="MM_nbGroup('out')"><img name="FeedBack" src="../button_images/Feedback_button_up.png" border="0" alt="FeedBack" onLoad=""></a>
<?php
}
?> </td>
</tr>
<tr>
<td><?php if(isset($_SESSION['MM_Username']))
{
?>
<a href="../logout.php" target="_top" onClick="return logout();""MM_nbGroup('down','group1','logout','../button_images/logout_button_down.png',1)" onMouseOver="MM_nbGroup('over','logout','../button_images/logout_button_down.png','../button_images/logout_button_down.png',1)" onMouseOut="MM_nbGroup('out')"><img name="logout" src="../button_images/logout_button_up.png" border="0" alt="Logout" onLoad=""></a>

<?php
}
?></td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
</table>
<br></td>
<td><img src="../image_add_staff/spacer.gif" width="1" height="309" border="0" alt=""></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><img src="../image_add_staff/spacer.gif" width="1" height="33" border="0" alt=""></td>
</tr>
<tr>
<td colspan="9"><img name="add_staff_r7_c1" src="../image_add_staff/add_staff_r7_c1.gif" width="800" height="30" border="0" alt=""></td>
<td><img src="../image_add_staff/spacer.gif" width="1" height="30" border="0" alt=""></td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($edit_profile);
?>
[/PHP]
Jul 24 '07 #6

dafodil
100+
P: 392
How can we help you correct your code. The code has missing parts.
Unless you show us all we can do is imagine what the error could possibly be.
Jul 24 '07 #7

P: 52
<?php session_start(); ?>


<?php require_once('../Connections/conn.php'); ?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . date("Y-d-m",strtotime($theValue)) . "'" : "NULL";
break;
case "time":
$theValue = ($theValue != "") ? "'" . date("H:i:s",strtotime($theValue)) . "'" : "NULL";
break;
case "datetime":
$theValue = ($theValue != "") ? "'" . date("Y-d-m H:i:s",strtotime($theValue)) . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "change_timetable")) {
$insertSQL = sprintf("INSERT INTO feedback (user_id, full_name, `date`, `time`, `year`, topic, comments) VALUES (%s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['user_id'], "text"),
GetSQLValueString($_POST['full_name'], "text"),
GetSQLValueString($_POST['date'], "text"),
GetSQLValueString($_POST['time'], "text"),
GetSQLValueString($_POST['year'], "text"),
GetSQLValueString($_POST['topic'], "text"),
GetSQLValueString($_POST['comments'], "text"));

mysql_select_db($database_conn, $conn);
$Result1 = mysql_query($insertSQL, $conn) or die(mysql_error());

$insertGoTo = "../admin/feedback_saved.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}

$colname_session_detect = "1";
if (isset($_SESSION['MM_Username'])) {
$colname_session_detect = (get_magic_quotes_gpc()) ? $_SESSION['MM_Username'] : addslashes($_SESSION['MM_Username']);
}
mysql_select_db($database_conn, $conn);
$query_session_detect = sprintf("SELECT * FROM user_profile WHERE user_id = '%s'", $colname_session_detect);
$session_detect = mysql_query($query_session_detect, $conn) or die(mysql_error());
$row_session_detect = mysql_fetch_assoc($session_detect);
$totalRows_session_detect = mysql_num_rows($session_detect);
?>
<?php
$access_type = $_SESSION['MM_UserGroup'];
?>

<html>
<head>
<title>QUALTY MANAGEMENT SYSTEM</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!--Fireworks MX 2004 Dreamweaver MX 2004 target. Created Wed Sep 13 14:53:43 GMT+0800 (Malay Peninsula Standard Time) 2006-->
<link href="../css/css.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript">
function logout()
{
var answer = confirm ("Do you really want to logout ?")
if (answer)
{
return true;
}
else
{
return false;
}
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function YY_checkform() { //v4.71
//copyright (c)1998,2002 Yaromat.com
var a=YY_checkform.arguments,oo=true,v='',s='',err=fal se,r,o,at,o1,t,i,j,ma,rx,cd,cm,cy,dte,at;
for (i=1; i<a.length;i=i+4){
if (a[i+1].charAt(0)=='#'){r=true; a[i+1]=a[i+1].substring(1);}else{r=false}
o=MM_findObj(a[i].replace(/\[\d+\]/ig,""));
o1=MM_findObj(a[i+1].replace(/\[\d+\]/ig,""));
v=o.value;t=a[i+2];
if (o.type=='text'||o.type=='password'||o.type=='hidd en'){
if (r&&v.length==0){err=true}
if (v.length>0)
if (t==1){ //fromto
ma=a[i+1].split('_');if(isNaN(v)||v<ma[0]/1||v > ma[1]/1){err=true}
} else if (t==2){
rx=new RegExp("^[\\w\.=-]+@[\\w\\.-]+\\.[a-zA-Z]{2,4}$");if(!rx.test(v))err=true;
} else if (t==3){ // date
ma=a[i+1].split("#");at=v.match(ma[0]);
if(at){
cd=(at[ma[1]])?at[ma[1]]:1;cm=at[ma[2]]-1;cy=at[ma[3]];
dte=new Date(cy,cm,cd);
if(dte.getFullYear()!=cy||dte.getDate()!=cd||dte.g etMonth()!=cm){err=true};
}else{err=true}
} else if (t==4){ // time
ma=a[i+1].split("#");at=v.match(ma[0]);if(!at){err=true}
} else if (t==5){ // check this 2
if(o1.length)o1=o1[a[i+1].replace(/(.*\[)|(\].*)/ig,"")];
if(!o1.checked){err=true}
} else if (t==6){ // the same
if(v!=MM_findObj(a[i+1]).value){err=true}
}
} else
if (!o.type&&o.length>0&&o[0].type=='radio'){
at = a[i].match(/(.*)\[(\d+)\].*/i);
o2=(o.length>1)?o[at[2]]:o;
if (t==1&&o2&&o2.checked&&o1&&o1.value.length/1==0){err=true}
if (t==2){
oo=false;
for(j=0;j<o.length;j++){oo=oo||o[j].checked}
if(!oo){s+='* '+a[i+3]+'\n'}
}
} else if (o.type=='checkbox'){
if((t==1&&o.checked==false)||(t==2&&o.checked&&o1& &o1.value.length/1==0)){err=true}
} else if (o.type=='select-one'||o.type=='select-multiple'){
if(t==1&&o.selectedIndex/1==0){err=true}
}else if (o.type=='textarea'){
if(v.length<a[i+1]){err=true}
}
if (err){s+='* '+a[i+3]+'\n'; err=false}
}
if (s!=''){alert('The required information is incomplete or contains errors:\t\t\t\t\t\n\n'+s)}
document.MM_returnValue = (s=='');
}
//-->
</script>
</head>
<body >
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
<!-- fwtable fwsrc="add_staff_page_layout.png" fwbase="add_staff.gif" fwstyle="Dreamweaver" fwdocid = "1867439519" fwnested="0" -->
<tr>
<td><img src="../image_add_staff/spacer.gif" width="137" height="1" border="0" alt=""></td>
<td><img src="../image_add_staff/spacer.gif" width="52" height="1" border="0" alt=""></td>
<td><img src="../image_add_staff/spacer.gif" width="237" height="1" border="0" alt=""></td>
<td><img src="../image_add_staff/spacer.gif" width="70" height="1" border="0" alt=""></td>
<td><img src="../image_add_staff/spacer.gif" width="70" height="1" border="0" alt=""></td>
<td><img src="../image_add_staff/spacer.gif" width="70" height="1" border="0" alt=""></td>
<td><img src="../image_add_staff/spacer.gif" width="70" height="1" border="0" alt=""></td>
<td><img src="../image_add_staff/spacer.gif" width="70" height="1" border="0" alt=""></td>
<td><img src="../image_add_staff/spacer.gif" width="24" height="1" border="0" alt=""></td>
<td><img src="../image_add_staff/spacer.gif" width="1" height="1" border="0" alt=""></td>
</tr>

<tr>
<td colspan="2"><a href="../main.php"><img name="layout_r1_c1" src="../images/layout_r1_c1.gif" width="189" height="80" border="0" alt=""></a></td>
<td height="80" colspan="7" valign="bottom" background="../images/bg.gif"><table width="611" border="0" cellspacing="0" cellpadding="0">
<tr valign="bottom">
<td width="200"><span class="white_text"> <span class="login_title_text"> </span></span></td>
<td width="200">&nbsp;</td>
<td width="211" align="right" class="white_text" >
<?php if(isset($_SESSION['MM_Username']))
{
echo "Welcome, ";
?>
<span class="login_title_text">
<?php
echo $_SESSION['MM_Username'];
echo "!";
}
?>
</span> </td>
</tr>
</table></td>
<td><img src="../images/spacer.gif" width="1" height="80" border="0" alt=""></td>
</tr>
<tr>
<td colspan="9"><span class="user_id"><?php
$hourdiff = "8"; // hours difference between server time and local time
$timeadjust = ($hourdiff * 3600);
$date = date("l, d F Y h:i a",time() + $timeadjust);
print ("$date");
?></span>&nbsp;</td>
<td><img src="../image_add_staff/spacer.gif" width="1" height="8" border="0" alt=""></td>
</tr>
<tr>
<td height="50" colspan="3"><table width="426" height="50" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="137" height="50"><img name="feedback" src="../images/feedback.gif"></td>
<td width="158"><img name="layout_r3_c9" src="../images/layout_r3_c9.gif"></td>

<td width="131" colspan="3" class="title"><img name="team" src='../images/team2.gif'></td>
</tr>
</table></td>
<td><img name="add_staff_r3_c4" src="../image_add_staff/add_staff_r3_c4.gif" width="70" height="50" border="0" alt=""></td>
<td><img name="add_staff_r3_c5" src="../image_add_staff/add_staff_r3_c5.gif" width="70" height="50" border="0" alt=""></td>
<td><img name="add_staff_r3_c6" src="../image_add_staff/add_staff_r3_c6.gif" width="70" height="50" border="0" alt=""></td>
<td><img name="add_staff_r3_c7" src="../image_add_staff/add_staff_r3_c7.gif" width="70" height="50" border="0" alt=""></td>
<td><img name="add_staff_r3_c8" src="../image_add_staff/add_staff_r3_c8.gif" width="70" height="50" border="0" alt=""></td>
<td><img name="add_staff_r3_c9" src="../image_add_staff/add_staff_r3_c9.gif" width="24" height="50" border="0" alt=""></td>
<td><img src="../image_add_staff/spacer.gif" width="1" height="50" border="0" alt=""></td>
</tr>
<tr>
<td width="137" height="90"><img src="../image_add_staff/add_staff2.jpg" width="137" height="90"></td>
<td height="432" colspan="8" rowspan="3" valign="top" background="../images/ist2_1265261_yellow_notebook_on_white.gif">
<div align="right"><br>
<a href="admin_view_all_feedback_comments.php">
<?php if ($access_type == "Admin")
{
?>
View User Feedback Record</a> <?php
}
?>
&nbsp; <a href="../index.php"><strong><span class="white_text">
<?php if(isset($_SESSION['MM_Username']))
{

?>
</span></strong></a><a href="my_feedback_comments.php">View My Feedback Record</a> <br>
<br>
</div>
<form action="<?php echo $editFormAction; ?>" method="POST" name="change_timetable" id="change_timetable" onSubmit="YY_checkform('change_timetable','topic', '#q','0',' Please enter a Topic *','textarea','1','1',' Please enter a comments or request *');return document.MM_returnValue">
<br>
<table width="663" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="123"><div align="center"></div></td>
<td width="49"><div align="center"></div></td>
<td width="131"><div align="center"></div></td>
<td width="90"><div align="center"></div></td>
<td width="90"><div align="center"></div></td>
<td width="90"><div align="center"></div></td>
<td width="90"><div align="center"></div></td>
</tr>
<tr>
<td colspan="3" rowspan="2" valign="top"><div align="left">Name of Requesting Officer: <strong><?php echo $row_session_detect['full_name']; ?>
<input name="full_name" type="hidden" id="full_name" value="<?php echo $row_session_detect['full_name']; ?>">
</strong></div></td>
<td colspan="2" rowspan="2" valign="top"><div align="left">Staff ID: <strong><?php echo $row_session_detect['user_id']; ?>
<input name="user_id" type="hidden" id="user_id" value="<?php echo $row_session_detect['user_id']; ?>">
</strong></div></td>
<td valign="top"><div align="right">Date:
<strong> </strong> </div></td>
<td><strong>
&nbsp;&nbsp;
<?php $date = date("d/m/Y", mktime()); ?>
<?php echo $date; ?>
<input name="date" type="hidden" id="date2" value="<?php echo $date; ?>">
</strong></td>
</tr>
<tr>
<td valign="top"><div align="right">Time: </div></td>
<td><strong>
&nbsp;&nbsp;
<?php
$timezone=+8;//YOu will probably pull this value from the database. I used -6 because I live in Iowa ;)
$time=time();//It is a timestamp of the event. You will also pull this from the DB
$gmttime= gmdate("H:i", $time);
$convertedtime=date("H:i",strtotime("$timezone hours",strtotime($gmttime)));
echo $convertedtime ;
?>
</strong>hours
<input name="time" type="hidden" id="time" value="<?php echo $convertedtime ; ?>"></td>
</tr>
<tr>
<td colspan="7"><div align="center"></div>
<div align="center">
<hr noshade>
</div>
<div align="center"></div>
<div align="center"></div>
<div align="center"></div>
<div align="center"></div>
<div align="center"></div></td>
</tr>
<tr>
<td colspan="7"><div align="left"><br>
<br>
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Topic:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input name="topic" type="text" id="topic" size="20" maxlength="100">
<span class="dot">*<strong>
<?php $year = date("Y", mktime()); ?>
<input name="year" type="hidden" id="year2" value="<?php echo $year; ?>">
</strong></span></div> <div align="right"> </div> <div align="right"></div> <div align="right"></div></td>
</tr>
<tr>
<td colspan="7"><div align="center"></div>
<div align="center"></div>
<div align="center"></div>
<div align="center"></div>
<div align="center"></div>
<div align="center"></div>
<div align="center"></div></td>
</tr>
<tr bgcolor="#F0F0F0">
<td colspan="7"><div align="center"></div>
<div align="center"> </div>
<div align="center"></div>
<div align="center"></div>
<div align="center"></div>
<div align="center"></div>
<div align="center"></div></td>
</tr>
<tr valign="bottom">
<td colspan="7"><hr noshade></td>
</tr>
<tr valign="bottom">
<td colspan="5" valign="top"><br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Comments / Request :<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<textarea name="comments" cols="40" rows="5" id="textarea">Please enter your comments here.</textarea>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
<br></td>
<td colspan="2" align="center" valign="middle">&nbsp;</td>
</tr>
</table>
<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<input type="submit" name="Submit" value="Submit">
<br>
<br>
<input type="hidden" name="MM_insert" value="change_timetable">
</form> <br>
<?php
}
?></td>
<td><img src="../image_add_staff/spacer.gif" width="1" height="90" border="0" alt=""></td>
</tr>
<tr>
<td width="137" height="309" align="center" valign="middle"><table width="137" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<?php if(!isset($_SESSION['MM_Username']))
{

?>
<a href="../index.php" target="_top" onClick="MM_nbGroup('down','group1','Login','../button_images/Login_button_down.png',1)" onMouseOver="MM_nbGroup('over','Login','../button_images/Login_button_down.png','../button_images/Login_button_down.png',1)" onMouseOut="MM_nbGroup('out')"><img src="../button_images/Login_button_up.png" alt="Login" name="Login" width="103" height="23" border="0" onload=""></a>
<?php
}
?>
</td>
</tr>
<tr>
<td>
<?php if(isset($_SESSION['MM_Username']))
{
?>
<a href="../main.php" target="_top" onClick="MM_nbGroup('down','group1','Home','../button_images/Home_button_down.png',1)" onMouseOver="MM_nbGroup('over','Home','../button_images/Home_button_down.png','../button_images/Home_button_down.png',1)" onMouseOut="MM_nbGroup('out')"><img name="Home" src="../button_images/Home_button_up.png" border="0" alt="Home" onLoad=""></a>
<?php
}
?>
</td>
</tr>
<tr>
<td>
<?php if(isset($_SESSION['MM_Username']))
{
?>
<a href="edit_profile.php" target="_top" onClick="MM_nbGroup('down','group1','EditProfile', '../button_images/Edit_Profile_button_down.png',1)" onMouseOver="MM_nbGroup('over','EditProfile','../button_images/Edit_Profile_button_down.png','../button_images/Edit_Profile_button_down.png',1)" onMouseOut="MM_nbGroup('out')"><img name="EditProfile" src="../button_images/Edit_Profile_button_up.png" border="0" alt="Edit Profile" onLoad=""></a>
<?php
}
?></td>
</tr>
<tr>
<td>
<?php if(isset($_SESSION['MM_Username']))
{
?>
<a href="../view_records.php" target="_top" onClick="MM_nbGroup('down','group1','ChangeRequest ','../button_images/Change_Request_button_down.png',1)" onMouseOver="MM_nbGroup('over','ChangeRequest','../button_images/Change_Request_button_down.png','../button_images/Change_Request_button_down.png',1)" onMouseOut="MM_nbGroup('out')"><img name="ChangeRequest" src="../button_images/Change_Request_button_up.png" border="0" alt="Change Request" onLoad=""></a>
<?php
}
?></td>
</tr>
<tr>
<td align="left">
<?php if ($access_type == "Admin")
{
?>
<a href="../admin/view_staff_record.php" target="_top" onClick= "MM_nbGroup('down','group1','StaffRecord','../button_images/Staff_Record_button_down.png',1)" onMouseOver="MM_nbGroup('over','StaffRecord','../button_images/Staff_Record_button_down.png','../button_images/Staff_Record_button_down.png',1)" onMouseOut="MM_nbGroup('out')"><img name="StaffRecord" src="../button_images/Staff_Record_button_up.png" border="0" alt="Staff Record" onLoad=""></a>
<?php
}
?>
</td>
</tr>
<tr>
<td align="left"><?php if(isset($_SESSION['MM_Username']))
{
?>
<a href="feedback.php" target="_top" onClick="MM_nbGroup('down','group1','FeedBack','../button_images/Feedback_button_down.png',1)" onMouseOver="MM_nbGroup('over','FeedBack','../button_images/Feedback_button_down.png','../button_images/Feedback_button_down.png',1)" onMouseOut="MM_nbGroup('out')"><img name="FeedBack" src="../button_images/Feedback_button_up.png" border="0" alt="FeedBack" onLoad=""></a>
<?php
}
?>
</td>
</tr>
<tr>
<td><?php if(isset($_SESSION['MM_Username']))
{
?>
<a href="../logout.php" target="_top" onClick="return logout();""MM_nbGroup('down','group1','logout','../button_images/logout_button_down.png',1)" onMouseOver="MM_nbGroup('over','logout','../button_images/logout_button_down.png','../button_images/logout_button_down.png',1)" onMouseOut="MM_nbGroup('out')"><img name="logout" src="../button_images/logout_button_up.png" border="0" alt="Logout" onLoad=""></a>
<?php
}
?></td>
</tr>
<tr>

</tr>
</table> <br>
<img src="../images/box_write_review.gif" width="100" height="100"></td>
<td><img src="../image_add_staff/spacer.gif" width="1" height="309" border="0" alt=""></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><img src="../image_add_staff/spacer.gif" width="1" height="33" border="0" alt=""></td>
</tr>
<tr>
<td colspan="9"><img name="add_staff_r7_c1" src="../image_add_staff/add_staff_r7_c1.gif" width="800" height="30" border="0" alt=""></td>
<td><img src="../image_add_staff/spacer.gif" width="1" height="30" border="0" alt=""></td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($session_detect);
?>
Jul 24 '07 #8

dafodil
100+
P: 392
After reviewing your code:

you forgot to put the semicolon in this statement:
var answer = confirm ("Do you really want to logout ?");


cheers
Jul 24 '07 #9

P: 52
After reviewing your code:

you forgot to put the semicolon in this statement:
var answer = confirm ("Do you really want to logout ?");


cheers
It still cant be worked, no confirm message pop out.
Jul 24 '07 #10

dafodil
100+
P: 392
Replace this:

<a href="../logout.php" target="_top" onClick="return logout();""MM_nbGroup('down','group1','logout','../button_images/logout_button_down.png',1)" onMouseOver="MM_nbGroup('over','logout','../button_images/logout_button_down.png','../button_images/logout_button_down.png',1)" onMouseOut="MM_nbGroup('out')"><img name="logout" src="../button_images/logout_button_up.png" border="0" alt="Logout" onLoad=""></a>


with this:

Expand|Select|Wrap|Line Numbers
  1.  
  2. <a href="../logout.php" target="_top" onClick="return logout(); MM_nbGroup('down','group1','logout','../button_images/logout_button_down.png',1);" onMouseOver="MM_nbGroup('over','logout','../button_images/logout_button_down.png','../button_images/logout_button_down.png',1)" onMouseOut="MM_nbGroup('out')"><img name="logout" src="../button_images/logout_button_up.png" border="0" alt="Logout" onLoad=""></a>
  3.  
  4.  
  5.  

Is this a javascript function? MM_nbGroup()

It's missing check the code again....
Jul 24 '07 #11

Post your reply

Sign in to post your reply or Sign up for a free account.