Jump to content

Recommended Posts

I was just wondering if a session is restricted to one website, because i am building a site and it basically says if $_SESSION = '' display this else display something else, i was just wondering could someone then make up a simple for that assigns something to a session with the same name as mine and the redirect to the site i am making with the session they have made?

Link to comment
https://forums.phpfreaks.com/topic/54734-php-session-question/
Share on other sites

no sorry i was just saying this quickly to get the point across,

 

when i user first enters the site they are assigned the session id of guest

 

$_SESSION['user'] = 'guest';

 

and when they login their customer number is then the session id

 

$_SESSION['user'] = $customer;

 

but when a page is loaded it would display something like

 

if($_SESSION['user'] == 'guest'){

echo "Login";

elseif($_SESSION['user'] != 'guest'){

echo "Customer details such as Previous Orders etc.";

}

 

I was just wondering if someone could set up a form which had a username, and then sent that to a php file which assigns that username to the session e.g.

 

$_SESSION['user'] = $username;

 

if they where then directed to my website, would that allow them access?

 

$_SESSION['user'] = $username;

header("Location:http://www.mysite.com");

 

Link to comment
https://forums.phpfreaks.com/topic/54734-php-session-question/#findComment-270719
Share on other sites

What? everything works... i was just wondering about the security issues behind it. Could someone set up a form which assigns there input to a session and then access my site and use the session created on their form to access customer menus on my site?

Link to comment
https://forums.phpfreaks.com/topic/54734-php-session-question/#findComment-270727
Share on other sites

For Firefox:

 

Do some task with session

save some data in session

open new instance for firefox.

now copy url from one instance to another.you will found auto set this session to another instance of fire fox.

If this is not risky for your application then do not worry about security with session.

this will not happen in IE.

Link to comment
https://forums.phpfreaks.com/topic/54734-php-session-question/#findComment-270729
Share on other sites

but that is someone loggin in then closing the browser and re-opening it, i mean for someone who wants to hack the website, if they were to create a session, which would technically be valid on my site if they where then to re direct to my site would this information be carried on or would it be destroyed since it is going to a new url?

Link to comment
https://forums.phpfreaks.com/topic/54734-php-session-question/#findComment-270733
Share on other sites

I was just wondering if a session is restricted to one website, because i am building a site and it basically says if $_SESSION = '' display this else display something else, i was just wondering could someone then make up a simple for that assigns something to a session with the same name as mine and the redirect to the site i am making with the session they have made?

 

I have to ask, are you making sure that session_start() is at the top of each page you are trying to use sessions on?

Link to comment
https://forums.phpfreaks.com/topic/54734-php-session-question/#findComment-270806
Share on other sites

they would need to get their hands on the session id.  as far as I know the variables stored in the session array are actually stored on the server itself and only the session id is stored as a cookie on the user's computer.  but using various tactics someone can get their hands on the session id itself and then it can be as easy as appending ?PHPSESSID=1342314213 to the url and they can access the user's session.  that's how i currently understand it at least but i stand to be corrected.

Link to comment
https://forums.phpfreaks.com/topic/54734-php-session-question/#findComment-271026
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.