Browse Source

authorization basic check

master
Robin Thoni 9 years ago
parent
commit
4a55879e81
1 changed files with 10 additions and 2 deletions
  1. 10
    2
      index.php

+ 10
- 2
index.php View File

@@ -2,12 +2,20 @@
2 2
 require_once "utils.php";
3 3
 require_once "status.php";
4 4
 require_once "user.php";
5
+require_once "sql.php";
5 6
 
6
-function check_api_key()
7
+function check_api_key_()
7 8
 {
8 9
   $headers = apache_request_headers();
9 10
   if (!isset($header["Authorization"]))
10
-    error(401, "Bad API Key");
11
+    return false;
12
+  return true;
13
+}
14
+
15
+function check_api_key()
16
+{
17
+  if (!check_api_key_())
18
+    error(500, "Database Fail");
11 19
 }
12 20
 
13 21
 function main()

Loading…
Cancel
Save