aboutsummaryrefslogtreecommitdiff
path: root/Neutron-trunk/api/setup/check.php
blob: d3eb83177a8f943667c89713e9ccb9abb9f24a10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php require_once "../../resources/private/relative.php"; getRelativeDetails("api"); ?>
<?php

// require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("It works!");

if (substr($_SERVER['SERVER_PROTOCOL'], 0, 4) != "HTTP") {
    require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("Unsupported protocol");
}

if ($_SERVER['REQUEST_METHOD'] != "GET") {
    require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("Unsupported request method");
}

if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/resources/upload")) {
    mkdir($_SERVER['DOCUMENT_ROOT'] . "/resources/upload");
}

ob_start();
phpinfo();
$data = ob_get_contents();
ob_clean();
if (strpos($data, '<tr><td class="e">GD Support </td><td class="v">enabled </td></tr>') !== false || strpos($data, 'GD Support => enabled') !== false) {} else {
    require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("The GD2 library is not installed or enabled");
}

if (strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome') !== false || strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== false) {} else {
    require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("Unsupported browser, please use Chrome, Chrome-based or Firefox");
}

require $_SERVER['DOCUMENT_ROOT'] . "/api/electrode/quit.php";quit("ok");