-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
107 lines (106 loc) · 2.69 KB
/
index.php
File metadata and controls
107 lines (106 loc) · 2.69 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?php
SESSION_START();
?>
<html>
<head>
<title>CEKI</title>
</head>
<body>
<form action="?" method="POST">
<?php
if(empty($_SESSION['satu'])){
?>
<table>
<tr>
<td>Player 1</td>
<td>:</td>
<td><input type="text" name="satu"></td>
</tr>
<tr>
<td>Player 2</td>
<td>:</td>
<td><input type="text" name="dua"></td>
</tr>
<tr>
<td>Player 3</td>
<td>:</td>
<td><input type="text" name="tiga"></td>
</tr>
<tr>
<td>Player 4</td>
<td>:</td>
<td><input type="text" name="empat"></td>
</tr>
<tr>
<td colspan=3><input type="submit" name="main" value="Main!"></td>
</tr>
</table>
<?php
}else{
@$min=$_SESSION['skor1'];
if(@$_SESSION['skor2']<$min){
$min=$_SESSION['skor2'];
}
if(@$_SESSION['skor3']<$min){
$min=$_SESSION['skor3'];
}
if(@$_SESSION['skor4']<$min){
$min=$_SESSION['skor4'];
}
?>
<table>
<tr>
<td><?php echo $_SESSION['satu']; ?></td>
<td>[ <?php echo @$_SESSION['skor1']; ?> ]</td>
<td><input type="text" name="satu"></td>
<td><?php if($min==$_SESSION['skor1']){ echo "NGOCOK!!"; } ?></td>
</tr>
<tr>
<td><?php echo $_SESSION['dua']; ?></td>
<td>[ <?php echo @$_SESSION['skor2']; ?> ]</td>
<td><input type="text" name="dua"></td>
<td><?php if($min==$_SESSION['skor2']){ echo "NGOCOK!!"; } ?></td>
</tr>
<tr>
<td><?php echo $_SESSION['tiga']; ?></td>
<td>[ <?php echo @$_SESSION['skor3']; ?> ]</td>
<td><input type="text" name="tiga"></td>
<td><?php if($min==$_SESSION['skor3']){ echo "NGOCOK!!"; } ?></td>
</tr>
<tr>
<td><?php echo $_SESSION['empat']; ?></td>
<td>[ <?php echo @$_SESSION['skor4']; ?> ]</td>
<td><input type="text" name="empat"></td>
<td><?php if($min==$_SESSION['skor4']){ echo "NGOCOK!!"; } ?></td>
</tr>
<tr>
<td colspan=4>
<input type="submit" name="tambah" value="Tambah!">
<input type="submit" name="ulang" value="Ulang!">
</td>
</tr>
</table>
<?php } ?>
</form>
</body>
</html>
<?php
if(isset($_POST['main'])){
@$_SESSION['satu']=$_POST['satu'];
@$_SESSION['dua']=$_POST['dua'];
@$_SESSION['tiga']=$_POST['tiga'];
@$_SESSION['empat']=$_POST['empat'];
header('location:index.php');
}
if(isset($_POST['tambah'])){
@$_SESSION['skor1']=$_POST['satu'] + $_SESSION['skor1'];
@$_SESSION['skor2']=$_POST['dua'] + $_SESSION['skor2'];
@$_SESSION['skor3']=$_POST['tiga'] + $_SESSION['skor3'];
@$_SESSION['skor4']=$_POST['empat'] + $_SESSION['skor4'];
header('location:index.php');
}
if(isset($_POST['ulang'])){
SESSION_DESTROY();
header('location:index.php');
}
?>