@ 2013-10-03T19:02:17Z <?php
session_start();
if (isset($_SESSION['Username'])) {
header("location:login_success.php");
}
if (isset($_POST['Username'])) {
ob_start();
$myUsername = $_POST['Username'];
$myPassword = $_POST['password'];
$sqlname = "SELECT * FROM dbo.Users WHERE Username='$myUsername' and Password='$myPassword'";
$params = array();
$options = array('Scrollable' => SQLSRV_CURSOR_KEYSET);
$stmt = sqlsrv_query( $conn, $sqlname, $params, $options);
$row_count = sqlsrv_num_rows( $stmt );
if($row_count==1){
$_SESSION['Username']= $myUsername;
$_SESSION['Password']= $myPassword;
$kb= $_SESSION['Username'];
if (!$mysqli->query("CREATE TABLE IF NOT EXISTS user_log (id INT AUTO_INCREMENT PRIMARY KEY,user VARCHAR(15),state VARCHAR (7),ts TIMESTAMP)") ||
!$mysqli->query("INSERT INTO user_log (user, state) VALUES ('$kb', 'Login')")) {
echo "Table creation failed: (" . $mysqli->errno . ") " . $mysqli->error;
}
header("location:login_success.php");
}
else {
echo "Wrong Username or Password";
if (!$mysqli->query("CREATE TABLE IF NOT EXISTS user_log (id INT AUTO_INCREMENT PRIMARY KEY,user VARCHAR(15),state VARCHAR (7),ts TIMESTAMP)") ||
!$mysqli->query("INSERT INTO user_log (user, state) VALUES ('user', 'LogFail')")) {
echo "Table creation failed: (" . $mysqli->errno . ") " . $mysqli->error;
}
}
ob_end_flush();
}
else {
header("location:sql.php");
}
?>
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 5.2.3 - 5.2.17 , 5.3.0 - 5.3.29 , 5.4.0 - 5.4.45 , 5.5.0 - 5.5.38 , 5.6.0 - 5.6.38 , 7.0.0 - 7.0.33 , 7.1.0 - 7.1.25 , 7.2.0 - 7.2.33 , 7.3.0 - 7.3.33 , 7.4.0 - 7.4.33 , 8.0.0 - 8.0.30 , 8.1.0 - 8.1.27 , 8.2.0 - 8.2.17 , 8.3.0 - 8.3.4 Output for 4.3.2 - 4.3.11 , 4.4.0 - 4.4.9 , 5.0.0 - 5.0.5 , 5.1.0 - 5.1.6 , 5.2.0 - 5.2.2 Warning: session_start(): Cannot send session cookie - headers already sent in /in/9KArA on line 2
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /in/9KArA:2) in /in/9KArA on line 2
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/9KArA on line 2
Warning: session_start() [http://www.php.net/function.session-start]: Cannot send session cache limiter - headers already sent (output started at /in/9KArA:2) in /in/9KArA on line 2
preferences:dark mode live preview
331.63 ms | 402 KiB | 421 Q