php-tester
Code (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
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
<?php
session_start();
//de vreemde naam ivm andere lopende sessies op localhost
if(isset($_SESSION['logged_in_editor'])){
$code = "";
if(!empty($_POST['code'])){
//eval de ingevoerde code
eval(stripslashes($_POST['code']));
$code = stripslashes($_POST['code']);
}
?>
<title>PHP Tester</title>
<form action="#" method="post">
<textarea name="code" style="width: 80%; height:80%; font-family: courier new;"><?php
echo($code); ?></textarea>
<input type="submit" value="Test">
</form>
<?php
}else{
if(empty($_POST)){
//inlog formuliertje
?>
<form action="#" method="post">
Username: <input type="text" name="username"><br>
Password: <input type="password" name="password"><br>
<input type="submit" value="Login">
</form>
<?php
}else{
//de login checken
//ik gebruik sha1 ivm het rechtstreeks uitlezen van files en sleep ivm bruteforce crackers
sleep(5);
if((sha1($_POST['password']) == 'a94a8fe5ccb19ba61c4c0873d391e987982fbbd3')
&& (sha1($_POST['username']) == 'a94a8fe5ccb19ba61c4c0873d391e987982fbbd3')){
$_SESSION['logged_in_editor'] = "TRUE";
header("Location: ".$_SERVER['PHP_SELF']);
}
}
}
?>
session_start();
//de vreemde naam ivm andere lopende sessies op localhost
if(isset($_SESSION['logged_in_editor'])){
$code = "";
if(!empty($_POST['code'])){
//eval de ingevoerde code
eval(stripslashes($_POST['code']));
$code = stripslashes($_POST['code']);
}
?>
<title>PHP Tester</title>
<form action="#" method="post">
<textarea name="code" style="width: 80%; height:80%; font-family: courier new;"><?php
echo($code); ?></textarea>
<input type="submit" value="Test">
</form>
<?php
}else{
if(empty($_POST)){
//inlog formuliertje
?>
<form action="#" method="post">
Username: <input type="text" name="username"><br>
Password: <input type="password" name="password"><br>
<input type="submit" value="Login">
</form>
<?php
}else{
//de login checken
//ik gebruik sha1 ivm het rechtstreeks uitlezen van files en sleep ivm bruteforce crackers
sleep(5);
if((sha1($_POST['password']) == 'a94a8fe5ccb19ba61c4c0873d391e987982fbbd3')
&& (sha1($_POST['username']) == 'a94a8fe5ccb19ba61c4c0873d391e987982fbbd3')){
$_SESSION['logged_in_editor'] = "TRUE";
header("Location: ".$_SERVER['PHP_SELF']);
}
}
}
?>