Quantcast
Channel: Adobe Community : All Content - ColdFusion
Viewing all articles
Browse latest Browse all 5979

LogOut Issue

$
0
0

Hi

    When i logout from my index Page then Login Page Open but when i click on back button in Browser Then  Index Page open. I want once logout then not open other when clik on back button in Browser page like facebook..

I add my code Follow:

 

Application.cfc

<cfcomponent>

          <cfset this.datasource = "TestingDataSource">

 

          <cffunction name="onRequest">

                    <cfargument name="templatename"/>

                    <cflogin>

                              <cfif isdefined("form.submit")>

                                        <cfif form.username is "admin" and form.password is "admin">

                                                  <cfloginuser name="#form.username#" password="#form.password#" roles="admin">

                                        <cfelse>

                                                  <cfset request.errorMessage = "Incorrect Login,Please try again..">

                                                  <cfinclude template="login.cfm">

                                                  <cfreturn>

                                        </cfif>

                              <cfelse>

                                        <cfinclude template="login.cfm">

                                        <cfreturn>

                              </cfif>

                    </cflogin>

                    <cfinclude template="#arguments.templatename#" >

          </cffunction>

 

</cfcomponent>


 

index.cfm

<!DOCTYPE html>

<html>

          <head>

                    <meta http-equiv="Content-Type" content="text/html"; charset="utf-8"/>

                    <title>

                              Untitled Document

                    </title>

          </head>

          <body>

                    <h1>Home Page</h1>

                    <h3>

                              Welcome to Photo Gallary.....

                    </h3>

                    <a href="logout.cfm">Logout</a>

          </body>

</html>

 

login.cfm

<!DOCTYPE html>

<html>

          <head>

                    <meta

                    

                    http-equiv="Content-Type" content="text/html"; charset="utf-8"/>

                    <title>

                              Untitled Document

                    </title>

          </head>

          <body>

                    <cfform>

                              <table width="500" border="0">

                                        <tr>

                                                  <td>

                                                            User Name:

                                                  </td>

                                                  <td>

                                                            <cfinput name="username" type="text" required="yes" message="Please enter Username"/>

                                                  </td>

                                        </tr>

                                        <tr>

                                                  <td>

                                                            Password:

                                                  </td>

                                                  <td>

                                                            <cfinput name="password" type="password" required="yes" message="Please enter password"/>

                                                  </td>

                                        </tr>

                                        <tr>

                                                  <td>

                                                            <cfinput type="submit" name="submit" value="submit">

                                                  </td>

                                        </tr>

                              </table>

                    </cfform>

                    <cfif isdefined("request.errorMessage")>

                              <p style="color:red">

                                        <cfoutput>#request.errorMessage#</cfoutput>

                              </p>

                    </cfif>

          </body>

</html>

 

logout.cfm

<cflogout>

<cflocation url="login.cfm" >




Viewing all articles
Browse latest Browse all 5979

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>