Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Help Passing Session ID to Flash


Guest

Recommended Posts

OK.... I downloaded a contribute on how to get a flash header to store a session ID from oscommerce. I am pretty sure that I did everything the right way but If I click on any link in my flash header I get an undefined session id in my address bare so I am sure I am missing something. Hoping someone can help.

 

Here is the code that i am using in my action script in flash

 

// Hello everyone. My name is Chris Sullivan, and I am contributing this package so that the
// osCommerce community will finally have a real grasp on tackling flash and osCommerce. I have
// included a .fla (flash file), a .swf (compiled flash movie), and a .php file so that you can
// truly see ALL that goes into making this work. After unzipping the .swf and .php files into
// your root catalog directory (generally http://www.yourstore.com/catalog/) just replace the header.php
// file (found in /catalog/includes/) with the one I have included. You will instantly have a flash 
// navigation system that maintains osCommerce session ids. This flash file is merely meant to be used
// as a guide. If you'd like to customize the look and feel and use this on your site, feel free.

// If you find this useful, I would appreciate any donations which you feel like making. They can be made 
// through PayPal by making a donation to "[email protected]" (no quotes).

// Thanks, and I hope you find this useful.
// - Chris Sullivan
//   [email protected]

// EDIT THE URL BELOW TO FIT YOUR STORE'S MAIN DIRECTORY
var BASE = "http://mswallace.com/vacuumcenter/";

if ((osCsid != undefined) && (osCsid != '')) {
// if the variable osCsid has been defined and it contains a value (not empty), we 
// will load the flash_variables.php file with the session id appended at the end
// of the URL.
loadVariablesNum(BASE + "flash_variables.php?action=flash_variables&osCsid="+osCsid, 0, "POST");
} else {
// if the variable osCsid is undefined or it is defined but contains no value (it is
// empty) than we will load the flash_variables.php file without the session id
// so that osC will generate one for us and pass it back.
loadVariablesNum(BASE + "flash_variables.php?action=flash_variables", 0, "POST");
}


///This is the code that controls the home button

homeButton.onRollOver = function (){
homeButton.gotoAndPlay("overState");
}

homeButton.onRollOut = function (){
homeButton.gotoAndPlay("offState");
}

homeButton.onRelease = function (){
trace("The user has pressed the home button");
getURL("index.php?osCsid=" + osCsid);
}

///This is the code that controls the contact button

contactButton.onRollOver = function (){
contactButton.gotoAndPlay("overState");
}

contactButton.onRollOut = function (){
contactButton.gotoAndPlay("offState");
}

contactButton.onRelease = function (){
trace("The user has pressed the contact button");
getURL("contact_us.php?osCsid=" + osCsid);
}

///This is the code that controls the my account button

myAccountButton.onRollOver = function (){
myAccountButton.gotoAndPlay("overState");
}

myAccountButton.onRollOut = function (){
myAccountButton.gotoAndPlay("offState");
}

myAccountButton.onRelease = function (){
trace("The user has pressed the account button");
getURL("account.php?osCsid=" + osCsid);
}

///This is the code that controls the my cart button

myCartButton.onRollOver = function (){
myCartButton.gotoAndPlay("overState");
}

myCartButton.onRollOut = function (){
myCartButton.gotoAndPlay("offState");
}

myCartButton.onRelease = function (){
trace("The user has pressed the cart button");
getURL("shopping_cart.php?osCsid=" + osCsid);
}

///This is the code that controls the checkout button

checkoutButton.onRollOver = function (){
checkoutButton.gotoAndPlay("overState");
}

checkoutButton.onRollOut = function (){
checkoutButton.gotoAndPlay("offState");
}

checkoutButton.onRelease = function (){
trace("The user has pressed the checkout button");
getURL("checkout_shipping.php?osCsid=" + osCsid);
}

 

here is the code that I am using to pass the session id to flash in the flash flash_variables.php

 

<?php
/*
 $Id: flash_variables.php,v 1.00 200d/08/24 00:30:52 blueline Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

// Hello everyone. My name is Chris Sullivan, and I am contributing this package so that the
// osCommerce community will finally have a real grasp on tackling flash and osCommerce. I have
// included a .fla (flash file), a .swf (compiled flash movie), and a .php file so that you can
// truly see ALL that goes into making this work. After unzipping header.swf and flash_variables.php 
// (this file) into your root catalog directory (generally http://www.yourstore.com/catalog/) just 
// replace the header.php file (found in /catalog/includes/) with the one I have included. You will 
// instantly have a flash navigation system that maintains osCommerce session ids.

// If you find this useful, I would appreciate any donations which you feel like making. They can be made 
// through PayPal by making a donation to "[email protected]" (no quotes).

// Thanks, and I hope you find this useful.
// - Chris Sullivan
//   [email protected]

require('includes/application_top.php');

if (isset($_GET['action']) && $_GET['action'] == 'flash_variables') {
if (tep_session_is_registered('customer_id')) {
	print "&customer_id=" . $customer_first_name;
	print "&osCsid=" . str_replace("osCsid=", "", $SID);
} else {
	print "&customer_id=Guest";
	print "&osCsid=" . str_replace("osCsid=", "", $SID);
}
} else {
print "&customer_id=Guest";
print "&osCsid=" . str_replace("osCsid=", "", $SID);
}

?>

 

and here is the code that is in my header.php file

 

<?php
/*
 $Id: header.php,v 1.42 2003/06/10 18:20:38 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 // START STS 4.1
 $sts->restart_capture ('applicationtop2header'); // Capture header from the actual script, needed to take out javascript
 // END STS 4.1
// check if the 'install' directory exists, and warn of its existence
 if (WARN_INSTALL_EXISTENCE == 'true') {
if (file_exists(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/install')) {
  $messageStack->add('header', WARNING_INSTALL_DIRECTORY_EXISTS, 'warning');
}
 }

// check if the configure.php file is writeable
 if (WARN_CONFIG_WRITEABLE == 'true') {
if ( (file_exists(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/includes/configure.php')) && (is_writeable(dirname($HTTP_SERVER_VARS['SCRIPT_FILENAME']) . '/includes/configure.php')) ) {
  $messageStack->add('header', WARNING_CONFIG_FILE_WRITEABLE, 'warning');
}
 }

// check if the session folder is writeable
 if (WARN_SESSION_DIRECTORY_NOT_WRITEABLE == 'true') {
if (STORE_SESSIONS == '') {
  if (!is_dir(tep_session_save_path())) {
	$messageStack->add('header', WARNING_SESSION_DIRECTORY_NON_EXISTENT, 'warning');
  } elseif (!is_writeable(tep_session_save_path())) {
	$messageStack->add('header', WARNING_SESSION_DIRECTORY_NOT_WRITEABLE, 'warning');
  }
}
 }

// check session.auto_start is disabled
 if ( (function_exists('ini_get')) && (WARN_SESSION_AUTO_START == 'true') ) {
if (ini_get('session.auto_start') == '1') {
  $messageStack->add('header', WARNING_SESSION_AUTO_START, 'warning');
}
 }

 if ( (WARN_DOWNLOAD_DIRECTORY_NOT_READABLE == 'true') && (DOWNLOAD_ENABLED == 'true') ) {
if (!is_dir(DIR_FS_DOWNLOAD)) {
  $messageStack->add('header', WARNING_DOWNLOAD_DIRECTORY_NON_EXISTENT, 'warning');
}
 }

 if ($messageStack->size('header') > 0) {
echo $messageStack->output('header');
 }
?>
<link href="../stylesheet.css" rel="stylesheet" type="text/css" />

<?=// Start of flash header ?>
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="790" height="209" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<?=// Check to see if a session id has been defined in the URL ?>
<?php if ((isset($HTTP_GET_VARS['osCsid']) && ($HTTP_GET_VARS['osCsid'] != '')) || (tep_session_is_registered('osCsid'))) { ?>
<?=// If so, append it the the osCsid variable so that flash gets the proper session info ?>
<param name="movie" value="http://mswallace.com/vacuumcenter/flash/header.swf?osCsid=<?=$_GET['osCsid'];?>" />
<?php } else { ?>
<?=// If not, call the movie without defining the osCsid variable ?>
<param name="movie" value="http://mswallace.com/vacuumcenter/flash/header.swf" />
<?php } ?>
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<?=// Check to see if a session id has been defined in the URL ?>
<?php if ((isset($HTTP_GET_VARS['osCsid']) && ($HTTP_GET_VARS['osCsid'] != '')) || (tep_session_is_registered('osCsid'))) { ?>
<?=// If so, append it the the osCsid variable so that flash gets the proper session info ?>
<embed src="http://mswallace.com/vacuumcenter/flash/header.swf?osCsid=<?=$_GET['osCsid'];?>" quality="high" bgcolor="#ffffff" width="790" height="209" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> 
<?php } else { ?>
<?=// If not, call the movie without defining the osCsid variable ?>
<embed src="http://mswallace.com/vacuumcenter/flash/header.swf" quality="high" bgcolor="#ffffff" width="790" height="209" name="flash osc" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> 
<?php } ?>
</object>
<?=// End of flash header ?>
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="infoBox2">
 <tr class="headerNavigation">
<td class="InformationBoxContents">??</td>
<td align="right" class="InformationBoxContents"><?php echo $breadcrumb->trail(' ? '); ?>??</td>
 </tr>
</table>
<?php
 if (isset($HTTP_GET_VARS['error_message']) && tep_not_null($HTTP_GET_VARS['error_message'])) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
 <tr class="headerError">
<td class="headerError"><?php echo htmlspecialchars(urldecode($HTTP_GET_VARS['error_message'])); ?></td>
 </tr>
</table>
<?php
 }

 if (isset($HTTP_GET_VARS['info_message']) && tep_not_null($HTTP_GET_VARS['info_message'])) {
?>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
 <tr class="headerInfo">
<td class="headerInfo"><?php echo htmlspecialchars($HTTP_GET_VARS['info_message']); ?></td>
 </tr>
</table>

<div align="left">
 <?php
 }
?>
 <img src="../images/whiteBar.gif" width="790" height="5" /></div>

 

any help with this would be great.

 

thanks,

Matthew

Link to comment
Share on other sites

There is a contribution that explains how to do that. I don't recall the name of it but searching them all for flash will probably find it.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Link to comment
Share on other sites

yes I know I downloaded it and that is the code that I used and I can't get it to work correctly. It loades the flash header just fine but it will only pass an undefined session id to flash.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...