Web Design Forum: passing cookies - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

passing cookies Rate Topic: -----

#1 User is offline   gadgetgirl 

  • Dedicated Member
  • PipPip
  • Group: Members
  • Posts: 152
  • Joined: 26-February 10
  • Reputation: 6

Posted 16 January 2012 - 04:33 PM

I have a login script which sets an email cookie and calls a Feedback script to display some stuff and present another form. The feedback script calls a third script, Post script to do some stuff including mailing the email address set in the cookie by script 1. Can the Post script access this cookie?

Here's what the code used in login script to set the cookie
setcookie ("email", $e, 0, "/userRegLHtest/");

This post has been edited by gadgetgirl: 16 January 2012 - 05:00 PM

0

#2 User is online   Sogo7 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 421
  • Joined: 02-February 11
  • Reputation: 42
  • Gender:Male
  • Location:Camarthen
  • Experience:Intermediate
  • Area of Expertise:Designer/Coder

Posted 16 January 2012 - 07:45 PM

Both javascript and server side scripting such as PHP can access the cookie information and plenty of tutorials and examples exist.

However would recommend you look at using the $_SESSION variables array for temporary storage of the email address. With a database or simple text file if you need to keep this information long term.

This is because cookies can be altered by users (see Firefox plugins) and others have web browsers setup to block them completely.

This post has been edited by Sogo7: 16 January 2012 - 07:47 PM

0

#3 User is offline   webdesigner93 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,976
  • Joined: 22-September 09
  • Reputation: 222
  • Gender:Male
  • Experience:Web Guru
  • Area of Expertise:Web Developer

Posted 16 January 2012 - 09:26 PM

View PostSogo7, on 16 January 2012 - 07:45 PM, said:

Both javascript and server side scripting such as PHP can access the cookie information and plenty of tutorials and examples exist.

However would recommend you look at using the $_SESSION variables array for temporary storage of the email address. With a database or simple text file if you need to keep this information long term.

This is because cookies can be altered by users (see Firefox plugins) and others have web browsers setup to block them completely.

Actually cookies are widely used by google,facebook,yahoo etc.. i can keep going on and on even phpmyadmin requires them to be enabled to be used, so if a person wants to block them then they should look at not being able to use alot of sites etc.. especially remember me features, even this forum sets cookies for that, its all about how safe you make the info inside the cookie rather it be encrypting the data etc.. then checking that data within your web app against a database to prevent altering of cookie data... so what your saying about altering may be true. but any data plugged into the cookie will be useless if, you code your web application properly.
0

#4 User is offline   webdesigner93 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,976
  • Joined: 22-September 09
  • Reputation: 222
  • Gender:Male
  • Experience:Web Guru
  • Area of Expertise:Web Developer

Posted 16 January 2012 - 10:02 PM

View Postgadgetgirl, on 16 January 2012 - 04:33 PM, said:

I have a login script which sets an email cookie and calls a Feedback script to display some stuff and present another form. The feedback script calls a third script, Post script to do some stuff including mailing the email address set in the cookie by script 1. Can the Post script access this cookie?

Here's what the code used in login script to set the cookie
setcookie ("email", $e, 0, "/userRegLHtest/");


You can access your cookie in any script using
$_COOKIE['email']

This post has been edited by webdesigner93: 16 January 2012 - 10:02 PM

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users