-
Notifications
You must be signed in to change notification settings - Fork 0
/
raten.php
75 lines (68 loc) · 2.24 KB
/
raten.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
<title>Zahlen Raten</title>
<?php
####OPTIONEN####
$mindestwert=1;
$maximalwert=100;
################
//CODE//
if (!$_POST['random']){
$_POST['random']=rand($mindestwert, $maximalwert);
}
if (!$_POST['raten']){
$_POST['raten']='';
}
if (isset($_POST['reset'])){
$_POST['random']=rand($mindestwert, $maximalwert);
$_POST['raten']='';
$_POST['counter']=-1;
# $_POST['geraten']='Noch nicht geraten';
}
$_POST['counter']=$_POST['counter']+1;
echo '<style type="text/css">';
echo 'body {
background-color: #1C1C1C;
}
</style>';
echo '<center>';
echo '<div style="background-color:#BDBDBD;width:500px;border:2px solid black">';
echo '<div style="width:100%; height:450px; font-size:15px; text-align:center; margin-left:auto; margin-right:auto">';
echo '<center><h1>Zahlen Raten</h1>';
echo '<div style="font-size:20px;">';
echo 'Gebe eine Zahl zwischen '.$mindestwert.' und '.$maximalwert.' ein.';
echo '</div>';
echo '<br><br>';
echo '<form method="post">';
echo '<div style="background-color:#FFFFFF;width:300px;border:5px solid black">';
echo '<div style="width:100%; height:200px; font-size:15px; text-align:center; margin-left:auto; margin-right:auto">';
echo 'Versuche: '.$_POST['counter'];
/*
echo '<br>';
echo 'Zuletzt geraten: '.$_POST['geraten'].'';
*/
echo '<br><br>';
echo '<input type="number" name="raten" value="'.$_POST['raten'].'">';
echo '<br><br>';
echo '<input type="hidden" name="random" value="'.$_POST['random'].'">';
echo '<input type="hidden" name="counter" value="'.$_POST['counter'].'">';
#echo '<input type="hidden" name="geraten" value="'.$_POST['raten'].'">';
echo '<input type="submit" name="send" value="TESTEN" style="width:50%; border:1px solid black">';
echo '<br><br>';
echo '<input type="submit" name="reset" value="RESET" style="width:70%; border:1px solid black">';
echo '</form>';
echo '<br>';
echo '</div></div></center>';
/*
echo $_POST['random'];
*/
if ($_POST['raten']<$_POST['random']){
echo '<center><h2>Zu Niedrig</h2></center>';
}
if ($_POST['random']<$_POST['raten']){
echo '<center><h2>Zu Hoch</h2></center>';
}
if ($_POST['random']==$_POST['raten']){
echo '<center><h1>RICHTIG!</h1>';
echo 'Du hast '.$_POST['counter'].' Versuche benötigt um die Zahl '.$_POST['random'].' zu erraten.</center>';
}
$_POST['raten']='';
?>