|
|
||||||
|
||||||
| Index Link To US Private Messages Archive FAQ RSS | ||||||
| IT Discussion Forum Having IT issues? Got IT questions? Who doesn't? If you can't get your Apache to work with your MySQL or your php is choking on your ODBC... Let's see if we can help you come up with some ideas. |
Share Thread: & Tags
|
||||||
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
||||
|
So I snagged this pretty good login script that uses sessions and now that I can get a user to log in but the tricky part is displaying only their data.
I was able to catch the randomly created id through this SQL statement "MD5(UNIX_TIMESTAMP()". Is it safe to use that generated variable as the condition to check and get the user's information?
__________________
Join free dating sites and meet single people without paying a penny. Submit your articles at my article directory and get quite a few instant back-links from other social sites! |
|
||||
|
OK thanks (again) wige...
So using the session is as the condition for selecting the user's data is ok security wise?
__________________
Join free dating sites and meet single people without paying a penny. Submit your articles at my article directory and get quite a few instant back-links from other social sites! |
|
||||
|
Um, well...
It really depends on how sensitive the data in question is. If you are talking about simply editing a user profile on a social networking site, that should be fine. If you are talking about financial, or medical information, additional authentication should be done, such as reconfirming the user's password from within an encrypted channel. In theory, an unauthenticated user could hijack a session from an authenticated user on a standard HTTP connection. The protection against this is to "reinitialize" the session and reauthenticate the user. This requires the use of secure cookies, and that all communication within the secure area of the site be done over HTTPS. Additional security can be achieved against hijacking by continuously checking the user's IP address. The basic workflow would be as follows: The user comes into the web site as an unauthenticated user, and is assigned a session id. The user goes to the secure site to authenticate, and the unauthenticated session id is reset. The user authenticates, and the session now stores the user's id and IP address, but no other authentication information. The user returns to to the unsecure section of the site and continues browsing, keeping the same session id. The user decides to access secure information, and returns to the secure area of the site. The user's session is reset, the current IP address is checked against the IP stored in the session, and the user is prompted to re-enter their password. The user reauthenticates, and maintains the same session id, and proceeds to access the secure information. This method can be less friendly from a user standpoint, since the user has to reenter their password each time they go to the secure area of the site, and as a result this approach may only be desired if you are storing sensitive information. Most sites do not take this type of precaution, as it can be a bit of overkill for most situations.
__________________
The best way to learn anything, is to question everything. |
|
||||
|
Very well then...in my case it is only about being able to view their own data and edit it as they please...My only worry is that somehow they end up being able to edit other members information but as you mentioned, if I check their password and session ID I should be safe...there really isn't too much personal data - just profile information and at most the users email address...
Thanks so much wige - you're always great help!
__________________
Join free dating sites and meet single people without paying a penny. Submit your articles at my article directory and get quite a few instant back-links from other social sites! |
|
||||
|
And you can write a wrapper around PHP's session functions
Code:
<?php
/**
* A wrapper around PHP's session functions
* <code>
* $session = new Session();
* $session->set('message','Hello World!');
* echo ( $session->get('message'); // Displays 'Hello World!'
* </code>
* @access public
*/
class Session
{
/**
* Session constructor<br />
* Starts the session with session_start()
* <b>Note:</b> that if the session has already started,
* session_start() does nothing
* @access public
*/
public function __construct()
{
session_start();
}
/**
* Sets a session variable
* @param string name of variable
* @param mixed value of variable
* @return void
* @access public
*/
public function set($name, $value)
{
$_SESSION[$name] = $value;
}
/**
* Fetches a session variable
* @param string name of variable
* @return mixed value of session varaible
* @access public
*/
public function get($name)
{
if (isset($_SESSION[$name]))
{
return $_SESSION[$name];
}
else
{
return false;
}
}
/**
* unsets a session variable
* @param string name of variable
* @return void
* @access public
*/
public function del($name)
{
unset($_SESSION[$name]);
}
/**
* Destroys the whole session
* @return void
* @access public
*/
public function destroy()
{
$_SESSION = array();
session_destroy();
session_regenerate_id();
}
}
?>
Your program is no more secure than your coding.
__________________
Mini Network:: Financial information at your fingertips Learn object oriented programming where it started I will use a search engine before I ask dumb questions. Last edited by kgun; 11-25-2009 at 03:00 PM. |
|
||||
|
thank you too kgun...i shall look into this as well...I truly need to strengthen my PHP coding as well...it is time...
__________________
Join free dating sites and meet single people without paying a penny. Submit your articles at my article directory and get quite a few instant back-links from other social sites! |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| For Sale: T-Rex Dinosaur (Good Condition) | TrafficProducer | The Castle Breakroom (General: Any Topic) | 3 | 09-13-2009 03:08 PM |
| Secure and non-secure things on checkout pages | rjjj111 | eCommerce Discussion Forum | 2 | 07-10-2008 09:23 AM |
| Keyword Selector Tool | Zhoog | Submit Your Site For Review | 1 | 01-09-2008 11:49 PM |
| PHP condition | Nanor21 | Web Programming Discussion Forum | 5 | 05-13-2006 11:41 PM |
| Google Analytics on site with secure and non secure pages? | joer80 | Google Discussion Forum | 7 | 12-07-2005 01:15 AM |
|
WebProWorld |
Advertise |
Contact Us |
About |
Forum Rules |
MVP's |
Archive |
Newsletter Archive |
Top |
WebProNews
WebProWorld is an iEntry, Inc. ® site - © 2010 All Rights Reserved Privacy Policy and Legal iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509 |