[Cs-content-commits] SF.net SVN: cs-content:[500] trunk/1.0/cs_session.class.php
PHP Templating & Includes System
Brought to you by:
crazedsanity
From: <cra...@us...> - 2011-07-20 00:52:15
|
Revision: 500 http://cs-content.svn.sourceforge.net/cs-content/?rev=500&view=rev Author: crazedsanity Date: 2011-07-20 00:52:09 +0000 (Wed, 20 Jul 2011) Log Message: ----------- Creating a cookie sets the domain... Modified Paths: -------------- trunk/1.0/cs_session.class.php Modified: trunk/1.0/cs_session.class.php =================================================================== --- trunk/1.0/cs_session.class.php 2011-07-18 20:13:53 UTC (rev 499) +++ trunk/1.0/cs_session.class.php 2011-07-20 00:52:09 UTC (rev 500) @@ -105,7 +105,7 @@ * @param $value (string) value of cookie * @param $expiration (string/number) unix timestamp or value for strtotime(). */ - public function create_cookie($name, $value, $expiration=NULL) { + public function create_cookie($name, $value, $expiration=NULL, $path=NULL, $domain=NULL) { $expTime = NULL; if(!is_null($expiration)) { @@ -120,7 +120,16 @@ } } - $retval = setcookie($name, $value, $expTime, '/'); + if(is_null($domain)) { + $bits = explode('.', $_SERVER['SERVER_NAME']); + if(count($bits) > 1) { + $tldBit = $bits[count($bits)-1]; + $domBit = $bits[count($bits)]; + $domain = '.'. $domBit .'.'. $tldBit; + } + } + + $retval = setcookie($name, $value, $expTime, $path, $domain); return($retval); }//end create_cookie() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |