Browse Source

split file

master
Robin Thoni 9 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,22 +1,13 @@
1 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 13
 function main()
@@ -28,7 +19,6 @@ function main()
28 19
   $path = rtrim($_GET['_url'], "/");
29 20
   if ($path === "")
30 21
     $path = "/";
31
-  echo hash_pbkdf2(
32 22
   if (preg_match($path, "^/status/([0-9]+)/confirm$", $matches) && $m_post)
33 23
     status_confirm($matches[1]);
34 24
   else if ($path === "/status" && $m_post)
@@ -43,5 +33,6 @@ function main()
43 33
     error(501, "Not Implemented");
44 34
 }
45 35
 
36
+check_api_key();
46 37
 main();
47 38
 ?>

+ 13
- 0
status.php View File

@@ -0,0 +1,13 @@
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

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

+ 1
- 1
utils.php View File

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

Loading…
Cancel
Save