OKay, I am trying to get a somewhat secure login system with a secure Admin section where my whole site can be updated from. Below is a couple of things that I am working on, I have added some lines just now and have not tested them yet. Please let me know what you think and what I could do better.
<?php
session_start();
if (!$_session['login'] == "true"){
$username=$_REQUEST['username'];
$userpass=$_REQUEST['userpass'];
$random=md5($_REQUEST['random']);
include'mconnect.php';
$SelectTable = mysql_query("SELECT * FROM Users WHERE user ='$username' ");
$row = mysql_fetch_array ($SelectTable);
$correctpassword= $row["password"] . $random;
$correctpassword= md5($correctpassword);
if ($userpass == $correctpassword){
$_SESSION['login']="true";
$_SESSION['user']=$username;
$_SESSION['status']=$row["status"];
}
else{
$_SESSION['error'] = "Password Incorrect";
}
mysql_close($mconnect);
}
header("LOCATION: control.php");
?>
my Login page where the user types his / her name and password get a Random number from the server that is Hashed and then added to the already hashed password and hashed together using a Java script. Basicly I want to make sure that the password is not send in plain text and is not the same thing everytime and make it a little bite of a challange to reverce the MD5 hash.
( ClientSide hash Explained )
Take Users Password and MD5 Hash it.
Then hash the Random number and add it to the END of the Password Hash and hash those 2 combined.
Now for my security check system where I see if the user is loged in and allowed to view a site I am getting kind of stuck, as of now here is what I have.
<?php
if (!$_SESSION["login"] == "true"){
header("LOCATION: index.php");
exit();
}
?>
I was thinking that I could add a little more security by saving the IP address of the client in someway on the server and checking to see if the clients IP address is the same when they run thru the security.
This is a work in progress, I have looked around and was not able to find someone posting a whole security system. I know that nothing is un-hackable, even SSL is not completely secure. I just want something that is decent for security.
if you have any suggestions please post it here, as I keep working on the code I will keep updating it here.