Torna indietro   Hardware Upgrade Forum > Software > Programmazione

Qualcomm annuncia la nuova generazione di SoC Snapdragon 8 Elite Gen 6
Qualcomm annuncia la nuova generazione di SoC Snapdragon 8 Elite Gen 6
In occasione del proprio Snapdragon Summit Qualcomm annuncia i due nuovi chip per dispositivi mobile di fascia alta che entreranno nel mercato nel corso del 2027: tanta potenza a disposizione per elaborazioni di intelligenza artificiale sempre più complesse
realme 16 Pro Harry Potter Edition: il nuovo midrange ha uno stemma di Hogwarts che cambia colore al sole!
realme 16 Pro Harry Potter Edition: il nuovo midrange ha uno stemma di Hogwarts che cambia colore al sole!
Hogwarts arriva in fascia media grazie a realme, con una special edition che unisce la Quadra Light-Sensing Color-changing Tech, un baule in stile Hogwarts Express pieno di collezionabili e una scheda tecnica sostanzialmente identica al 16 Pro di partenza: ecco cosa cambia davvero, come si comporta nell'uso quotidiano e quanto vale in base al prezzo di 699,99 euro
Recensione REDMI Note 17 Pro: il midrange con batteria da 8.340 mAh e ricarica veloce
Recensione REDMI Note 17 Pro: il midrange con batteria da 8.340 mAh e ricarica veloce
REDMI Note 17 Pro porta in fascia media una batteria da 8.340 mAh con ricarica HyperCharge a 67W, un display AMOLED da 6,83 pollici capace di picchi di luminosità molto elevati e una struttura certificata TÜV SÜD contro cadute e infiltrazioni d'acqua, il tutto racchiuso in una scocca da 223 grammi. Lo abbiamo provato per diversi giorni tra fotocamera, prestazioni, autonomia e prezzo sul mercato italiano
Tutti gli articoli Tutte le news

Vai al Forum
Rispondi
 
Strumenti
Old 17-06-2006, 17:41   #1
dottorkame
Senior Member
 
Iscritto dal: Jan 2003
Città: Monza
Messaggi: 769
[php] aiutatemi contro lo spam

Ciao ragazzi, mi sono fatto un semplice guestbook in php, il problema e' che ogni giorno ci trovo dentro un sacco di spam e devo sempre ripulire. Mi hanno detto che posso mettere anche dei controlli per evitarlo, qualcuno mi sa aiutare?

il codice e' questo:

Codice:
<?php

// This program writes the data to a file called guestbook.data
// Create a blank file with this name, put it in the same directory as this script, and then set the file to user read/write and group read/write, you may also have to set it to other read/write depending upon your hosting situation.

// set error to false
$error = false;

// the sign guestbook function
function signGuestbook(){
         // gain access to the global form variables
        global $name,$comments;

        // put a new guestbook entry together
        // urlencode it for easy storage
        $new_guestbook_entry = urlencode($name).",".urlencode($comments)."\n";

        // write the new guestbook entry to
        // the guestbook data file
        $fp=fopen("guestbook.data",a) or exit;
        fwrite($fp,$new_guestbook_entry);
        fclose($fp);

	// reset form variables
	$name="";
	$comments="";
}

// the read guestbook function
function readGuestbook(){

         // read the guestbook data
        $fp=fopen("guestbook.data",r) or exit;
        $rawdata=fread($fp,filesize("guestbook.data"));
        fclose($fp);

	// if guestbook is empty
	if($rawdata == ""){
		echo "<p><font face=\"sans-serif\">My Guestbook is empty</font></p>";
		return;
	}

        // put each guestbook entry into an array element
        $each_line = explode("\n",$rawdata);

	// sort from newest to oldest
	//  rsort($each_line);

	// if guestbook is not empty
	$entries = count($each_line)-1;
	echo "<p><font face=\"sans-serif\">Ci sono <b>$entries</b> messaggi</font></p>";

        // step through each guestbook entry
        for ($key = 0; $key < count($each_line)-1; $key++){

              // put each field in the current guestbook entry
              // into a temporary array
                $temp = explode(",",$each_line[$key]);

              // put each guestbook field into the guestbook multi-array
                $guestbook[$key]["name"] = $temp[0];
                $guestbook[$key]["comments"] = $temp[1];
        }

        // display the guestbook
        for($key = count($guestbook) - 1; $key >= 0; $key--){
                echo "<p><font face=\"sans-serif\"><b>Nome:</b> ";
                echo htmlspecialchars(urldecode($guestbook[$key]["name"]));
                echo "</a><br><b>Messaggio:</b> ";
                echo htmlspecialchars(urldecode($guestbook[$key]["comments"]));
                echo "</font></p>";
        }
}

