Jump to content

About security


NewBob

Recommended Posts

Hi everyone!

 

I'm using a session class for holding information about the loged in user.

At every page I have the server check if

$session->logedIn

is true or false. This is set

at every pagerequest in the constructor of the session class.

I'm not sure how exactly session variables are stored but I read something about it being stored in

a cookie or the header?

Anywho, my question is this: is it possible for someone to set his own session variable that is

called logedIn and in that way make the server think that he is a loged in user granting him access

to memberpages?

How should I check if it is a loged in user otherwise?

 

Thanks in advance,

/Bob

 

Link to comment
https://forums.phpfreaks.com/topic/47869-about-security/
Share on other sites

true...

also... the session_id() is a random based string alpha numeric... even if they find a way to change it, they got at least  1/1000000000 chance of getting somebody else's sessid...

 

when it comes to those odds... if your going to try and hack it... i say... bring it... lol

Link to comment
https://forums.phpfreaks.com/topic/47869-about-security/#findComment-233885
Share on other sites

also...

just as forwarning...

$_SESSION[test]='test';
$test='blah';
echo $_SESSION[test]; // outputs blah

 

which can be useful for hackers...

 

i HIGHLY suggest against storing strings into $_SESSION...however... if you store your user info like this...

$query();//your login query here
$row=mysql_fetch_array($query);
if(!empty($row)){
$_SESSION[user]=$row;
unset($_SESSION[user][password]);
}

 

that way...  you just

 

if(is_array($_SESSION[user])&&!empty($_SESSION[user])){}

 

you have access to all of your user information, and dont have to deal with hackers (arrays cant be transfered to $_SESSION[] through $_GET/$_POST nearly as easily...)

Link to comment
https://forums.phpfreaks.com/topic/47869-about-security/#findComment-233903
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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