Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
966 B
1
Indexable
Never
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "gamebe";

//variables
$loginUser = $_POST["loginUser"];
$loginPass = $_POST["loginPass"];



// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);

// Check connection
if ($conn->connect_error) {
  die("Connection failed: " . $conn->connect_error);
}
echo "Connected successfully ";

$sql = "SELECT password FROM users WHERE username = '" . $loginUser . "'";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
  // output data of each row
  while($row = $result->fetch_assoc()) {
    if($row["password"] == $loginPass){
        echo "Login Success.";

    //Get users data

    //Get player info

    //Get inventory

    //Modify Player Data

    //Update Inventory

    }
    else {
        echo "Wrong Credentials.";
    }
  }
} else {
  echo "Username Does not exist";
}

$conn->close();

?>