Login CSC Field Reports

CSC Field Report Login

User Name:

Password :

Hello
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. */ // echo '

Start id check

'; $query = "SELECT user_id, first_name, country, security, language FROM users WHERE email='$e' AND password='$p'"; $result = mysqli_query($dbc, $query); // Run the query. // echo '

passed result ' . $result . '

'; $row = mysqli_fetch_array($result, MYSQLI_NUM); // Return a record, if applicable. // echo '

I returned row

'; 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['user_id'] ; echo '

My Name ' . $bob . '

'; 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'; If ($_SESSION['language'] == 1){ $url .= '/cscadd2s.php'; header("Location: $url"); exit(); // Quit the script. } else{ // echo '

calling cscadd2c

'; $url .= '/cscadd2c.php'; // echo '

URL ' . $url . '

'; 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 '

' . mysqli_error() . '

Query: ' . $query . '

'; // Debugging message. } } else { // Errors! echo '

Please try again.

'; } // End of if ($e && $p) IF. mysqli_close($dbc); // Close the database connection. } // End of the main Submit conditional. } // End of the main Submit conditional. // Display the form. ?>