Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once("letmein.php");
- $db = new LetMeIn("127.0.0.1", "letmein", "root", "");
- $data = file_get_contents("php://input");
- $json = json_decode($data);
- $auth = 'ItsTooLongAcceptingYou';
- // @List($objnm, $objid) = explode('/', $_GET['url']);
- if ($db->query('SELECT authentication FROM auth WHERE authentication=:auth', array(':auth'=>$auth)))
- {
- // echo 'welcome world';
- @List($objnm, $objid) = explode('/', $_GET['url']);
- if ($_SERVER['REQUEST_METHOD'] == "GET")
- {
- // get post rest api
- if ($objnm == "posts")
- {
- $posts = $db->query('SELECT * FROM post');
- if ($objid = "1")
- {
- $posts = $db->query('SELECT * FROM post where id=1');
- }
- echo json_encode($posts, JSON_PRETTY_PRINT);
- }
- else
- {
- http_response_code(401);
- }
- // get blog rest api
- if ($objnm == "blogs")
- {
- echo 'wew';
- }
- }
- else if ($_SERVER['REQUEST_METHOD'] == "POST")
- {
- if ($_GET['url'] == "posts")
- {
- echo 'post';
- }
- else
- {
- http_response_code(401);
- }
- }
- else if ($_SERVER['REQUEST_METHOD'] == "DELETE")
- {
- }
- else
- {
- http_response_code(405);
- }
- }
- else
- {
- http_response_code(405);
- echo 'You have no access to connect jonathan restful api';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement