Hello.
I create a site with an admin area.
You have to login with a passwort.
Then you can change data in the database.
I wouldn!t like to come back to this sites in the admin area with the back button or when I have the right URL I should also came back to login.
How can I do this?
login.php:
<?php
$myvar = "FALSE";
$myuser = "";
$mypass = "";
if (isset($HTTP_POST_VARS["sendit"])) {
$myuser = $HTTP_POST_VARS["user"];
$mypass = $HTTP_POST_VARS["password"];
$myvar = "TRUE";
if ( $myuser =="frodo" && $mypass =="frodo"){
session_start();
$_SESSION["reg"] = $myuser;
header("Location: news.php");
exit;
}
}?>
<table>
<tr>
<td>
<form name="form1" method="post" action="<? $_SERVER['PHP_SELF'] ?>">
<table width="380" border="0">
<tr>
<td align="center" valign="middle"><table width="280" border="0" cellspacing="15">
<tr align="center">
<td colspan="2" class="ueberschrift">Administration</td>
</tr>
<?php if ($myvar == "TRUE") { ?>
<tr>
<td class="text" colspan="2">Benutzer oder Passwort ist falsch.</td>
</tr>
<? } ?>
<tr>
<td class="text">user:</td>
<td><input name="user" type="text" id="user" size="30"></td>
</tr>
<tr>
<td class="text">password:</td>
<td><input name="password" type="password" id="password" size="30"></td>
</tr>
<tr align="center">
<td colspan="2"><input type="submit" name="sendit" value="Log in"></td>
</tr>
</table></td>
</tr>
</table>
</form></
</tr>
</td>
</table>
Insite: news.php
<?php
session_start();
if ( isset($_SESSION['reg'])){
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>news</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="styles.css" rel="stylesheet" type="text/css">
</head>
<body background="vote/fertig/hintergrund.gif" leftmargin="8" marginwidth="8" topmargin="8" marginheight="8">
<div align="center">
<table border="0" width="621" cellspacing="0" cellpadding="0">
<tr>
<td colspan="3" valign="top"><img src="vote/fertig/obere_leiste2.gif" alt="i vote.com" width="621" height="30"></td>
</tr>
<tr>
<td width="220" valign="top"> <a href="index.php"><img src="vote/fertig/logo5.gif" alt="logo i vote.com" width="220" height="113" border="0"></a><br>
<img src="vote/fertig/admin_links.jpg"></td>
<td width="380" height="397" bgcolor="#FFFFFF" valign="middle">
<table width="380" border="0">
<tr>
<td align="center" valign="middle"><table width="280" border="0" cellspacing="15">
<tr>
<td class="ueberschrift">News</td>
</tr>
<tr>
<td><a href="new.php">new</a></td>
</tr>
<tr>
<td><a href="edit.php">edit</a></td>
</tr>
<tr>
<td><a href="delete.php">delete</a></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><a href="index.php">back to homepage</a></td>
</tr>
</table></td>
</tr>
</table>
</td>
<td width="21" valign="top"><img src="vote/fertig/admin_rechts.jpg" width="21" height="397"></td>
</tr>
<tr>
<td colspan="3" valign="top"><img src="vote/fertig/untere_leiste.gif" alt="sign"></td>
</tr>
</table>
</div>
</body>
</html>
<?php }else{
session_destroy();
header("Location: login.php");
}?>
Please help me
Thank you