Using PHP in a JS menu to redirect if no SESSION_NO found

General discussions related to php

Moderators: macek, egami, gesf

MaineWebGirl
New php-forum User
New php-forum User
Posts: 3
Joined: Wed Apr 16, 2003 6:55 am
Location: Maine

Using PHP in a JS menu to redirect if no SESSION_NO found

Postby MaineWebGirl » Wed Apr 16, 2003 6:56 am

I have a javascript menu with this call (and many other similar):
http://64.179.21.93/cgi-bin/nl/nldemo.b ... ASK=IIMXKS

the "SESSION_NO" part of the call tells our system the username and password of the customer logged in. If you haven't logged in, either with username and password or as a new customer, you have no session number. I would like the call above to be able to check for a session number and, if there isn't one, redirect the user to this call instead:
http://64.179.21.93/cgi-bin/nl/nldemo.b ... _id=clogin

I was told that I could use PHP:
<? if (session_id=="){do thelogin ;} ?> but I don't know anything about PHP at all. Even if that is exactly the right command I don't know where to put it.

Somebody at another forum suggested a redirect PHP, but it doesn't work. I don't think the responder took into account that I wouldn't want to redirect from every page, just when someone selects a menu option that needs a session_no.


PS-If you try that first link with the session_no, it will probably be timed out. IF you wanted to try it out, you could go to the second link and use the new customer link and go from there.

Any ideas? It would be greatly appreciated!!!!

User avatar
WiZARD
Moderator
Moderator
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Re: Using PHP in a JS menu to redirect if no SESSION_NO foun

Postby WiZARD » Thu Apr 24, 2003 6:35 am

at youre place i'm just asking about user_id where user_id it's not session_id it's a session_name by the way you may save with long life time cookie on user computer with name of user an each pache just check session_name that's all

MaineWebGirl
New php-forum User
New php-forum User
Posts: 3
Joined: Wed Apr 16, 2003 6:55 am
Location: Maine

Not sure I understand

Postby MaineWebGirl » Thu Apr 24, 2003 9:54 am

This might just be over my head. Are you suggesting that I use cookies to check for session name? I've had trouble figuring out how to get that to happen.

I'm afraid I don't know what this means at all :oops: :
user_id where user_id it's not session_id it's a session_name

I appreciate the response though. I'll look into cookies some more.

User avatar
WiZARD
Moderator
Moderator
Posts: 1257
Joined: Thu Jun 20, 2002 10:14 pm
Location: Ukraine, Crimea, Simferopol
Contact:

Re: Not sure I understand

Postby WiZARD » Thu Apr 24, 2003 11:04 pm

Hi again!

oops!....
first you may collect in one session_name few [/b]session_register[/b] name
and second session_cookie you may save not on user computer... you may do that at server!
:wink:

P.S.
by the way why to you need check exactly that <? if (session_id=="){do thelogin ;} ?>?

MaineWebGirl
New php-forum User
New php-forum User
Posts: 3
Joined: Wed Apr 16, 2003 6:55 am
Location: Maine

Why Check

Postby MaineWebGirl » Tue Apr 29, 2003 7:31 am

Well, we have sort of a search feature in the menu. If a customer is logged in and they use that feature, we want it to call one request, if they are not logged in, we want it to call another (the login page).

You can look at it if you are curious. It is at http://64.179.21.93/cgi-bin/nl/nldemo.b ... _id=clogin

Until I figure out how to make the cookies work you'd have to click on the link for new customer and then you can use the drop-down menu under "Products". Choose any option.

Thanks for your repsonse. I think this might be one for the experts.....or at least someone who is not so lost as I am when it comes to any sort of programming no matter how simple!


Return to “PHP General”

Who is online

Users browsing this forum: No registered users and 1 guest