Torna indietro   Hardware Upgrade Forum > Software > Programmazione

AMD Advancing AI 2026: l'hardware AMD per le elaborazioni IA del futuro, tra GPU, CPU e robot
AMD Advancing AI 2026: l'hardware AMD per le elaborazioni IA del futuro, tra GPU, CPU e robot
AMD Advancing AI è l'appuntamento annuale con il quale l'azienda americana mostra quelle che sono le proprie novità dal versante datacenter. Tra piattaforma Helios, GPU Instinct MI455X e processori EPYC di sesta generazione tutto quello che serve per processare l'IA sempre più complessa ed esigente
Tascabile e con Android: BOOX Go 6 Gen II è diverso da tutti gli altri e-reader
Tascabile e con Android: BOOX Go 6 Gen II è diverso da tutti gli altri e-reader
BOOX Go 6 Gen II porta per la prima volta il supporto allo stilo su un e-reader da 6 pollici, affiancando 3 GB di RAM al collaudato Snapdragon 665 e un design rivisto con scocca posteriore a costolature. Su carta la proposta è interessante, ma Android 11 fuori supporto, l'assenza di un alloggiamento per il pennino e un'autonomia ridotta rispetto agli e-reader tradizionali sono i compromessi da accettare
Recensione Lenovo Idea Tab Plus: il tablet da 12 pollici che costa meno di 300 euro
Recensione Lenovo Idea Tab Plus: il tablet da 12 pollici che costa meno di 300 euro
Lenovo Idea Tab Plus prova a portare un display da 12,1 pollici 2.5K, quattro speaker Dolby Atmos e una batteria da 10.200 mAh sotto la soglia psicologica dei 300 euro, penna inclusa. Lo abbiamo usato per oltre una settimana per capire dove l'azienda ha tagliato e dove invece ha tenuto il punto
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


AMD Advancing AI 2026: l'hardware AMD per le elaborazioni IA del futuro, tra GPU, CPU e robot AMD Advancing AI 2026: l'hardware AMD per le ela...
Tascabile e con Android: BOOX Go 6 Gen II è diverso da tutti gli altri e-reader Tascabile e con Android: BOOX Go 6 Gen II &egrav...
Recensione Lenovo Idea Tab Plus: il tablet da 12 pollici che costa meno di 300 euro Recensione Lenovo Idea Tab Plus: il tablet da 12...
Oltre il contante e le crypto: tutto sull'Euro Digitale e la nuova sovranità monetaria europea Oltre il contante e le crypto: tutto sull'Euro D...
Recensione HONOR Magic V6: spessore record e super batteria. È lui il fold da battere? Recensione HONOR Magic V6: spessore record e sup...
IT Wallet apre ai test con le aziende pr...
Google Foto: in arrivo lo strumento Reda...
Amazon Luna fa il suo esordio su Prime V...
Google introduce l'accesso all'account c...
Basta una cartella e l'agente di Claude ...
OpenAI: i modelli "ragionano meglio...
Dieci morti o 100 milioni di danni: le s...
La modalità vocale di Claude lasc...
Marvel's Wolverine torna a mostrarsi con...
Aruba AI Site Manager, l'IA per gestire ...
Servono 4 chip Huawei per pareggiare una...
Crollo di benzina e diesel in Europa: le...
Il nuovo trailer del film di Resident Ev...
Star Wars Zero Company svela il cast e p...
Da 0,7 a 20 FPS: Doom domato su una CPU ...
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: 13:24.


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