Re: basket logo replacement

From: Date: Wed, 14 Mar 2001 16:07:20 +0000
Subject: Re: basket logo replacement
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-43887@lists.php.net to get a copy of this message
use sessions, there is no reason why cookies would be better then sessions, I dont know of any at least. time.egn <?php function mtime() { $mtime = microtime(); $mtime = str_replace('.', '', $mtime); $mtime = explode(' ', $mtime); $mtime = $mtime[1] . $mtime[0]; return($mtime); } ?> session.egn <?php include_once('time.egn'); if ( isset($PHPSESSID) ) session_id($PHPSESSID); session_start(); if (!isset($HTTP_SESSION_VARS['SessionID'])) { $SessionID = mtime(); session_register('SessionID'); } $PHPSESSID = session_id(); $SID = "PHPSESSID=$PHPSESSID"; ?> cart_class.egn <?php include_once('session.egn'); class cart { function reset() { $all_vars = get_object_vars($this); foreach($all_vars as $pos => $val) if ($pos != 'error') unset($this->$pos); } function add($product_id, $product_quan = 1) { if ($product_quan < 1) $product_quan = 1; $this->cart_product_id[$product_id] = $product_id; $this->cart_product_quan[$product_id] = $product_quan; } function delete($product_id) { unset($this->cart_product_id[$product_id]); unset($this->cart_product_quan[$product_id]); if ( !count($this->cart_product_id) ) { unset($this->cart_product_id); unset($this->cart_product_quan); } } function update($product_id, $product_quan) { if ($product_quan < 1) $product_quan = 1; $this->cart_product_id[$product_id] = $product_id; $this->cart_product_quan[$product_id] = $product_quan; } } $cart = new cart; if (!isset($HTTP_SESSION_VARS['cart'])) { $cart = new cart(); session_register('cart'); } ?> <?php if (isset($cart->cart_product_id[$product_id])) echo "item in cart"; else echo "item NOT in cart"; ?> check if the stockno is in the cart, if it is display a differnet icon -- Chris Lee Mediawaveonline.com ph. 250.377.1095 ph. 250.376.2690 fx. 250.554.1120 lee@mediawaveonline.com ""Mark Lo (3)"" <mark@3dsources.com> wrote in message news:00ac01c0acad$bf7c7be0$2e53fea9@Mark... Hi, What is the best method to replace a logo after the user add that specific item into their basket. eg. Add to basket ---> In basket Assume I am using cookie and database.... In addition, would you prefer your inquiry basket system to running under session or cookie and database !!! Which method is the best ?? Thank you Mark Lo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#43887) next »