// check for form values and sign guestbook if not empty
if ($sign_guestbook){
        if($name != "" && $comments != ""){
                signGuestbook();
        }else{
                $error = true;
        }
}

?>

<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<title>The Wall  - guestbook -</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head>

<body bgcolor="#000000" text="#CCCCCC">
<p><font face="sans-serif"><b>Lasciaci un messaggio</b></font></p>
<hr noshade size="1" color="#000000">

<?php if($error){ ?>
<p><font face="sans-serif" color="red">One or more fields have not been filled out, please fill them out before signing the guestbook.</font></p>
<?php } ?>

<form name=guestbook method="post" action="guestbook.php">
<div align="left">
    <table width="520" border="0" cellpadding="5" cellspacing="0">
      <!--DWLayoutTable-->
      <tr> 
        <td width="80" align="left" valign="top"><font face="sans-serif">Nome:</font></td>
        <td width="420" align="left" valign="top"><input type="text" name="name" size="70" value="<?php echo addslashes($name); ?>"></td>
      </tr>
      <tr> 
        <td height="61">&nbsp;</td>
        <td>&nbsp;</td>
      </tr>
      <tr> 
        <td rowspan="2" align="left" valign="top"><font face="sans-serif">Messaggio:</font></td>
        <td height="112" align="left" valign="top"><textarea rows="5" name="comments" cols="61" wrap=virtual><?php echo htmlspecialchars($comments); ?></textarea></td>
      </tr>
      <tr> 
        <td height="43" align="left" valign="top"><input type="hidden" name="sign_guestbook" value="true"> 
          <input type="submit" value="Submit"> <input type="reset" value="Reset"></td>
      </tr>
    </table>
</div>
</form>

<p>&nbsp;</p>
<p><b><font face="sans-serif" size="3">Leggi il nostro guestbook</font></b></p>
<hr noshade size="1" color="#000000">

<?php readGuestbook(); ?>

</body>
</html>
dottorkame è offline   Rispondi citando il messaggio o parte di esso
 Rispondi


Qualcomm annuncia la nuova generazione di SoC Snapdragon 8 Elite Gen 6 Qualcomm annuncia la nuova generazione di SoC Sn...
realme 16 Pro Harry Potter Edition: il nuovo midrange ha uno stemma di Hogwarts che cambia colore al sole! realme 16 Pro Harry Potter Edition: il nuovo mid...
Recensione REDMI Note 17 Pro: il midrange con batteria da 8.340 mAh e ricarica veloce Recensione REDMI Note 17 Pro: il midrange con ba...
Insta360 Luna Ultra: la potenza del sensore da 1 pollice incontra la portabilità estrema Insta360 Luna Ultra: la potenza del sensore da 1...
Marvel's Wolverine, la recensione: Logan torna protagonista in un'avventura brutale e intensa Marvel's Wolverine, la recensione: Logan torna p...
Motorola annuncia Signature 27, uno dei ...
Ma Anthropic non doveva rallentare? Lanc...
La NASA conferma che due astronauti ital...
Rockstar introduce regole stringenti per...
Big Fish, in Sicilia il più grand...
Dongfeng mostra la piattaforma T1 in Eur...
Centinaia di vittime per aver scaricato ...
File di Excel illeggibili su LibreOffice...
Grok 4.7 raddoppia la velocità e dimezza...
Sembra uscito da Halo ma è un cas...
Fable 2 su PC a 60 FPS: il port non uffi...
Amazfit T-Rex Dual Solar: ecco il nuovo ...
Fermati 45 maxi-progetti IA negli USA. T...
Niente datacenter a Turbigo: il sindaco ...
OPPO Creator Academy, al via il progetto...
Chromium
GPU-Z
OCCT
LibreOffice Portable
Opera One Portable
Opera One 106
CCleaner Portable
CCleaner Standard
Cpu-Z
Driver NVIDIA GeForce 546.65 WHQL
SmartFTP
Trillian
Google Chrome Portable
Google Chrome 120
VirtualBox
Tutti gli articoli Tutte le news Tutti i download

Strumenti

Regole
Non Puoi aprire nuove discussioni
Non Puoi rispondere ai messaggi
Non Puoi allegare file
Non Puoi modificare i tuoi messaggi

Il codice vB è On
Le Faccine sono On
Il codice [IMG] è On
Il codice HTML è Off
Vai al Forum


Tutti gli orari sono GMT +1. Ora sono le: 03:29.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
Served by www3v