ColdFusion - How to determine whether a user is logged in

IsUserLoggedIn() - determine whether a user is logged in

IsUserLoggedIn.cfm


<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>IsUserLoggedIn function example: how to determine whether a user is logged in</title>
</head>

<body>
<h2 style="color:Crimson">IsUserLoggedIn Function Example</h2>


<cfoutput>
 <cfif IsUserLoggedIn()>
        User is logged in.<br />
        <b>User Name:</b> #GetAuthUser()#
    <cfelse>
  User is not logged in
    </cfif>
</cfoutput>

<cflogout>

<br /><br />
-----After logged out---
<br /><br />

<cfoutput>
 <cfif IsUserLoggedIn()>
        User is logged in.<br />
        <b>User Name:</b> #GetAuthUser()#
    <cfelse>
  User is not logged in
    </cfif>
</cfoutput>

</body>
</html>






More ColdFusion examples