Browse Source

fixed confirm regex

master
Robin Thoni 10 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
 
12
 
13
 function main()
13
 function main()
14
 {
14
 {
15
+  header("Content-Type: application/json");
16
+  check_api_key();
15
   $m_get = ($_SERVER['REQUEST_METHOD'] == "GET");
17
   $m_get = ($_SERVER['REQUEST_METHOD'] == "GET");
16
   $m_post = ($_SERVER['REQUEST_METHOD'] == "POST");
18
   $m_post = ($_SERVER['REQUEST_METHOD'] == "POST");
17
   $matches = array();
19
   $matches = array();
20
   if ($path === "")
22
   if ($path === "")
21
     $path = "/";
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
     status_confirm($matches[1]);
27
     status_confirm($matches[1]);
25
   else if ($path === "/status" && $m_post)
28
   else if ($path === "/status" && $m_post)
26
     status_create();
29
     status_create();
33
   else
36
   else
34
     error(501, "Not implemented");
37
     error(501, "Not implemented");
35
 }
38
 }
36
-header("Content-Type: application/json");
37
-check_api_key();
38
 main();
39
 main();
39
 ?>
40
 ?>

Loading…
Cancel
Save