--============_-1241783480==_ma============
Content-Type: text/plain; charset="us-ascii" ; format="flowed"

On 9/30/00, W Luke penned:
>For example on one of my sites I have a Members section which they can
>personalise - they login in using their username and password...
>
>  <cfif NOT #login.recordcount# IS 0>
>
>So if the user and pass is OK, the rest of the page is displayed.  What I'd
>like to do is after successful validation, use client vars in a DB so that
>they will be logged in automatically next time.
>
>How should I do this?

The problem with this, client variables can be set to be purged from 
the database after a set period, so unless you have your own server, 
you're at the mercy of the host. I believe the default is 10 days. I 
have my server set to expunge after one day because that's all I need 
for any app on my server. Now if someone requested I keep them 
longer, I may give them a week, but not much more than that because 
then the database just gets larger and larger. And I don't think 
there's any guarantee that the person will have the same cfid and 
cftoken generated by their browser (still a little confused by that 
one) if they've shut it down and come back a few days later.

I use cookies. Then they can click a checkbox if they want their 
password to be stored. Then you check like this (just an example from 
one of my apps):

<cfif not isdefined('client.mem_id')><cfset client.mem_id = ""></cfif>

<cfif (isDefined('cookie.member_id') and
isdefined('cookie.member_password') and
client.mem_id is "") or (isdefined('form.member_id') and
(isdefined('form.member_password'))>

<cfif isdefined('form.member_password')>
<cfset variables.member_password = form.member_password>
<cfelse>
<cfset variables.member_password = cookie.member_password>
</cfif>

<cfif isdefined('form.member_id')>
<cfset variables.member_id = form.member_id>
<cfelse>
<cfset variables.member_id = cookie.member_id>
</cfif>

<CFQUERY DATASOURCE="#request.DSN#" NAME="Get_ID">
SELECT Cust_ID,Cust_FirstName
FROM Customers
WHERE Cust_ID = '#variables.member_id#' and password = 
'#variables.member_password#'
</CFQUERY>

<cfif Get_ID.recordcount is "1">
<cfset client.mem_id = Get_ID.Cust_ID>
Welcome Back <cfoutput>#Get_Id.Cust_FirstName#</cfouput>!<p>
<cfelse>
<cfset badlogin = 1>
</cfif>

</cfif>

<cfif client.mem_id is "">
<cfif isdefined('badlogin')>Login Failed<br></cfif>
Show Login Form</cfif>

Then as long as client.mem_id is not "" then they are logged in.
-- 

Bud Schneehagen - Tropical Web Creations

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
ColdFusion Solutions / eCommerce Development
[EMAIL PROTECTED]
http://www.twcreations.com/
954.721.3452
--============_-1241783480==_ma============
Content-Type: text/html; charset="us-ascii"

<!doctype html public "-//W3C//DTD W3 HTML//EN">
<html><head><style type="text/css"><!--
blockquote, dl, ul, ol, li { margin-top: 0 ; margin-bottom: 0 }
 --></style><title>Re: Client &amp; Session
variables?</title></head><body>
<div>On 9/30/00, W Luke penned:</div>
<blockquote type="cite" cite>For example on one of my sites I have a
Members section which they can<br>
personalise - they login in using their username and password...<br>
<br>
&nbsp;&lt;cfif NOT #login.recordcount# IS 0&gt;<br>
<br>
So if the user and pass is OK, the rest of the page is
displayed.&nbsp; What I'd<br>
like to do is after successful validation, use client vars in a DB so
that<br>
they will be logged in automatically next time.<br>
</blockquote>
<blockquote type="cite" cite>How should I do this?</blockquote>
<div><br></div>
<div>The problem with this, client variables can be set to be purged
from the database after a set period, so unless you have your own
server, you're at the mercy of the host. I believe the default is 10
days. I have my server set to expunge after one day because that's
all I need for any app on my server. Now if someone requested I keep
them longer, I may give them a week, but not much more than that
because then the database just gets larger and larger. And I don't
think there's any guarantee that the person will have the same cfid
and cftoken generated by their browser (still a little confused by
that one) if they've shut it down and come back a few days
later.</div>
<div><br></div>
<div>I use cookies. Then they can click a checkbox if they want their
password to be stored. Then you check like this (just an example from
one of my apps):</div>
<div><br></div>
<div><font size="-1">&lt;cfif not
isdefined('client.mem_id')&gt;&lt;cfset client.mem_id =
&quot;&quot;&gt;&lt;/cfif&gt;</font></div>
<div><br></div>
<div><font size="-1">&lt;cfif (isDefined('cookie.member_id')
and</font></div>
<div><font size="-1">isdefined('cookie.member_password')
and</font></div>
<div><font size="-1">client.mem_id is &quot;&quot;) or
(isdefined('form.member_id') and</font></div>
<div><font
size="-1">(isdefined('form.member_password'))&gt;</font></div>
<div><font size="-1"><br></font></div>
<div><font size="-1">&lt;cfif
isdefined('form.member_password')&gt;</font></div>
<div><font size="-1">&lt;cfset variables.member_password =
form.member_password&gt;</font></div>
<div><font size="-1">&lt;cfelse&gt;</font></div>
<div><font size="-1">&lt;cfset variables.member_password =
cookie.member_password&gt;</font></div>
<div><font size="-1">&lt;/cfif&gt;</font></div>
<div><font size="-1"><br></font></div>
<div><font size="-1">&lt;cfif
isdefined('form.member_id')&gt;</font></div>
<div><font size="-1">&lt;cfset variables.member_id =
form.member_id&gt;</font></div>
<div><font size="-1">&lt;cfelse&gt;</font></div>
<div><font size="-1">&lt;cfset variables.member_id =
cookie.member_id&gt;</font></div>
<div><font size="-1">&lt;/cfif&gt;</font></div>
<div><font size="-1"><br></font></div>
<div><font size="-1">&lt;CFQUERY DATASOURCE=&quot;#request.DSN#&quot;
NAME=&quot;Get_ID&quot;&gt;</font></div>
<div><font size="-1">SELECT Cust_ID,Cust_FirstName</font></div>
<div><font size="-1">FROM Customers</font></div>
<div><font size="-1">WHERE Cust_ID = '#variables.member_id#' and
password = '#variables.member_password#'</font></div>
<div><font size="-1">&lt;/CFQUERY&gt;</font></div>
<div><font size="-1"><br></font></div>
<div><font size="-1">&lt;cfif Get_ID.recordcount is
&quot;1&quot;&gt;</font></div>
<div><font size="-1">&lt;cfset client.mem_id =
Get_ID.Cust_ID&gt;</font></div>
<div><font size="-1">Welcome Back
&lt;cfoutput&gt;#Get_Id.Cust_FirstName#&lt;/cfoup<span
></span>ut&gt;!&lt;p&gt;</font></div>
<div><font size="-1">&lt;cfelse&gt;</font></div>
<div><font size="-1">&lt;cfset badlogin = 1&gt;</font></div>
<div><font size="-1">&lt;/cfif&gt;</font></div>
<div><font size="-1"><br></font></div>
<div><font size="-1">&lt;/cfif&gt;</font></div>
<div><font size="-1"><br></font></div>
<div><font size="-1">&lt;cfif client.mem_id is
&quot;&quot;&gt;</font></div>
<div><font size="-1">&lt;cfif isdefined('badlogin')&gt;Login
Failed&lt;br&gt;&lt;/cfif&gt;</font></div>
<div><font size="-1">Show Login Form&lt;/cfif&gt;</font></div>
<div><br></div>
<div>Then as long as client.mem_id is not &quot;&quot; then they are
logged in.</div>

<div>-- <br>
<br>
Bud Schneehagen - Tropical Web Creations<br>
<br>
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/<br>
ColdFusion Solutions / eCommerce Development<br>
[EMAIL PROTECTED]<br>
http://www.twcreations.com/<br>
954.721.3452</div>
</body>
</html>
--============_-1241783480==_ma============--
------------------------------------------------------------------------------
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to