D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
proc
/
thread-self
/
root
/
home
/
shubmkcj
/
urbane.createerp.com
/
API
/
Filename :
invoice-api.php
back
Copy
<?php require_once("config.php"); $params = $_REQUEST; $action = isset($params['action']) != '' ? $params['action'] : ''; $obj = new API_Invoice($conn); switch($action) { case 'Login': $obj -> login($params); break; default: break; } class API_Invoice { protected $conn; protected $data = array(); function __construct($conn) { $this->conn = $conn; } // *************************************************User Login****************************************************** function login($params){ $result = array(); $username = $params['email']; $password = $params['password']; $sqlLogin = "SELECT * FROM login_admin WHERE email='$username' and password='$password'"; $resultLogin = $this->conn->query($sqlLogin); if($resultLogin){ if($resultLogin->rowCount() == 1){ while($rowLogin = $resultLogin->fetch(PDO::FETCH_ASSOC)){ $data = [ "role" => $rowLogin["role"], "email" => $rowLogin["email"], "status" => "OK" ]; $result[] = $data; } } else{ $data = [ "role" => "", "email" => "", "status" => "ERROR" ]; $result[] = $data; } } else{ $data = [ "role" => "", "email" => "", "status" => "EXCEPTION" ]; $result[] = $data; } echo json_encode($result); } // Check if row Exists function checkIfExist($sql){ $resultSQL = $this->conn->query($sql); if($resultSQL){ if($resultSQL->rowCount() > 0){ return true; } } return false; } function getOneValueResultSet1($SQL){ $output = ""; try{ $result = $this->conn->query($SQL); if($result){ if($result->rowCount() > 0){ while($row = $result->fetch(PDO::FETCH_BOTH)){ $output = $row[0]; } } } } catch(Exception $ex){ } return $output; } } ?>