Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $error = false;
- if ($_POST['systemCall'] == "checkLogin"){
- /** Connect to database **/
- $con = new mysqli('host', 'user', 'pass', 'database name');
- /** Check Database Connection **/
- if (mysqli_connect_errno()) {
- echo 'status=Failure&error=505&errmsg=Cannot Connect to DB.';
- exit();
- }
- $user = $_POST['username']; // Username
- $pass = $_POST['password']; // Password
- $query = 'SELECT password FROM users WHERE username=? AND password=? LIMIT 1'; //Statement
- if ($stmt = $con->prepare($query)) { //Prepare Statement
- $stmt->bind_param("ss", $user, $pass); //Bind Parameters
- $stmt->execute(); //Execute Statement
- $stmt->bind_result($password); //Bind Results
- if($stmt->fetch()) {
- echo "status=Success";
- } else {
- echo 'status=Failure&error=504&errmsg=Account Info is Incorrect.';
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement