Jump to content

how to make a logon page more secure?


cluce

Recommended Posts

I was talking about on the internet browsers.........I am trying to prevent the user from logging on with the next and previous buttons on the browser. Even after they log out.  can someone me any suggestions on how to disable this?? What code or functions could I use??

 

thanks for your replies. I will check it out.

here is the code I am using .......can someone tell me how to modify this on how I can do this.....

 

<?php

//check for required fields from the form

if ((!isset($_POST["username"])) || (!isset($_POST["password"]))) {

header("Location: userlogin.html");

exit;

}

 

//connect to server and select database

$mysqli = mysqli_connect("localhost", "root", "", "test");

 

//create and issue the query

$sql = "SELECT f_name, l_name FROM auth_users WHERE username = '".$_POST["username"]."' AND password = PASSWORD('".$_POST["password"]."')";

$result = mysqli_query($mysqli, $sql) or die(mysqli_error($mysqli));

 

//get the number of rows in the result set; should be 1 if a match

if (mysqli_num_rows($result) == 1) {

 

//if authorized, get the values of f_name l_name

while ($info = mysqli_fetch_array($result)) {

$f_name = stripslashes($info['f_name']);

$l_name = stripslashes($info['l_name']);

}

 

//set authorization cookie

setcookie("auth", "1", 0, "/", "yourdomain.com", 0);

 

//directs authorized user

header("Location: logon.php");

 

//prevents cache of logon info

  header("Cache-Control: no-cache, must-revalidate");

      header("Expires: Mon, 01 Jan 1900 00:00:00 GMT");

 

} else {

//redirect back to login form if not authorized

header("Location: registration.html");

exit;

}

?>

<html>

If you have a header file, it would be best to put it at the top of that script. Then it will be in effect on every page the users click. Or if you are just worried about your "logout" page...put it at the top of the logout script...

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.