Browse Source

split file

master
Robin Thoni 10 years ago
parent
commit
c77f724c10
4 changed files with 31 additions and 18 deletions
  1. 8
    17
      index.php
  2. 13
    0
      status.php
  3. 9
    0
      user.php
  4. 1
    1
      utils.php

+ 8
- 17
index.php View File

1
 <?php
1
 <?php
2
-function status_confirm($id)
3
-{
4
-}
5
-
6
-function status_create()
7
-{
8
-}
9
-
10
-function status_feed()
11
-{
12
-}
13
-
14
-function user_create()
15
-{
16
-}
2
+require_once "utils.php";
3
+require_once "status.php";
4
+require_once "user.php";
17
 
5
 
18
-function user_login()
6
+function check_api_key()
19
 {
7
 {
8
+  $headers = apache_request_headers();
9
+  if (!isset($header["Authorization"]))
10
+    error(401, "Bad API Key");
20
 }
11
 }
21
 
12
 
22
 function main()
13
 function main()
28
   $path = rtrim($_GET['_url'], "/");
19
   $path = rtrim($_GET['_url'], "/");
29
   if ($path === "")
20
   if ($path === "")
30
     $path = "/";
21
     $path = "/";
31
-  echo hash_pbkdf2(
32
   if (preg_match($path, "^/status/([0-9]+)/confirm$", $matches) && $m_post)
22
   if (preg_match($path, "^/status/([0-9]+)/confirm$", $matches) && $m_post)
33
     status_confirm($matches[1]);
23
     status_confirm($matches[1]);
34
   else if ($path === "/status" && $m_post)
24
   else if ($path === "/status" && $m_post)
43
     error(501, "Not Implemented");
33
     error(501, "Not Implemented");
44
 }
34
 }
45
 
35
 
36
+check_api_key();
46
 main();
37
 main();
47
 ?>
38
 ?>

+ 13
- 0
status.php View File

1
+<?php
2
+function status_confirm($id)
3
+{
4
+}
5
+
6
+function status_create()
7
+{
8
+}
9
+
10
+function status_feed()
11
+{
12
+}
13
+?>

+ 9
- 0
user.php View File

1
+<?php
2
+function user_create()
3
+{
4
+}
5
+
6
+function user_login()
7
+{
8
+}
9
+?>

+ 1
- 1
utils.php View File

17
   header("HTTP/ $code $message");
17
   header("HTTP/ $code $message");
18
   die(json_encode(array("code" => intval($code), "message" => $message)));
18
   die(json_encode(array("code" => intval($code), "message" => $message)));
19
 }
19
 }
20
-$>
20
+?>

Loading…
Cancel
Save