I've got a validation page in place on all administrative pages of a site and is running perfectly. I'm trying to duplicate it for a different site and server location.
Now I've duplicated the database structure and pulled over the code from the working site and now I've hit a problem that's got me stumped.
When I go to validate the authorized users of the site my submission form doesn't do anything. I don't get the expected error message or a successful message to view the pages.
Any help is greatly appreciated. Here's the code for the validation page that just won't submit.
Thanks.
PHP Code:
<?php
session_start();
session_register("sess_var");
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<head>
<title>Admin Login</title>
</head>
<body bgcolor="#003399">
<?
// includes
include("conf.php");
include("functions.php");
?>
<?php
if (!$HTTPS && $REQUEST_METHOD=="POST") {
# Open a connection
$connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
// select database
mysql_select_db($db) or die ("Unable to select database!");
$sql = "SELECT id FROM admin_users WHERE name='$name' and password='$password'";
$result = mysql_query($sql)
or die("Couldn't execute query.");
$num = mysql_numrows($result);
if ($num = 1) {
$sess_var = "Authorized User!";
echo "<p align=\"center\"><font color=ffffff>You have been authorized!</font></p>";
echo "<p align=\"center\"><A HREF=\"index.php\"><font color=ffffff>Click here to continue.</font></A></span></p>";
}
else {
echo "<p align=\"center\"><font color=ffffff>You are <b>NOT</b> authorized to use this site or you have entered incorrect information for your username and password!</span></font></p>";
echo "<p align=\"center\"><A HREF=\"validate.php\"><font color=ffffff>Click here to try again.</font></A></p>";
}
}
else {
?>
<form action="validate.php" method="post">
<table align="center" border="0" cellpadding="5" cellspacing="0" class="text">
<tr bgcolor="#CCCCCC">
<td><strong>Username:</strong></td>
<td>
<input type="text" name="name" size="15">
</td>
</tr>
<tr bgcolor="#CCCCCC">
<td><strong>Password:</strong></td>
<td>
<input type="password" name="password" size="15">
</td>
</tr>
<tr bgcolor="#CCCCCC">
<td colspan="2" align="center">
<input type="submit" value="Submit Information">
</td>
</tr>
</table>
</form>
<?php
}
?>
</body>
</html>
Edit: Wrapped code in [php][/php] tags.
Bookmarks