Browse Source

fixed confirm regex

master
Robin Thoni 9 years ago
parent
commit
5d74a3cf05
1 changed files with 4 additions and 3 deletions
  1. 4
    3
      index.php

+ 4
- 3
index.php View File

@@ -12,6 +12,8 @@ function check_api_key()
12 12
 
13 13
 function main()
14 14
 {
15
+  header("Content-Type: application/json");
16
+  check_api_key();
15 17
   $m_get = ($_SERVER['REQUEST_METHOD'] == "GET");
16 18
   $m_post = ($_SERVER['REQUEST_METHOD'] == "POST");
17 19
   $matches = array();
@@ -20,7 +22,8 @@ function main()
20 22
   if ($path === "")
21 23
     $path = "/";
22 24
 
23
-  if (preg_match($path, "/^\/status\/([0-9]+)\/confirm$/", $matches) && $m_post)
25
+  if (preg_match('(^\/status\/([0-9]+)\/confirm$)', $path, $matches)
26
+    && $m_post)
24 27
     status_confirm($matches[1]);
25 28
   else if ($path === "/status" && $m_post)
26 29
     status_create();
@@ -33,7 +36,5 @@ function main()
33 36
   else
34 37
     error(501, "Not implemented");
35 38
 }
36
-header("Content-Type: application/json");
37
-check_api_key();
38 39
 main();
39 40
 ?>

Loading…
Cancel
Save