Hello,
Thanks for the quick reply.
I'm not sure if i came accross right. The code shown is from the file check.php. so why would i use html code?
Here are the three files:
admin_login.html
check.php
admin.php
here are the codes:
admin_login.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Add Contact - Administration</title>
</head>
<body>
<form action="check.php" method="post">
<table width="261" border="0" align="center" cellpadding="10" cellspacing="10">
<tr>
<td width="74">Name: <input name="name" type="text" /></td>
<td width="117"> </td>
</tr>
<tr>
<td>Password: <input name="pass" type="text" /></td>
<td><input name="submit" type="submit" value="Login" /></td>
</tr>
</table>
</form>
</body>
</html>
the check.php
<?php
$name=$POST['name'];
$pass=$POST['pass'];
if ($name==("admin") & $pass==("login") ) {
$SESSION['name']="name";
$SESSION['pass']="pass";
header("admin.php");
}
else echo 'Something went wrong. Go again';
?>
admin.php
<?php
session_start();
if(!$_SESSION('pass')) {
echo 'good';
}
?>
<html>
<body>
<p>this is the admin page</p>
</body>
</html>
when the session passes I sould then add new fields instead of echo 'good' but i just did this so i can test it.
I got it from youtube: https://www.youtube.com/watch?v=HeavBljJppE