Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = "mysql-xxnorxx.alwaysdata.net";
- $username = "xxnorxx";
- $password = "*****";
- $dbName = "xxnorxx_testdb";
- $user_username = $_POST["usernamePost"];
- $user_password = $_POST["passwordPost"];
- //Make Connection
- $conn = new mysqli($servername, $username, $password, $dbName);
- //Check Connection
- if(!$conn)
- {
- die("Connection Faled.". mysqli_connect_error());
- }
- //else echo("Connection Success");
- $sql = "SELECT password FROM users WHERE username = '".$user_username."' ";
- $result = mysqli_query($conn, $sql);
- //Get the result and confirm login
- if (mysqli_num_rows($result) > 0)
- {
- //show data for each row
- while($row = mysqli_fetch_assoc($result))
- {
- if($row['password'] == $user_password)
- {
- echo "Login success";
- }
- else
- {
- echo "Password incorrect";
- }
- }
- }
- else
- {
- echo "user not found";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement