Nopaste-Zone del 03.07.2008 alle 22:07
Nickname: Giulio (1327516052)
Descrizione: Ecco il materiale in mio possesso.
Phjp x cambiare il numero aumentandolo
e il form da usare.
Code:
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:
Per aggiungere un voto (e quindi aggiungi un if con le condizioni necessarie)
Codice:

<?php
$counterfile
="contatore.txt";
if (!
file_exists($counterfile))
 {
  
$stack=1;
  
$file=fopen($counterfile,"w+");
  
fputs($file,$stack);
  
fclose($file);  
 } else {
  
$file=fopen($counterfile,"r");
  
$tot=fgets($file,20);
  
$tot++;
  
fclose($file);
  
$file=fopen($counterfile,"w+");
  
$tot=fputs($file,$tot);  
  
fclose($file);
 }
?>

nella directory della pagina dove metti il contatore verrą creato il file "contatore.txt"
per stamapare il valore
Codice:

<?php
  $counterfile
="contatore.txt";
  
$file=fopen($counterfile,"r");
  
$tot=fgets($file,20);
  
fclose($file);
  echo(
"$tot");
?>



Form

<form id="vote-form" class="vertical" method="post" action=""><input name="numero voti" class="text" type="text" value=""/>
 <input type="submit" value="Vota" /></div>
</div>
</form>

p2NoPaste 1.2 © 2004 by p-two.de
Servizio offerto da IRC-Zone | modified by Kaesar83
Database Posts