-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path7.php
More file actions
36 lines (36 loc) · 1.13 KB
/
Copy path7.php
File metadata and controls
36 lines (36 loc) · 1.13 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
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<?php
$usuarios = (filter_input(INPUT_POST, 'usuarios')) !== null ? unserialize(filter_input(INPUT_POST, 'usuarios')) : [];
if(!empty(filter_input(INPUT_POST, 'click')) && !empty(filter_input(INPUT_POST, 'user'))){
$user = filter_input(INPUT_POST, 'user');
if(array_key_exists($user, $usuarios)){
$usuarios[$user]++;
} else {
$usuarios[$user] = 1;
}
}
?>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<form action="" method="POST">
<input type="hidden" name="usuarios" value="<?=htmlspecialchars(serialize($usuarios))?>"/>
Introduzca su nombre de usuario:<br/>
<input type="text" name="user"/>
<input type="submit" name="click" value="Haga click"/>
</form>
<?php
if(!empty($user)){
echo "El usuario $user ha clickado $usuarios[$user] veces.";
}
?>
</body>
</html>