|
|
|
Hello
|
|
Login CSC Field Reports
You forgot to enter your email address!';
$e = FALSE;
}
// Check for a password.
if (!empty($_POST['password'])) {
$p = $_POST['password'];
} else {
echo 'You forgot to enter your password! ';
$p = FALSE;
}
if ($e && $p) { // If everything's OK.
/* Retrieve the user_id and first_name for
that email/password combination. */
$query = "SELECT user_id, first_name, country, security, language FROM users WHERE email='$e' AND password='$p'";
$result = @mysql_query ($query); // Run the query.
$row = mysql_fetch_array ($result, MYSQL_NUM); // Return a record, if applicable.
if ($row) { // A record was pulled from the database.
// Set the session data & redirect.
session_start();
$_SESSION['user_id'] = $row[0];
$_SESSION['first_name'] = $row[1];
$_SESSION['country'] = $row[2];
$_SESSION['security'] = $row[3];
$_SESSION['language']= $row[4];
$bob = $_SESSION['security'];
ob_end_clean(); // Delete the buffer.
// Redirect the user to the loggedin.php page.
// Start defining the URL.
$url = 'http://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']);
// Check for a trailing slash.
if ((substr($url, -1) == '/') OR (substr($url, -1) == '\\') ) {
$url = substr ($url, 0, -1); // Chop off the slash.
}
// Add the page.
// include 'cscadd2b.php';
$url .= '/cscadd2c.php';
header("Location: $url");
exit(); // Quit the script.
} else { // No record matched the query.
echo 'The email address and password entered do not match those on file. '; // Public message.
// echo '' . mysql_error() . '
Query: ' . $query . ' ';// Debugging message.
}
} else { // Errors!
echo 'Please try again. ';
} // End of if ($e && $p) IF.
mysql_close(); // Close the database connection.
} // End of the main Submit conditional.
// Display the form.
?>
CSC Field Report Login
|
|
|
|