Jump to content

Recommended Posts

i have a log-in system where it stores a session named 'agent' which store HTTP_USER_AGENT and what i have done is made a file named gatekeeper and what that does is check that the session is set and that it matches the md5 HTTP_USER_AGENT session if none are true then it directs them to the log in page is this a good way to protect pages this is my gatekeeper file

<?php 
//lockdown and check for login
if (!isset($_SESSION['agent']) or ($_SESSION['agent']) !== md5($_SERVER['HTTP_USER_AGENT'])) {
require_once ($_SERVER['DOCUMENT_ROOT'].'/login_functions.inc.php');
$url = absolute_url();
header("Location: $url");
exit();	
} else { // everythings ok
}
?>

Link to comment
https://forums.phpfreaks.com/topic/165108-solved-security-question-need-solving/
Share on other sites

The user can not change any session information unless you allow them to. The session data is stored on the server. However if you are using a shared host any other webmaster on that server could see and modify this data. Thus you should create your own secure area for your sessions.

thank you alot but 1 more question

 

i i where to have code on the pages i wanted to be protect only for login members would it be ok

 

if i used a if(!isset($_session['agent'])){

then return them to loggin page

} else { //is logged in

 

would that be secure enouth to protect my pages against not logged in members.

For your code that depends on how you are validating if they are allowed to be an agent.

No webmaster is any other person that has hosting on the same shared server as you. For instance your friend Dan could be paying the same company for hosting and they may put you both on the same shared server. Now if he is smart he can access all of your session data that is stored in the same default location as his session data.

so how would i go about protecting my sessions

 

Store them in a non-publicly accessible directory or create a session handler that stores in a database instead.

 

and whats SSL where that padlock is in the conner how do i implay that into my code

 

http://en.wikipedia.org/wiki/Secure_Sockets_Layer

http://en.wikipedia.org/wiki/HTTPS

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.