Precedente :: Successivo |
Autore |
Messaggio |
mirrors Mortale adepto

Registrato: 20/03/06 17:06 Messaggi: 33
|
Inviato: 26 Lug 2006 15:12 Oggetto: Bannare visitatori che insultano o fanno SPAM |
|
|
Ciao, Afrodite...scherzo Ciao a tutti:
Avrei bisogno di uno script o di una funzione, se usiste , in grado di Bannare un Utente conoscendo l'IP.
Lo script che uso è una TOP 100 (il forum di supporto è chiuso da tempo); l'ho personalizzato ma c'è un navigatore che continua ad insultare o a fare spamming.
Sul Database ho il suo IP (l'Email, ovviamente non esiste) che è nella tabella review (tabella che registra i messaggio che ciascuno può lasciare a ciascun iscritto).
Spero che questo si possa fare. L'IP non deriva da una connessione ADSL perché varia di pochissimo (ES: 123.50.45.177 - 123.50.25.177)
Un grazie anticipato.
Abbraccio tutti.
Giorgio
 |
|
Top |
|
 |
horus Macchinista


Registrato: 22/03/05 10:48 Messaggi: 2554 Residenza: Sirio e dintorni
|
Inviato: 26 Lug 2006 15:48 Oggetto: |
|
|
Così, non conoscendo lo script che usi, mi sembra un po' vago. Se posti un po' di codice lo posso guardare.
In ogni caso a logica ti direi di cercare nei sorgenti la funzione che salva il messaggio ed inserire tutto il codice in un blocco if che ha come condizione il controllo che l'ip (in genere in una variabile server chiamata REMOTE_ADDR) non sia presente in una determinata lista. |
|
Top |
|
 |
chemicalbit Dio maturo


Registrato: 01/04/05 18:59 Messaggi: 18597 Residenza: Milano
|
Inviato: 26 Lug 2006 18:22 Oggetto: |
|
|
Ma il forum non ha un'apposita fuznione per bannare? |
|
Top |
|
 |
mirrors Mortale adepto

Registrato: 20/03/06 17:06 Messaggi: 33
|
Inviato: 26 Lug 2006 22:19 Oggetto: Ottima idea |
|
|
horus ha scritto: | Così, non conoscendo lo script che usi, mi sembra un po' vago. Se posti un po' di codice lo posso guardare.
In ogni caso a logica ti direi di cercare nei sorgenti la funzione che salva il messaggio ed inserire tutto il codice in un blocco if che ha come condizione il controllo che l'ip (in genere in una variabile server chiamata REMOTE_ADDR) non sia presente in una determinata lista. |
Giusto, grazie!
Una cosa sola, la lista devo crearla io o posso di volta in volta bannare, creando una "lista nera" sul database?
Nel secondo caso come potrei fare?
Ti posto qui lo script:
Codice: | <?
include "config.php";
if ($submit AND $site AND $REQUEST_METHOD == "POST" AND $use_review == 1) {
$name = trim($name);
$name = preg_replace('/[^a-zA-Z ]/', '', $name);
$name = htmlspecialchars($name);
$check_email = check_email_addr($email);
$err = "";
if (!$name) $err.="Per favore specifica il tuo Nome.<BR>";
if (!$email) $err.="Per favore specifica la tua Email.<BR>";
if (!$review) $err.="Per favore scrivi il tuo Commento.<BR>";
if ($check_email == 0) $err.="L'ndirizzo Email da te indicato non esiste.<BR>";
if ($anti_review[$site] == 1) $err.="Scusaci,ma non puoi scrivere più di un commento al giorno.<BR>";
if (!$err) {
$cdate = date ("Ymd");
$query = mysql_db_query ($dbname,"select postip from top_review where sid='$site' AND postdate='$cdate' AND postip='$REMOTE_ADDR'",$db) or die (mysql_error());
if (mysql_num_rows($query) > 0) {
$perr=1;
}
else {
mysql_db_query ($dbname,"insert into top_review (postip,rating,sid,review,name,email) values ('$REMOTE_ADDR','$rating','$site','$review','$name','$email')",$db) or die (mysql_error());
setcookie ("anti_review[$site]", "1",time()+86400);
}
}
}
include "header.php";
if ($site) {
if (!$from OR $from < 0 OR $from < $review_step) $from = 0;
$query = mysql_db_query ($dbname,"select *,DATE_FORMAT(postdate, '%M/%d/%Y') as post_date from top_review where sid='$site' ORDER BY rid DESC LIMIT $from,$review_step",$db) or die (mysql_error());
$tquery = mysql_db_query ($dbname,"select count(rid) as rtotal from top_review where sid='$site'",$db) or die (mysql_error());
$squery = mysql_db_query ($dbname,"select title from top_user where sid='$site' ",$db) or die (mysql_error());
$srows = mysql_fetch_array($squery);
if ($err) echo "<center><font color=\"red\" face=\"$font_face\" size=\"$font_size\">$err</font></center>";
if ($perr==1) echo "<center><font color=\"red\" face=\"$font_face\" size=\"$font_size\">Scusaci ma non puoi scrivere più di un Commento al giorno.</font></center>";
echo "<CENTER><font color=\"$font_color\" face=\"$font_face\" size=\"$font_size\">
<A HREF=\"out.php?site=$site\">$srows[title]</A> Commenti:<BR>
<A HREF=\"$url_to_folder\">Torna alla $top_name</A>
</font></CENTER>";
echo "<div align=right><B><font color=\"$font_color\" face=\"$font_face\" size=\"-2\">Commenti:";
$trows = mysql_fetch_array($tquery);
$count = $trows[rtotal];
$i = 0;
$step = $review_step;
$sstep = 0;
while ($sstep < $count) {
if ($from == $sstep) {
echo " [$i] ";
}
else {
echo " [<a href=\"?from=$sstep&site=$site\">$i</a>] ";
}
$sstep = $sstep + $step;
$i++;
}
echo "</font></B></div>";
while ($rows = mysql_fetch_array($query)) {
echo "<HR><font color=\"$font_color\" face=\"$font_face\" size=\"$font_size\">
<A HREF=\"mailto:$rows[email]\">$rows[name]</A><BR>
Rating: $rows[rating]<BR>
$rows[review] - $rows[post_date]
</font>";
}
?>
<HR>
<form action="review.php" method="post">
<font color="<? echo $font_color;?>" face="<? echo $font_face;?>" size="<? echo $font_size;?>">Nome:</font><BR>
<input type=text name=name size=20 maxlenght=20><BR>
<font color="<? echo $font_color;?>" face="<? echo $font_face;?>" size="<? echo $font_size;?>">Indirizzo Email:</font><BR>
<input type=text name=email size=20 maxlenght=40><BR>
<?
if (!$phptopsites_review[$site]) {
?>
<font color="<? echo $font_color;?>" face="<? echo $font_face;?>" size="<? echo $font_size;?>">Rating:</font><BR>
<select name=rating>
<option value=1>1 (brutto)</option>
<option value=2>2</option>
<option value=3>3</option>
<option value=4>4</option>
<option value=5>5</option>
<option value=6>6</option>
<option value=7>7</option>
<option value=8>8</option>
<option value=9>9</option>
<option value=10>10 (il migliore)</option>
</select><BR>
<?
}
else {
?>
<input type=hidden name=rating value="<? echo $phptopsites_review[$site];?>">
<?
}
?>
<font color="<? echo $font_color;?>" face="<? echo $font_face;?>" size="<? echo $font_size;?>">Commento:</font><BR>
<textarea rows=10 cols=40 name=review></textarea><BR>
<input type=submit name=submit>
<input type=reset name=reset>
<input type=hidden name=site value="<? echo $site;?>">
</form>
<?
}
include "footer.php";
?> |
Un abbraccio.
Giorgio |
|
Top |
|
 |
horus Macchinista


Registrato: 22/03/05 10:48 Messaggi: 2554 Residenza: Sirio e dintorni
|
Inviato: 27 Lug 2006 09:34 Oggetto: |
|
|
Potresti farti una tabella di questo tipo:
Codice: | CREATE TABLE top_bans (
sid varchar(10) NOT NULL default '',
ip varchar(15) NOT NULL default '0.0.0.0',
PRIMARY KEY (sid,ip)
) |
La dimensione del campo sid prendila da una tabella dove c'è, io ho messo 10 per esempio.
Poi modifica il codice per fare il controllo sui bans
Codice: | if (!$err)
{
// verifica se l'ip è nella lista dei bannati per il sito corrente
$bans = mysql_db_query ($dbname,"select ip from top_bans where sid='$site' AND ip='$REMOTE_ADDR'",$db) or die (mysql_error());
if (mysql_num_rows($bans) > 0)
{
// se si errore
$perr=1;
}
else
{
// se non è bannato esegue la normale procedura
$cdate = date ("Ymd");
$query = mysql_db_query ($dbname,"select postip from top_review where sid='$site' AND postdate='$cdate' AND postip='$REMOTE_ADDR'",$db) or die (mysql_error());
if (mysql_num_rows($query) > 0)
{
$perr=1;
}
else
{
mysql_db_query ($dbname,"insert into top_review (postip,rating,sid,review,name,email) values ('$REMOTE_ADDR','$rating','$site','$review','$name','$email')",$db) or die (mysql_error());
setcookie ("anti_review[$site]", "1",time()+86400);
}
}
} |
Dove posso trovare l'applicativo che usi, sinceramente non l'ho mai sentito e sono curioso, ha un sito ufficiale? |
|
Top |
|
 |
|
|
Non puoi inserire nuovi argomenti Non puoi rispondere a nessun argomento Non puoi modificare i tuoi messaggi Non puoi cancellare i tuoi messaggi Non puoi votare nei sondaggi
|
|