 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
PHPFreaks.com: Sessions and cookies Adding state to a stateless protocol
by Chris Cornutt June 05, 2008 @ 12:05:11
On the PHPFreaks website, there's a new tutorial talking about sessions and cookies in PHP:
HTTP is a stateless protocol. This means that each request is handled independently of all the other requests and it means that a server or a script cannot remember if a user has been there before. However, knowing if a user has been there before is often required and therefore something known as cookies and sessions have been implemented in order to cope with that problem.
The tutorial is pretty introductory, so if you're not new to the PHP world, you won't learn much. New developers, though, will learn how to set cookies, use sessions and learn a bit about the security of both.
voice your opinion now!
session tutorial introduction cookie state stateless protocol http
Brian Moon's Blog: PHP session cookie refresh
by Chris Cornutt May 14, 2008 @ 12:51:02
Brian Moon has posted a tip (and a bit of code) he's worked up to help make a users cookies last a bit longer than they were originally designed to:
When you start a session, if the user had no cookie, they get a new session id and they get a cookie. You can configure that cookie to last for n seconds via php.ini or session_cookie_set_params(). But, and this is a HUGE but for me, that cookie will expire in n seconds no matter what.
His method provides a way to extend the life of the cookies currently set for the domain by changing the time to live through a series of ini_get calls wrapped in a setcookie() call.
voice your opinion now!
cookie session refesh timetolive setcookie iniset
Stoyan Stefanov's Blog: www vs no-www and cookies
by Chris Cornutt May 14, 2008 @ 11:18:39
Stoyan Stefanov has come up against one of the frustrations of web development involving cookies - problems caused by the switch from a "www." in the host to none. He's come up with a test to show you how cookies are set and where you can access them from.
One of the implications of following the rule is related to the whole www vs no-www question. Basically you should always use www if you're planning to use any other sub-domains and you want them cookie-free. This is because you have no way to set a cookie only to the top-level domain.
His code sets cookies for the ".phpied.com", "phpied.com" and "www.phpied.com" domains. Since the domains without the "www" offer a bit broader range of possible matches, he recommends that if you're ever going to use any kind of subdomain, you'll want to use the more broad cookie to cover it.
voice your opinion now!
cookie hostname test board coverage
Ed Finkler's Blog: Encouraging steps towards security in Wordpress 2.5
by Chris Cornutt April 02, 2008 @ 21:09:47
Ed Finkler, not normally a big fan of the WordPress PHP-based blogging system, has pointed out some positive steps that were made in the latest release in the security arena.
Anyone who gets me liquored up knows that I'm not a fan of Wordpress. I think it's great from a user (that is, the person writing the content) standpoint, but it has lagged behind severely in terms of security, and I don't believe its popularity is the sole reason WP has been the subject of dozens of vulnerability reports every year. That being said, the WP 2.5 release appears to offer significant improvements in a couple areas: password hashes and cookie data encryption.
He mentions two things in particular - their addition of salted passwords and secure cookies.
voice your opinion now!
wordpress security secure cookie password hash blog
Brian Moon's Blog: Responsible use of the $_REQUEST variable
by Chris Cornutt January 22, 2008 @ 09:38:00
In one of his recent blog entries, Brian Moon takes a look at what he considers the "proper use" of the PHP superglobal $_REQUEST (as brought on by a thread on the PHP internals mailing list.
I have seen more than one person make the following logic mistake: I may get data via GET, I may get data via POST - Ah, I should use $_REQUEST as it will catch both.
Brian points out the error - cookies aren't in $_REQUEST so improper handling of those values could lead to cookie data overwriting GET/POST data from $_REQUEST. Several of the comments on the post also warn against improper handling of the values, noting that doing so could lead to holes open for attacks (like session fixation).
voice your opinion now!
get post request superglobal cookie security merge
DevShed: Handling Cookies and File Data with the Factory Pattern in PHP 5
by Chris Cornutt July 02, 2007 @ 12:56:00
Continuing on with their look at the Factory Pattern (part one), DevShed has part two posted - a look at applying what was learned previously into a simple cookie-handling and file manipulation script.
At this stage you should have a more accurate idea of how to include the factory pattern into your own PHP applications, at least at a very basic level. But don't you worry because this scenario is going to change quickly, since in this second tutorial I'm going to teach you how to take advantage of the capacity offered by the pattern to create objects that are capable of saving data to different locations, including files and cookies.
The tutorial starts off by creating the classes needed to save strings and objects based off of the abstract DataSaverFactory class. On top of this, they build the classes to save the cookies and work with the files using the Factory objects.
voice your opinion now!
php5 factory designpattern cookie file tutorial php5 factory designpattern cookie file tutorial
|
Community Events
Don't see your event here? Let us know!
|