Ask a Question related to Macromedia ColdFusion, Design and Development.
-
Kamesh192 #1
login going to the current url
hi
i have a login transaction on a page, this page has url parameters passed
through it, so when the user logs in i want he/she to be taken back to the page
they were on( with the url parameters).
i am using the coldfusion login system.
i have some javascrip code which displays the current url , but i dont know
how to incorporate this into the cf code
below is the login page code and below it is the javascript code, i have
starred out where the sucessful login script is.
does anyone know how to make the login redirect the user to the current url or
how to incorporate the javascript into the cf code?????
any help would be appreciated
thanks
kamesh
PAGE CODE
<cfif IsDefined("FORM.textfield")>
************************************************** ***********
<cfset MM_redirectLoginSuccess="admin/index.cfm">
************************************************** ************
<cfset MM_redirectLoginFailed="test1.cfm">
<cfquery name="MM_rsUser" datasource="DSNPixelwork">
SELECT username,password FROM tbLogin WHERE username='#FORM.textfield#' AND
password='#FORM.textfield2#'
</cfquery>
<cfif MM_rsUser.RecordCount NEQ 0>
<cftry>
<cflock scope="Session" timeout="30" type="Exclusive">
<cfset Session.MM_Username=FORM.textfield>
<cfset Session.MM_UserAuthorization="">
</cflock>
<cfif IsDefined("URL.accessdenied") AND false>
<cfset MM_redirectLoginSuccess=URL.accessdenied>
</cfif>
<cflocation url="#MM_redirectLoginSuccess#" addtoken="no">
<cfcatch type="Lock">
<!--- code for handling timeout of cflock --->
</cfcatch>
</cftry>
</cfif>
<cflocation url="#MM_redirectLoginFailed#" addtoken="no">
<cfelse>
<cfset MM_LoginAction=CGI.SCRIPT_NAME>
<cfif CGI.QUERY_STRING NEQ "">
<cfset MM_LoginAction=MM_LoginAction & "?" & CGI.QUERY_STRING>
</cfif>
</cfif>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<form ACTION="<cfoutput>#MM_loginAction#</cfoutput>" name="form1"
method="POST">
<p> User name
<input type="text" name="textfield">
</p>
<p> password
<input type="text" name="textfield2">
</p>
<p>
<input type="submit" name="Submit" value="Submit">
</p>
</form>
</body>
</html>
JAVASCRIPT CODE
<SCRIPT LANGUAGE="JavaScript">
<!--
{
document.write(location.href);
}
// -->
</SCRIPT>
Kamesh192 Guest
-
Either BOF or EOF is True, or the current record hasbeen deleted. Requested operation requires a current record
Can anyone pls help? I am getting the following error when search my database. "ADODB.Field (0x800A0BCD Either BOF or EOF is True, or the... -
Login to LDAP using current credentials
Hello, Here is my situation. I have developed several apps that require authentication to access. For authentication, I have the users enter... -
Fixed Impersonation vs Current login user
I have a ASp.NET application which performs a http request to another web site on the same server but different virtual directory. when i set... -
session problem - login screen continually reloads after pressing the login button
I am trying to get sessions to work on a log in screen to give certain users access to certain pages/directories. The problem is that when the... -
How to change the current thread current culture at run time.
I have created a new culture : Dim objCulture As New CultureInfo("he") //hebrew When I tried to assign it to the current thread. ... -
eastinq #2
Re: login going to the current url
I am assuming all this code is in one cfm file and the logic of your code goes
like this:
The form submit goes back to itself.
If username and password ok , then goto index.cfm page
else goto test1.cfm
Are you wanting to display the login form again if it fails?
eastinq Guest
-
Kamesh192 #3
Re: login going to the current url
hi
yes the code is from one page. currently the form takes a successful login to
the index page, but i dont want that. see below:
there are various logins in section on my site (one on every page) if the user
logins in successfully then i want the page they logged in from to appear. for
example if the user logged in from [url]www.pixelwork.com/work.cfm?catID=10[/url] then i
want the user to be taken back to [url]www.pixelwork.com/work.cfm?catID=10[/url] if the
login was successful. if the login fails then go to test1.cfm.
basically the site has pages where data is pulled form a database and when the
user clicks an option a url parameter is passed through to the next page. on
the next page a query picks up the url parameter and displays information
accordingly.The url parameter is an ID.
hope this makes sense to everyone!
thanks
kamesh
Kamesh192 Guest
-
vkunirs #4
Re: login going to the current url
Hi
in the CGI varaibles we have one attribute called as REFERER, this will gives
you the name of the file by which file it has
been referred to the login form. once the user is logins then using this
variable you can redirect the user to the same page.
vkunirs Guest
-
eastinq #5
Re: login going to the current url
You should be able to go back to the referring page by using CGI.HTTP_REFERER
eastinq Guest



Reply With Quote

