0

I'm making a website in which there is a login page and then the home page.. Now once I have logged in I want this to happen.

It should not go back to the login page when I click THE BROWSER BACK BUTTON.

It should refresh the home page jus like HOW FACEBOOK DOES..

I have checked and googled but I am not finding the answer...

I would really appreciate it if anyone helps me... Thank You..

This is the login page.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>mindclik</TITLE>
<link rel="stylesheet" type="text/css" href="stylesheets\home.css">
<link rel="stylesheet" type="text/css" href="stylesheets/home.css">
</HEAD>
<BODY>
<div id="wrap">
<div id="main">
<div id ="left">
</br>
<h2>Login</h2>
<form id="login_form" action="home.php" method="post" >
<table >
<tr>
<td>
Email:
</td>
<td>
<input type="text" name="email" id="email" class="login_tb" >
</td>   
</tr>
<tr>
<td>
Password:
</td>
<td>
<input type=password name="pwd" id="pwd"" class="login_tb"> 
</td>   
</tr>
<tr>
<td>
</td>
<td>
<input type=submit id="sub" value="SignIn">
</td>
</tr>
</table>
</form></div>
</div></div>

This is the homePage.php

<?php 

$p_uname=$_POST['email'];
$p_pass=$_POST['pwd'];
$enc_pass=md5($p_pass);
?>   
<html>
<head>
    <title>Home</title>
    <link rel="stylesheet" type="text/css" href="stylesheets/home1.css">

</head>
<body>


<div id="wrap">

<div id="left_contain"> Friend List</div>
<div id="main"></div>
<div id="right_contain_top">Friend New Answers</div>
<div id="right_contain_bot">Questions From AOF</div>
</div>
</body>
</html>
Roshan Vincent
  • 89
  • 1
  • 12

1 Answers1

0

You can set cookies once the user is authenticated. On successful login

 setcookie("Valid", $user_name);

In the login page place this at the top.

<?php
 if ($_COOKIE['Valid'] == $user_name ) {
    header( 'Location: homepage.php' ) ;
 }
?>

This hack would work. Change the file extension of login page to .php

Sudeep
  • 27
  • 3