Greetings,
I have an index.php which has a login form in it.. .. When I login the variables from the form are called $login and $password. How do I pass these variables to several other pages when I load another page.
You can see it here http://cbits.ca/Emerchant/Admin/
login: Admin
password: Jc4rs0n
When you login and click index.php or CompanyInfo it says Access denied because the variables are not being passed eveythime the page is loaded.
Here is my index.php
<link rel="stylesheet" href="theme.css" type="text/css">
<?php
require ("config.php");
$login = $POST[login];
$password = $POST[password];
/***************************************************************************************************/
/Check database to make sure Login and Password were correct,if they were then Mainpage is displayed/
/**********************************************************************************************/
$result = mysql_query("SELECT adminlogin AND adminpasswd FROM Admin WHERE adminlogin='$POST[login]' AND adminpasswd='$POST[password]'") or die("Database not working");
if (mysql_num_rows($result) == 1) {
include ("admin.php");
/*******************************************************************/
/Defaults to login form OR If login was incorrect remains at login form/
/********************************************************************/
} else {
if (mysql_num_rows($result) == 0) {
?>
<div align="center"><font size="7"><strong>Emerchant Administration </strong></font></div>
<form action="index.php" method="POST" target="_self">
<table id="main" width="40%" border="0" align="center" cellpadding="1" cellspacing="0" background="background.jpg">
<tr>
<td><table width="100%" border="0" cellpadding="1" cellspacing="1">
<tr>
<td width="10%" height="23"><b>Login:</b></td>
<td width="90%"><input type="text" name="login" size=30 maxlength=30></td>
</tr>
<tr>
<td><b>Password:</b></td>
<td><input type="password" name="password" size=30 maxlength=30></td>
</tr>
<tr>
<td><input name="submit" type="submit" value="Login!"></td>
<td></td>
</tr>
</table></td>
</tr>
</table>
</form>
<?php
}}
?>
This passes the variables to a file called admin.php
<?php
if (isset ($login, $password)) {
?>
<table width="95%" border="0" cellpadding="0" cellspacing="0" id="main">
<tr>
<td id="main" width="150" height="164">
<?php
$handle=opendir('Modules');
while ($file = readdir($handle)) {
if ($file == "index.html" | $file == "." | $file == "..") {
} else {
print "<li><a href=admin.php?Modules=$file>$file</a>\n"; }
}
closedir($handle);
?>
</td>
<td width="618">
<?php
/includes page depending on which link is selected/
if (isset($Modules)){
include("Modules/$Modules/index.php");
}
?>
</td>
</tr>
</table>
<?php
}else{
echo "Access Denied!";
}
?>
Now I need to keep the variables $login and $password when I click a link and it refreshes the page pulling in another page within it