MyTechSupport.ca :: Your Computer Technical Resource Headquarters! MyTechSupport.ca :: Your Computer Technical Resource Headquarters!
HOME FORUMS RESOURCES & TOOLS ARTICLES ONLINE STORE ABOUT US
Computer Support Forums arrow Software Support arrow Programming Problems arrow Topic: ?Cookie Coding Problem?
March 23, 2019, 07:49:48 AM
 

Home Forum Rules Help Search Mobile Version Login Register

Welcome, Guest. Please login or register.
Did you miss your activation email?
March 23, 2019, 07:49:48 AM

Login with username, password and session length
 
News
Welcome to MyTechSupport.ca! - Registration is FREE, so why not join our friendly community today?
  0 Members and 1 Guest are viewing this topic.
Pages: [1] Go Down Print
Author Topic: ?Cookie Coding Problem?  (Read 2262 times)
TimmyC
Newbie
*

Karma: +0/-0
Offline Offline

Posts: 1


Bookmark and Share

View Profile
« on: February 07, 2007, 07:51:02 PM »

Hello,

   I was wondering if anyone could help me figure out why my coding is not setting the cookie
as it should.  I've checked write permission issues, and that doesnt seem to be it. Its not even
trying to place the cookie and failing, just not writing it at all.  As this is for a shopping cart
program,  it is slightly essential to have the cookie set for anyone to add items to their cart.

Below is the code portions that deal with session creation and cookie set/get.

Thanks
TimmyC


//CCGetCookie @0-705AF8CB
function CCGetCookie($parameter_name)
{
    global $HTTP_COOKIE_VARS;
    return isset($HTTP_COOKIE_VARS[$parameter_name]) ? $HTTP_COOKIE_VARS[$parameter_name] : "";
}
//End CCGetCookie

//CCSetCookie @0-1E0B074A
function CCSetCookie($parameter_name, $param_value)
{
  setcookie ($parameter_name, $param_value, time() + 3600 * 24 * 366); 
}
//End CCSetCookie




//CCGetSession @0-9BBC6D71
function CCGetSession($parameter_name)
{
    global $HTTP_SESSION_VARS;
    return isset($HTTP_SESSION_VARS[$parameter_name]) ? $HTTP_SESSION_VARS[$parameter_name] : "";
}
//End CCGetSession

//CCSetSession @0-0F088E96
function CCSetSession($param_name, $param_value)
{
    global $HTTP_SESSION_VARS;
    global ${$param_name};
    if(session_is_registered($param_name))
        session_unregister($param_name);
    ${$param_name} = $param_value;
    session_register($param_name);
    $HTTP_SESSION_VARS[$param_name] = $param_value;
}
//End CCSetSession

Thanks for your help with this,
TimmyC Huh?
Logged
redaxe
Supreme Loonie
Global Moderator
Hero Member
*****

Karma: +16/-0
Offline Offline

Gender: Male
Posts: 1276


Bookmark and Share

View Profile
« Reply #1 on: April 20, 2007, 08:18:10 PM »

Off the top of my head, it seems like you're using two names for the same variable, i.e. $parameter_name and $param_name

Not that I'm much of a cookie programming expert, but to me this looks like one of the proof reading oversights that happen occasionally.
Logged

Pages: [1] Go Up Print 
 
Jump to:  

Powered by MySQL Powered by PHP

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS!

Disclaimer
This site is NOT responsible for any damage that the information on this site may cause to your system. Everything you try, whether inspired by the response given from this site or not, is entirely at your own risk. All product names and company names used herein are for identification purpose only and may be trademarks or registered trademarks of their respective owners. We are in no way affiliated or representing any of the companies on this site unless specified.
Back to Top
Stop Spam Harvesters, Join Project Honey Pot Fight Back Against Spammers! Get Firefox! Get Thunderbird! View Sylvain Amyots profile on LinkedIn
Back to Top
Google visited last this page June 11, 2018, 10:24:37 AM