CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 cc php setcookie vs. sessions

Print topic Send  topic

Author Message
Robert
Posted: 11/09/2003, 10:30 PM

want user to register, which sets a cookie (ie: "emailaddress") that lasts a whole year. this cookie will be compared to db for future authentications. Using CC v2.0.5, php, mysql. I don't want to use the sessions, don't want folks having to login each time. This is not a security thing, just a registration thing. Only 1 page that looks up the cookie and compares it to the db, then if cookie present, lets the visitor into the page, thats it!
I know somebody is willing to give it up! (please)
Robert
Nicole
Posted: 11/12/2003, 2:31 AM

Robert,
You can set cookie on the header page
global $HTTP_COOKIE_VARS;
if (!isset($HTTP_COOKIE_VARS["cookie_name"]))
setcookie("cookie_name", $value, $time_expire);

This let you assign cookie for users who does not have the one. To allow or forbid users to access the given page check_security() function is used. You have to overwrite it in order to check the cookie and not the session value.

Robert
Posted: 11/13/2003, 12:20 AM

Woa!
After 24 real hours of learning how to set, read, destroy cookies, etc...You have given me what I've been looking for...You are SUPER!!

I set security lvl 1 on my "requires registration" page, I have the cc login page set to the "registration" page with it's action page being the "real login" page(which does the setcookie code, which I placed in the "on login event"), the "real login" page's action is the "requires registration" page(which is now user cookie authenticated).
This was my way of 1-time registration for users(vs. sessions). The cookie expiration is for 1 year, if the user deletes cookies, they can go to the "real login" page to create a new cookie, therefore not having to register again (I use email address and zip code as the "username" and "password" - very simple to remember!). Anyways, I think you saved me a whole lotta head hair!
Thanks again,
Robert
Robert
Posted: 11/21/2003, 3:14 PM

Using CC v2.0.5, php, mysql: I am trying to do the check_security() based on the value of a grid form field. Just to give an idea, this does not work, but sorta esplains what I am trying to acomplish:
I have a Grid Form, Before Show:
///
if ($fld_this_particular_record_requires_registration_to_view == 1)
check_security();
else
$custom_label="grid form will show it's results here if above is not= 1";
///
Thanks to whoever can lend a hand!

   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright 2003-2004 by UltraApps.com  and YesSoftware, Inc.