public function login() { // we store all the apis in a variable if (isset($_POST['phonenumber']) && $_POST['password']) { $phonenumber = $_POST['phonenumber']; $password = $_POST['password']; } $api = Api::login('4444444444', '@abc'); print json_encode($api); }
<?php session_start(); require_once 'Api.php'; if (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST') { $username = $_REQUEST['username']; $password = $_REQUEST['password']; $api = new Api(); $result = $api->login($username, $password); if ($result != false) { //if a string is returned (admin/basic) then set the session $_SESSION['userType'] = $result; header("Location: index.php"); } else { //header("Location: login.php"); } } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <?php include 'htmlhead.php'; ?> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" href="css/logincss.css" type="text/css" media="screen" title="default" />
<?php require_once 'Api.php'; $api = new Api(); //Testing for login echo '***********************************************'; echo ' USER '; echo "*********************************************** "; $result = $api->login('Tbee', 'resah'); echo var_dump($result) . "Login working:"; $resultu1 = $api->login('Tbee2', 'resah'); echo " Login not working : " . var_dump($resultu1); $resultu2 = $api->registerUser('Resah', 'Jones', 'resss01', '*****@*****.**', 5334430, ' hottaz'); echo " register: " . var_dump($resultu2); echo '***********************************************'; echo ' Book '; echo "***********************************************\n"; //$resultb1 = $api->addBook('life', 'Dean','TaraPub','Direct','2009-01-03','1','computing','mint','10', // 'computing book for sale','1','book',' 2009-01-03 11:48:50','time,uu','path/to/image'); //var_dump($resultb1); $resultb2 = $api->getownerBooks('1'); var_dump($resultb2); //$resultb5 = $api->editbook($itemid, $title, $author, $publisher, $published_date, $edition, $subjectarea, $condition, $saletype, $askingprice, $description); //var_dump($resultb5;) $resultb3 = $api->rmbook('8'); var_dump($resultb3);