Browse Source

authorization basic check

master
Robin Thoni 10 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
 require_once "utils.php";
2
 require_once "utils.php";
3
 require_once "status.php";
3
 require_once "status.php";
4
 require_once "user.php";
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
   $headers = apache_request_headers();
9
   $headers = apache_request_headers();
9
   if (!isset($header["Authorization"]))
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
 function main()
21
 function main()

Loading…
Cancel
Save