Cookies
Publicado por Tomas (24 intervenciones) el 31/01/2015 17:49:38
Hola, no sé como hacer funcionar esta cookie, lo unico que hace es contar visitas y reset. No se como enlazar los botones sumar cookie( hacer un f5) y reset (visitas=0) con el codigo php; o la cookie tiene que estar en un php aparte.
Alguien me lo explica?
Alguien me lo explica?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
if(!isset($_COOKIE(['contador']))){
setcookie('conta',1,time()+3600);
echo "Primera visita";}
else{
setcookie('contador', $_COOKIE['contador']+1,time()+3600);
echo "Numero de visita:".$_COOKIES['contador'];}
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta CONTENT="text/html; charset=UTF-8" http-equiv="Content-Type"/>
<title> coookies</title>
</head>
<body>
<form action="cokies.html" method="post">
<h1><p>COOKIES</p></h1>
<input type="submit" name="submit" value="sumar visita" >
<input type="submit" name="submit" value="reset" >
</body>
</html>
Valora esta pregunta


0