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.

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

you cannot disable the back/forward buttons, however if you turn off your cache, and verify if the user is logged in on all of your "secured" spots... if they press back, it'd redirect them to a different page...

Link to comment
Share on other sites

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

header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

header("Cache-Control: post-check=0, pre-check=0", false);

header("Pragma: no-cache");

 

there goes any/all forms of cache

Link to comment
Share on other sites

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.