-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathguess.php
More file actions
93 lines (83 loc) · 2.15 KB
/
guess.php
File metadata and controls
93 lines (83 loc) · 2.15 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
<?php
session_start();
include 'function.php';
$number = generateNumber();
$message = "";
if (isset($_POST['guess'])) {
$guess = (int)$_POST['guess'];
incrementCounter();
$message = checkGuess($guess, $number);
if ($guess == $number) {
unset($_SESSION['number']);
unset($_SESSION['attempts']);
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Guess the Number</title>
<style>
body {
font-family: Arial, sans-serif;
background: linear-gradient(to right, #74ebd5, #ACB6E5);
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
}
h1 {
color: #fff;
text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}
form {
background: rgba(255, 255, 255, 0.9);
padding: 20px 30px;
border-radius: 10px;
box-shadow: 0 4px 15px rgba(0,0,0,0.2);
display: flex;
flex-direction: column;
align-items: center;
}
input[type="number"] {
padding: 10px;
font-size: 16px;
border: 2px solid #74ebd5;
border-radius: 5px;
margin-bottom: 15px;
width: 200px;
text-align: center;
}
button {
padding: 10px 20px;
font-size: 16px;
border: none;
border-radius: 5px;
background: #74ebd5;
color: #fff;
cursor: pointer;
transition: background 0.3s;
}
button:hover {
background: #4bc0c8;
}
p {
margin-top: 15px;
font-size: 18px;
font-weight: bold;
}
</style>
</head>
<body>
<h1>Guess the Number Game</h1>
<form method="POST" action="">
<input type="number" name="guess" placeholder="Enter a number" required>
<button type="submit">Guess</button>
<?php if($message != ""): ?>
<p><?php echo $message; ?></p>
<?php endif; ?>
</form>
</body>
</html>