Search Engine Friendly URLs / Shopping Cart / PHP Question..

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
superwormy
Forum Commoner
Posts: 67
Joined: Fri Oct 04, 2002 9:25 am
Location: CT

Search Engine Friendly URLs / Shopping Cart / PHP Question..

Post by superwormy »

I'm all outa ideas, hopefully someone here has something that can help me. I wanted to build a PHP shopping cart, and website that would be driven by MySQL. So I got everything working pretty well for the most part, even using Search Engine Friendly URLs ( ie no query strings )

So my URLs look like this:

href="index.php/user/2398525"

Or somethign similar, where 2398525 is a randomly assigned UserID which gets passed to every page through the URL.

The problem I thought of, is that when search engines index my pages, they will be indexing whatever UserID they have, and then when people find my pages in search engines, everyone that comes from the search engine will have the same damn UserID... ie they will all be going to index.php/user/[whatever userid the search engine had when it spidered website]

Which means that a lot of users could end up with the same UserID... which could cause problems in people putting things in others shopping carts and such...

Can anyone think of a way to get around this? To fix this? If I could tell it was a search engine, I could just not use a UserID for it... anyway to do this?

Thanks!
jason
Site Admin
Posts: 1767
Joined: Thu Apr 18, 2002 3:14 pm
Location: Montreal, CA
Contact:

Post by jason »

Don't pass the session ID in the URL.
superwormy
Forum Commoner
Posts: 67
Joined: Fri Oct 04, 2002 9:25 am
Location: CT

Post by superwormy »

Then I'd have to use Cookies... which I didn't want to do...

Unless you have a better solution?
User avatar
nielsene
DevNet Resident
Posts: 1834
Joined: Fri Aug 16, 2002 8:57 am
Location: Watertown, MA

Post by nielsene »

Then store two things in the URL, the sessionID and a timestamp. If the timestamp is too old, direct to some welcome page. This will stop search engine redirects from going to the wrong place. If you want to stop users from manually editing these values, you'll want to also in a MAC generated with a constant server side secret.
kawika
Forum Newbie
Posts: 6
Joined: Wed Sep 18, 2002 8:34 pm
Location: San Diego

Detect search engine URL's

Post by kawika »

You can also detect the incoming URL or IP and ignore the sessionid if it's say search.yahoo.com.
Post Reply