Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require 'db_config.php';
- require 'functions.php';
- if(isset($_POST['username']) && isset($_POST['password'])){
- $username = $_POST['username'];
- $password = $_POST['password'];
- $password2 = 'salt' .$password;
- $password1 = md5($password2);
- if(!empty($username) && !empty($password1)){
- $username = mysqli_real_escape_string($conn,$username);
- $password = mysqli_real_escape_string($conn,$password1);
- $query = "SELECT `username` FROM player WHERE `username`='$username' AND `password`='$password'";
- $result = mysqli_query($conn,$query);
- if(mysqli_num_rows($result) == 0){
- echo create_json_response('unsuccessful','Wrong combination of username and password');
- }elseif (mysqli_num_rows($result) == 1){
- echo create_json_response('successful',$username);
- }else echo create_json_response('unsuccessful','Enter username and password');
- }else echo create_json_response('unsuccessful','Enter username and password');
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement