1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97
|
application.cfm:
<cfapplication
name = "authentification"
applicationTimeout = #CreateTimeSpan(0, 0, 10, 0)#
clientManagement = "yes"
loginStorage = "session"
scriptProtect = "none"
sessionManagement = "yes"
sessionTimeout = #CreateTimeSpan(0, 0, 10, 0)#
setClientCookies = "yes"
setDomainCookies = "yes">
<cfif (not isDefined("session.loggedin") or session.loggedin eq false)>
<cflocation url="authentification.cfm" addToken="no" statusCode="300">
<cfexit>
</cfif>
</cfapplication>
authentification.cfm :
<html>
<head>
<link rel="stylesheet" media="screen" type="text/css" title="coldfusion" href="stylesheet.css" />
</head>
<body>
<table cellspacing="10" cellpadding="10" width="300" align="center" border="0">
<tbody>
<form action="authentification2.cfm" method="POST">
<tr>
<td>Login</td>
<td><input id="login" name="login" type="text" /></td>
</tr>
<tr>
<td>Password</td>
<td><input id="password" type="password" name="Password" /></td>
</tr>
<td><input type="submit" name="submit" value="Envoyer" /></td>
</tbody>
</table>
</body>
</html>
authentification2.cfm :
<cfparam name="FORM.login" default="">
<cfparam name="FORM.password" default="">
<cfquery datasource="authentification" name="authentification">
SELECT login, password
FROM authentification
WHERE login = <cfqueryparam value="#FORM.login#" cfsqltype="CF_SQL_VARCHAR">
AND password = <cfqueryparam value="#FORM.password#" cfsqltype="CF_SQL_VARCHAR">
</cfquery>
<cfif authentification.recordCount>
<cfset session.valid_account=authentification>
<cfset session.loggedin=true>
<cflocation url="authentification3.cfm">
<cfelse>
<cflocation url="authentification5.cfm">
</cfif>
authentification3.cfm:
<cfparam name="FORM.login" default="">
<html>
<head>
<link rel="stylesheet" media="screen" type="text/css" title="coldfusion" href="stylesheet.css" />
</head>
<body>
<cfif (session.loggedin eq true)>
<center><h2>Bienvenue <br><br>
<a href="logout.cfm">Se Déconecter</a></h2></center>
<cfelse>
<cflocation url="authentification.cfm">
</cfif>
</body>
</html>
logout.cfm :
<cfset session.userid = "">
<cfset session.user = "">
<cfset session.loggedin="no">
<cfset session.lastlogin="">
<cfset PageResponse="Thanks. Come back soon">
<cfinclude template="authentification.cfm"> |
Partager