
September 13th, 2005, 03:47 PM
|
|
Registered User
|
|
Join Date: Apr 2005
Posts: 22
Time spent in forums: 4 h 7 m 22 sec
Reputation Power: 0
|
|
|
Can't get these session variables to close...
I have a window that pops up to allow the user to change password. In order to give the error messages I created a few session variables. I'm trying to figure out the best way to get them closed. I was thinking of having it on browser window close or I would have the Close Button call a function to end the sessions and then close the window, but I can't seem to figure out where to put the function or how the button calls for the function.
I was thinking of just having the Session.Content.Remove in the IF statements down in the gut of the code.
this is what I have so far.
Code:
<%@LANGUAGE="VBSCRIPT"%>
<%
option explicit
response.expires=0
if Session( "username" ) = "" Then Response.Redirect "members.asp"
%>
<% Function CloseSessions()
Session.Content.Remove ( "Fail" )
Session.Content.Remove ( "Success" )
Session.Content.Remove ( "NotEqual" )
Session.Content.Remove ( "Empty" )
window.close()
%>
<html>
<head>
<title>Street Team Profile Password Change</title>
<style type="text/css">
.small {font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 7pt}
.text {font-family: Verdana,Geneva,Arial,Helvetica,sans-serif; font-size: 8pt}
</style>
<meta http-equiv="Page-Enter" Content=blendTrans(Duration=.5)">
<SCRIPT LANGUAGE="JavaScript">
<!--
function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
//-->
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>
<body bgcolor="7094ac" text="#000000" link="#FFFFFF" alink="#FFFFFF" vlink="#999999">
<FORM ACTION="passupdt.asp" method="post">
<div align="center">
<table width="284" height="170" border="0" cellpadding="0" cellspacing="0" class="text">
<tr>
<td width="284" height="170" valign="top" bgcolor="c5cdc5">
<table width="287" height="135" border="0" cellpadding="0" cellspacing="0" class="text">
<tr>
<td width="7"> </td>
<td width="116" height="26"> Username:</td>
<td width="164" height="26"><% Response.Write session("username") %></td>
</tr>
<tr>
<td> </td>
<td height="26">Old password:</td>
<td height="26" valign="middle"><input name="oldpass" type="password" class="small" id="oldpass" size="20" maxlength="20"></td>
</tr>
<tr>
<td> </td>
<td height="26">New Password:</td>
<td height="26"><input name="npass1" type="text" class="small" id="npass1" size="20" maxlength="20"></td>
</tr>
<tr>
<td> </td>
<td height="26">Retype New Password:</td>
<td height="26"><input name="npass2" type="text" class="small" id="npass2" size="20" maxlength="20"></td>
</tr>
<tr>
<td height="26" colspan="3">
<div align="center">
<% If Session( "Empty" ) = True Then %>
<font COLOR="red">You must enter all the required fields</font>
<% End If %>
<% If Session( "NotEqual" ) = True Then %>
<font COLOR="red">Both Password fields must have the same value</p></font>
<% End If %>
<% If Session( "Fail" ) = True Then %>
<font COLOR="red">Invalid Password</font>
<% End If %>
<% If Session( "Success" ) = True Then %>
<font COLOR="red">You have successfully changed your password</font>
<% End If %>
</div>
</td>
</tr>
</table>
<div align="center">
<input name="bSubmit" type="submit" id="bSubmit" value="Change">
<input name="bClose" type="button" id="bClose" onClick="CloseSessions();" value="Close">
</div>
</tr>
</table>
</div>
</FORM>
</body>
</html>
|