<?php
ob_start(); //research the use of this
session_start(); //needed to create sessions - maintaining state is discussed above.
ini_set('display_errors', 1); //turn on errors, use for debugging.
$username = $_POST['username']; //refer to the superglobal arrays section above
$password = $_POST['password'];
$authorized = false;
require ('dbconnection.php');
$sql = 'SELECT * from Login';
$rs = $conn->Execute($sql);
//Using a While looping structure to check each record in the database
while (!$rs->EOF) {
if ($rs->Fields["UserName"]->Value=="$username" && $rs->Fields["Password"]->Value=="$password") {
$_SESSION['auth'] = $rs->Fields['Auth']->Value;
$_SESSION['username'] = $rs->Fields['UserName']->Value;
$authorized = true;
}
$rs->MoveNext();
}
# close the connection
$rs->Close();
$conn->Close();
$rs = null;
$conn = null;
if (!$authorized) {
header('loginInvalid.php'); // see pseudocode for authorize.php
exit();
} else {
header('index.php');
exit();
}
?>
Warning: Undefined array key "username" in /in/7X1aS on line 6
Warning: Undefined array key "password" in /in/7X1aS on line 7
Warning: require(): open_basedir restriction in effect. File(dbconnection.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/7X1aS on line 10
Warning: require(dbconnection.php): Failed to open stream: Operation not permitted in /in/7X1aS on line 10
Fatal error: Uncaught Error: Failed opening required 'dbconnection.php' (include_path='.:') in /in/7X1aS:10
Stack trace:
#0 {main}
thrown in /in/7X1aS on line 10
Process exited with code 255.
Output for 8.0.13
Warning: Undefined array key "username" in /in/7X1aS on line 6
Warning: Undefined array key "password" in /in/7X1aS on line 7
Warning: require(dbconnection.php): Failed to open stream: No such file or directory in /in/7X1aS on line 10
Fatal error: Uncaught Error: Failed opening required 'dbconnection.php' (include_path='.:') in /in/7X1aS:10
Stack trace:
#0 {main}
thrown in /in/7X1aS on line 10
Process exited with code 255.
Notice: Undefined index: username in /in/7X1aS on line 6
Notice: Undefined index: password in /in/7X1aS on line 7
Warning: require(dbconnection.php): failed to open stream: No such file or directory in /in/7X1aS on line 10
Fatal error: require(): Failed opening required 'dbconnection.php' (include_path='.:') in /in/7X1aS on line 10
Process exited with code 255.
Notice: Undefined index: username in /in/7X1aS on line 6
Notice: Undefined index: password in /in/7X1aS on line 7
Warning: require(): open_basedir restriction in effect. File(dbconnection.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/7X1aS on line 10
Warning: require(dbconnection.php): failed to open stream: Operation not permitted in /in/7X1aS on line 10
Fatal error: require(): Failed opening required 'dbconnection.php' (include_path='.:') in /in/7X1aS on line 10
Process exited with code 255.
Output for 7.3.32 - 7.3.33
Warning: require(dbconnection.php): failed to open stream: No such file or directory in /in/7X1aS on line 10
Fatal error: require(): Failed opening required 'dbconnection.php' (include_path='.:') in /in/7X1aS on line 10
Process exited with code 255.
Output for 7.1.20, 7.2.6
Notice: Undefined index: username in /in/7X1aS on line 6
Notice: Undefined index: password in /in/7X1aS on line 7
Warning: require(): open_basedir restriction in effect. File(dbconnection.php) is not within the allowed path(s): (/tmp:/in) in /in/7X1aS on line 10
Warning: require(dbconnection.php): failed to open stream: Operation not permitted in /in/7X1aS on line 10
Fatal error: require(): Failed opening required 'dbconnection.php' (include_path='.:') in /in/7X1aS on line 10
Process exited with code 255.
Output for 5.2.3 - 5.2.17
Notice: Undefined index: username in /in/7X1aS on line 6
Notice: Undefined index: password in /in/7X1aS on line 7
Warning: require(dbconnection.php): failed to open stream: No such file or directory in /in/7X1aS on line 10
Fatal error: require(): Failed opening required 'dbconnection.php' (include_path='.:') in /in/7X1aS on line 10
Process exited with code 255.
Output for 5.1.0 - 5.1.6, 5.2.0 - 5.2.2
Warning: session_start(): Cannot send session cookie - headers already sent in /in/7X1aS on line 3
Warning: session_start(): Cannot send session cache limiter - headers already sent in /in/7X1aS on line 3
Notice: Undefined index: username in /in/7X1aS on line 6
Notice: Undefined index: password in /in/7X1aS on line 7
Warning: require(dbconnection.php): failed to open stream: No such file or directory in /in/7X1aS on line 10
Fatal error: require(): Failed opening required 'dbconnection.php' (include_path='.:') in /in/7X1aS on line 10
Process exited with code 255.
Warning: session_start(): Cannot send session cookie - headers already sent in /in/7X1aS on line 3
Warning: session_start(): Cannot send session cache limiter - headers already sent in /in/7X1aS on line 3
Notice: Undefined index: username in /in/7X1aS on line 6
Notice: Undefined index: password in /in/7X1aS on line 7
Warning: main(dbconnection.php): failed to open stream: No such file or directory in /in/7X1aS on line 10
Fatal error: main(): Failed opening required 'dbconnection.php' (include_path='.:') in /in/7X1aS on line 10
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Warning: session_start() [http://www.php.net/function.session-start]: Cannot send session cookie - headers already sent in /in/7X1aS on line 3
Warning: session_start() [http://www.php.net/function.session-start]: Cannot send session cache limiter - headers already sent in /in/7X1aS on line 3
Notice: Undefined index: username in /in/7X1aS on line 6
Notice: Undefined index: password in /in/7X1aS on line 7
Warning: main(dbconnection.php) [http://www.php.net/function.main]: failed to create stream: No such file or directory in /in/7X1aS on line 10
Fatal error: main() [http://www.php.net/function.main]: Failed opening required 'dbconnection.php' (include_path='.:') in /in/7X1aS on line 10