check to see if getAuthUser returns a value. If it returns an empty
string, you are not logged in. I typically build a UDF like so:
function isLoggedIn() {
return getAuthUser() neq "";
}
So, to display prices for logged in users, you could do...
<cfif isLoggedIn()>#price#<cfelse>Please login to view prices</cfif>
Note: You may think that a better name for the UDF would be,
isAuthenticated. However, when Macromedia removed the Advanced
Security functions (one of which was isAuthenticated), they made a
"hook" for the old functions. This means you can't use a UDF with the
same name as the old AS functions.
On Mon, 4 Oct 2004 23:38:06 +1000, Mike Kear <[EMAIL PROTECTED]> wrote:
> I have an app where the client wants his customers to only see prices
> and "add to cart" icons if they're logged in. They'll see the
> "public" version of the site, with product images and descriptions
> only until they log in, then the pages will also show pricing and the
> links to add to the shopping cart. Also the shopping cart will be
> initialised when they log in.
>
> I can write my own security framework, but I want to understand the
> CFLOGIN stuff thats built into CFMX. All the examples I've seen for
> that are where entire pages or directories are barred from people who
> aren't logged in.
>
> How would I do it, using the CFLOGIN framework?
>
> Here's what i have done so far ...
>
> I have a folder called "Clients" where I hold the login procedures,
> also the lost password and update profile stuff, and the login page
> sends the user back to the site home page after logging in. That
> all works ok. And the same system also validates the client himself
> and grants him access to the admin area of the site.
>
> How do I handle the price column in the display tables? In my
> homegrown system, I'd just do something like:
>
> <cfif session.auth.isloggedin>
> <td>#price#</td>
> </cfif>
>
> How does it work where we want the page to display to people not
> logged in, but only certain parts showing to logged in users?
>
> I've tried <cfif isdefined(getauthuser())> but that doesnt work.
> Also a few other combinations around the getauthuser() function but
> nothing I've tried is the right thing.
>
> Cheers
> Mike Kear
> Windsor, NSW, Australia
> AFP Webworks
> http://afpwebworks.com
> .com,.net,.org domains from AUD$20/Year
>
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

