forked from icecoder/ICEcoder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.php
81 lines (61 loc) · 3.1 KB
/
test.php
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<!DOCTYPE html>
<head>
<title>ICEcoder requirements tests</title>
</head>
<body style="font-family: Arial">
This file checks requirements needed by ICEcoder to run.<br><br>
If there are no test results with red items below, you should be able to run it fine. If not, consider the items in red.<br><br>
<?php
echo "<b>Test date, time & microtime:</b><br>".date("jS M Y g:i:sa")." (".microtime(true).")<br><br><hr><br>";
$success = 0;
echo '<b>TEST 1 of 3: PHP Version:</b><br>ICEcoder needs at least PHP 5.0, tho 5.3 and above is recommended:<br><br>';
echo "Your PHP Version: ".phpversion()."<br><br>";
echo '<b>TEST RESULT:</b> ';
if (phpversion()*1 < 5.0) {
echo '<span style="color: #b00; font-weight: bold">Your version of PHP doesn\'t seem to be high enough!</span>';
} else {
echo '<span style="color: #080; font-weight: bold">PHP version is OK</span>';
$success++;
}
echo "<br><br><hr><br>";
if(!isset($_SESSION)) {@session_start();}
echo '<b>TEST 2 of 3: Sessions:</b></b><br>Session ID: '.session_id().'. These values should all be the same:<br><br>';
echo '<div style="display: inline-block; width: 200px">SESSION, BEFORE SET:</div>'.$_SESSION["string"]."<br>";
if (!isset($_GET["string"])) {
$_SESSION["string"] = md5(uniqid(mt_rand(), true));
header("Location: test.php?string=".$_SESSION["string"]);
echo "<script>window.location = 'test.php?string=".$_SESSION["string"]."';</script>";
die('Rerirect didn\'t happen...');
}
echo '<div style="display: inline-block; width: 200px">SESSION, AFTER SET:</div>'.$_SESSION["string"]."<br>";
echo '<div style="display: inline-block; width: 200px">GET:</div>'.str_replace("<", "<", str_replace(">", ">", $_GET["string"]))."<br>";
echo '<div style="display: inline-block; width: 200px">REQUEST:</div>'.str_replace("<", "<", str_replace(">", ">", $_REQUEST["string"]))."<br>";
echo '<br>...and hitting this button shouldn\'t change the values:<br><br>';
echo '<div onclick="window.location=\'test.php?string='.$_SESSION["string"].'\'" style="display: inline-block; background: #ccc; padding: 10px; cursor: pointer">Reload page with GET param</div>';
echo "<br><br>";
echo '<b>TEST RESULT:</b> ';
if ($_REQUEST["string"] !== $_SESSION["string"]) {
echo '<span style="color: #b00; font-weight: bold">Values do not match!</span>';
} else {
echo '<span style="color: #080; font-weight: bold">Values match</span>';
$success++;
}
echo "<br><br><hr><br>";
echo '<b>TEST 3 of 3: Includes:</b><br>Attempt to include settings file:<br><br>';
$configSettings = 'config___settings.php';
// Load config settings
include(dirname(__FILE__)."/lib/".$configSettings);
echo "This version of ICEcoder is: ".$ICEcoderSettings['versionNo']."<br><br>";
echo '<b>TEST RESULT:</b> ';
if (!isset($ICEcoderSettings['versionNo'])) {
echo '<span style="color: #b00; font-weight: bold">Couldn\'t establish version, probably couldn\'t include settings file!</span>';
} else {
echo '<span style="color: #080; font-weight: bold">Version established</span>';
$success++;
}
echo "<br><br><hr><br>";
echo "<b>Overall Test result:</b><br>";
echo $success." of 3 tests passed successfully<br><br>";
?>
</body>
</html>