\n"; $headers .= "Content-Type: text/plain; charset=\"UTF-8\"\n"; mail($to, $oggetto, $body, $headers); $insertGoTo = "guestbook.php?insert=yes"; header("Location: ".$insertGoTo); } else { header("Location:guestbook.php?nome=".$_POST['nome']."&email=".$_POST['email']."&testo=".$_POST['testo']."&error=1"); } } } if($_GET['error']) $errore = cleanUrl($_GET['error']); $nome_inser=cleanUrl($_GET['nome']); $email_inser=cleanUrl($_GET['email']); $testo_inser=cleanUrl($_GET['testo']); if(!isset($_SESSION['captcha'])){session_register('captcha');} $PHP_SELF = $_SERVER['PHP_SELF']; $stringa = ''; $cifre = 5; for($i=1;$i<=$cifre;$i++){ $letteraOnumero = rand(1,2); if($letteraOnumero == 1){ // lettera $lettere = 'ABEFHKMNRVWX'; $x = rand(1,11); $lettera = substr($lettere,$x,1); $stringa .= $lettera; } else { $numero = rand(3,7); $stringa .= $numero; } } $_SESSION['captcha'] = $stringa; mysql_select_db($database_conn, $conn); $query_num_record = "SELECT COUNT(ID) FROM ".$prefix."guest"; $rs_num_record = mysql_query($query_num_record, $conn); $row_num_record = mysql_fetch_row($rs_num_record); $tot_records = $row_num_record [0]; $per_pag = 10; $tot_pag = ceil($tot_records / $per_pag); $current_page = (!$_GET['page']) ? 1 : (int)$_GET['page']; $primo = ($current_page - 1) * $per_pag; $paginazione = "
"; if ($current_page == 1) { $paginazione.= "«"; } else { $paginazione.= "«"; } if ($tot_pag < 10 ) { for($i = 1; $i <= $tot_pag; $i++) { if ($i == $current_page) { $paginazione.= "$i"; } else { $paginazione.= "$i"; } } } else if ($current_page < 5) { for($i = 1; $i <= 10; $i++) { if ($i == $current_page) { $paginazione.= "$i"; } else { $paginazione.= "$i"; } } } else if ($tot_pag - $current_page <= 4) { for($i = ($tot_pag - 9); $i <= $tot_pag; $i++) { if ($i == $current_page) { $paginazione.= "$i"; } else { $paginazione.= "$i"; } } } else { for($i = ($current_page -4); $i <= ($current_page +5); $i++) { if ($i == $current_page) { $paginazione.= "$i"; } else { $paginazione.= "$i"; } } } if ($current_page == $tot_pag) { $paginazione.="»"; } else { $paginazione.="»"; } $paginazione.="
"; mysql_select_db($database_conn, $conn); $query_guest="SELECT * FROM ".$prefix."guest WHERE visibile=1 ORDER BY data_inser DESC LIMIT ".$primo.", ".$per_pag; $rs_guest=@mysql_query($query_guest, $conn)or $error=($debugMode)?mysql_error():$errorDefault; $num_guest=@mysql_num_rows($rs_guest); ?> -

INSERT CODE