<?php include 'config.php'; session_start(); $errorMsg = ""; $validUser = $_SESSION["login"] === true; if(isset($_POST["sub"])) { /* Connect using SQL Server Authentication. */ // $subUsername = $_POST["username"]; // $subPassword = $_POST["password"]; //Check Connection if( $db === false ) { die( print_r( sqlsrv_errors(), true)); } $sql = "SELECT pin FROM user_db WHERE username like 'Cody%'"; $stmt = sqlsrv_query($db, $sql); if( $stmt === false ) { die( print_r( sqlsrv_errors(), true)); } } $row_count = sqlsrv_num_rows($stmt); if ($row_count === false) echo 'Error getting row count'; else echo $row_count; if($validUser) { header("Location: /index.php"); die(); } ?> <!DOCTYPE html> <html> <head> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <title>Login</title> </head> <body> <form name="input" action="" method="post"> <label for="username">Username:</label><input type="text" value="<?= $_POST["username"] ?>" id="username" name="username" /> <label for="password">Password:</label><input type="password" value="" id="password" name="password" /> <div class="error"><?= $errorMsg ?></div> <input type="submit" value="Home" name="sub" /> </form> </body> </html>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)