Am I right about PHP sessions?
Hi all, again :)
I am working with new SMALL project and I want to make some thing clear:
Login page:
PHP Code:
$password = md5($_POST['password']);
$nick = $_POST['nick'];
$password = mysql_real_escape_string($password);
$nick = mysql_real_escape_string($nick);
$nick = strtolower($nick);
if(info is INcorrect) {ERROR} else {
session_start();
$_SESSION['nick'] = $nick;
$_SESSION['password'] = $password;
$_SESSION['authID'] = 'your_special_ID';
(Redirect to safe_page.php)
}
What I want? Protection level :)
1. I think variables are safe... IS IT?
password is md5;
nick, pass = mysql_real_escape_string
nick = strtolower.
2. I used session_start(); Do I need something more to start session?
3. $_SESSION variables which I will use. Are thay correct?
4. IS all of the login page script secured?
OK, now - other pages, which I will keep in safe:
safe_page.php
PHP Code:
if(isset($_SESSION['authID'])) {
include $_SERVER['DOCUMENT_ROOT'] . '../db_conn.php';
$dates = date("Y-m-d");
$times = date("H:i:s");
$upnick = $_SESSION['nick'];
(access granted)
} else {
header("Location: ../login.php"); // Not allowed
}
1. Is this session right?
2.How much is it safe?
What can you offer to increase my security level?
I want to THANK YOU ALREADY, because there Are a lot of questions :D
Also, all suggestions are welcome :)