Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "localhost"; //replace your servername
- $username = "root"; //replace your username
- $password = "toor"; //replace your password
- $dbname = "shop"; //replace your database name
- // Create connection
- $conn = mysqli_connect($servername, $username, $password, $dbname);
- if ( isset($_GET["user"]) and isset($_GET["password"]) )
- {
- $username = $_GET["user"];
- $password = md5( $_GET["password"] );
- $val = "SELECT * FROM users WHERE name = '$username' and password = '$password'";
- $test = mysqli_query( $conn, $val );
- if ( !$res = mysqli_query( $conn, $val ) )
- {
- echo "Error: Our query failed to execute and here is why: <br/>";
- echo "Query: " . $val . "<br/>";
- echo "Errno: " . $conn->errno . "<br/>";
- echo "Error: " . $conn->error . "<br/>";
- }
- else
- {
- $data = $res->fetch_all();
- echo "Your card number: " . $data[0][2];
- }
- }
- ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <title>Shop login</title>
- </head>
- <body>
- <form action="" method="GET" class="form-signin">
- <h2>Please login</h2>
- <label for="user" class="sr-only">Username</label>
- <input type="text" name="user" id="user" class="form-control" placeholder="Username" required="" autofocus=""><br/><br/>
- <label for="password" class="sr-only">Password</label>
- <input type="password" id="password" name="password" class="form-control" placeholder="Password" required=""><br/><br/>
- <button class="btn btn-lg btn-primary btn-block" type="submit">Log in</button>
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement