Skip to content
WJunction - Webmaster Forum

[PHP] Session's secure

Status
Not open for further replies.
Hello,
I am currently making something in PHP,and I have login and It works with Sessions,I saw attack called 'Session Hijacking' so I'll ask you if this vulnerable to 'Session Hijacking'.
So,I check if username & password is equal to username & password in database if yes it gives it $_SESSION['username'] = $username and $_SESSION['AdminId'] = 1.
PHP:
<?php
$username = mysql_real_escape_string($_POST['username']);
....
if ($row > 0) {
$_SESSION['username'] = $username;
$_SESSION['AdminID'] = 1;
}
?>
Now in other file I check sessions:
PHP:
<?php
if(!empty($_SESSION['username']) and $_SESSION['AdminID'] == 1) {
echo "Logged in!";
} else {
echo "Not logged in!";
}
?>
Thanks in advance, k0d3.
 

2 comments

Status
Not open for further replies.

About the author

N
Active Member · Joined
42
Messages
0
Reactions
6
Points

Advertise on WJunction

Reach 1000's of webmasters, hosts & affiliates. Banner & sponsored-thread slots available.

Contact us
Back
Top Bottom