Solved

osCommerce specific PHP question. How to generate osCsid immediately upon entering first page

Posted on 2006-10-30
2
456 Views
Last Modified: 2007-12-19
I have been modifying osCommerce to simply go to an initial page with 2 products, both with an order now button.

The problem is that when clicking the order now button, it goes to a blank page. I then click Back on my web browser and it goes back to the 2 products page.

The difference with seeing it this second time is that the 2 products page now has an osCsid session variable. - I can now click Order Now, and it goes to the cart with the item added.

How can I get this variable to generate upon immediately entering index.php?cPath=0 (Which is the initial page I enter to from an iFrame).

I was hoping there would be a function within osCommerce that will let me generate an osCsid, just by putting gen_osCsid() at the top of the page or something.

0
Comment
Question by:wbstech
2 Comments
 
LVL 7

Accepted Solution

by:
CraigHarris earned 500 total points
Comment Utility
Frames are ugly and don't work on many platforms - do you really need them? -- there are extremely few justifications for such on today's web.


Sometimes the easiest workarround for buggy session handling is to force a redirect, e.g. from the index page, do:

<?php
  Session_Start();
  // osCommerce-specifc session handling goes here if needed
  Header('Location: /index.php?cPath=0');
?>
0
 
LVL 4

Author Comment

by:wbstech
Comment Utility
You're certainly right about frames. Although I think iFrames still have a place and a use in some circumstances.

In this one it was the fact that we needed to include a simple osCommerce website inside an existing design. We couldn't incorporate the existing static design into osCommerce because it wasn't cost-effective for the customer. So an iFrame was the only choice.

I did your suggestion above but ran into some small errors. I modified the idea and just used a 1 second meta refresh, which isn't noticeable.

I had to add some PHP to make sure the meta refresh occurs just once, and this works fine.

Certainly not the cleanest way to do it. But time and money are the biggest issues on this project now.

Thanks for the idea.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now