Visualizzazione dei risultati da 1 a 4 su 4

Discussione: Contatore per form

  1. #1

    Contatore per form

    Ho un form in php con il quale è possibile inserire commenti.
    Ho inserito un filtro che ferma l'inserimento di codice html,
    rimandando alla stessa pagina.
    Vorrei inserire un contatore che al
    quarto tentativo dirotti il visitatore
    a una pagina di alert.
    Ma non ci riesco.
    La variabile contatore

    global $contatorespam;
    $contatorespam++;

    mi segna sempre 1, e non riesco a farla incrementare
    con i tentativi.
    Dove sbaglio?

    shadowrec

  2. #2
    Non vedendo il codice posso solo intuire.

    Se ricarichi la pagina, $contatorespam perde il suo valore.

    dovresti passarla con un campo hidden oppure in una sessione
    PHP LEARN - Guide, tutorial e articoli sempre aggiornati
    NUOVO: standardLib; il potente framework PHP é ora disponibile
    *******************************************
    Scarica oggi la tua copia di MtxEventManager

  3. #3
    function reply($pid, $sid, $mode, $order, $thold) {
    //include("config.php"); // globalized - Quake
    include("header.php");
    $contspam++;
    global $prefix, $module_name, $user, $cookie, $datetime, $bgcolor1, $bgcolor2, $bgcolor3, $db, $anonpost, $anonymous, $admin, $AllowableHTML;
    cookiedecode($user);
    getusrinfo($user);
    if ($anonpost == 0 AND !is_user($user)) {
    OpenTable();
    echo "<center><font class=title>"._COMMENTREPLY."</font></center>";
    CloseTable();
    echo "
    ";
    OpenTable();
    echo "<center>"._NOANONCOMMENTS."

    "._GOBACK."</center>";
    CloseTable();
    } else {
    if ($pid != 0) {
    $row = $db->sql_fetchrow($db->sql_query("SELECT date, name, email, subject, comment, score FROM ".$prefix."_comments WHERE tid='$pid'"));
    $date = $row['date'];
    $name = stripslashes($row['name']);
    $email = stripslashes($row['email']);
    $subject = stripslashes(check_html($row['subject'], "nohtml"));
    $comment = stripslashes($row['comment']);
    $score = intval($row['score']);
    } else {
    $row2 = $db->sql_fetchrow($db->sql_query("SELECT time, title, hometext, bodytext, informant, notes FROM ".$prefix."_stories WHERE sid='$sid'"));
    $date = $row2['time'];
    $subject = stripslashes(check_html($row2['title'], "nohtml"));
    $temp_comment = stripslashes($row2['hometext']);
    $comment2 = stripslashes($row2['bodytext']);
    $name = stripslashes($row2['informant']);
    $notes = stripslashes($row2['notes']);
    }
    if(empty($comment)) {
    $comment = "$temp_comment

    $comment2";
    }
    OpenTable();
    echo "<center><font class=title>"._COMMENTREPLY."</font></center>";
    CloseTable();
    echo "
    ";
    OpenTable();
    if (empty($name)) $name = $anonymous;
    if (empty($subject)) $subject = "["._NOSUBJECT."]";
    formatTimestamp($date);
    echo "$subject <font class=\"content\">";
    if (!empty($temp_comment)) echo"("._SCORE." $score)";
    if (!empty($email)) {
    echo "
    "._BY." <a href=\"mailto:$email\">$name</a> <font class=\"content\">($email)</font> "._ON." $datetime";
    } else {
    echo "
    "._BY." $name "._ON." $datetime";
    }
    echo "

    $comment

    ";
    if ($pid == 0) {
    if (!empty($notes)) {
    echo ""._NOTE." $notes

    ";
    } else {
    echo "";
    }
    }
    if (!isset($pid) || !isset($sid)) { echo "Something is not right. This message is just to keep things from messing up down the road"; exit(); }
    if ($pid == 0) {
    $row3 = $db->sql_fetchrow($db->sql_query("SELECT title FROM ".$prefix."_stories WHERE sid='$sid'"));
    $subject = stripslashes(check_html($row3['title'], "nohtml"));
    } else {
    $row4 = $db->sql_fetchrow($db->sql_query("SELECT subject FROM ".$prefix."_comments WHERE tid='$pid'"));
    $subject = stripslashes(check_html($row4['subject'], "nohtml"));
    }
    CloseTable();
    echo "
    ";
    OpenTable();
    echo "<form action=\"modules.php?name=$module_name&amp;file=co mments\" method=\"post\">";
    echo "<font class=texadminred><font class=centro>"._NOSPAM."</font></font> ";
    echo "<font class=option>"._YOURNAME.":</font> ";
    if (is_user($user)) {
    cookiedecode($user);
    echo "<a href=\"modules.php?name=Your_Account\">$cookie[1]</a> <font class=\"content\">[ <a href=\"modules.php?name=Your_Account&amp;op=logout \">"._LOGOUT."</a> ]</font>

    ";
    } else {
    echo "<font class=\"content\">$anonymous";
    echo " [ <a href=\"modules.php?name=Your_Account\">"._NEWUSER. "</a> ]

    ";
    }
    echo "<font class=\"option\">"._SUBJECT.":</font>
    ";
    if (!stripos_clone($subject,"Re:")) $subject = "Re: ".substr($subject,0,81)."";
    echo "<input type=\"text\" name=\"subject\" size=\"50\" maxlength=\"85\" value=\"$subject\">

    ";
    echo "<font class=\"option\">"._UCOMMENT.":</font>
    "
    ."<textarea wrap=\"virtual\" cols=\"50\" rows=\"10\" name=\"comment\"></textarea>
    "
    ."<font class=\"content\">"._ALLOWEDHTML."
    ";
    while (list($key)= each($AllowableHTML)) echo " &lt;".$key."&gt;";
    echo "
    ";
    if (is_user($user) AND ($anonpost == 1)) { echo "<input type=\"checkbox\" name=\"xanonpost\"> "._POSTANON."
    "; }
    /* Start Patch for security code by aeniGma - http://www.thekey.it */
    mt_srand ((double)microtime()*1000000);
    $maxran = 1000000;
    $random_num = mt_rand(0, $maxran);
    echo "
    <font class=\"option\">Type security-code:</font>
    ";
    echo "[img]?gfx=gfx&random_num=$random_num[/img]
    ";
    echo "<input type=\"text\" NAME=\"gfx_check\" SIZE=\"7\" MAXLENGTH=\"6\">
    ";
    echo "<input type=\"hidden\" name=\"random_num\" value=\"$random_num\">
    ";
    /* End Patch for security code */
    // Quake - start
    if (!isset($mode) OR empty($mode)) {
    if(isset($userinfo['umode'])) {
    $mode = $userinfo['umode'];
    } else {
    $mode = "thread";
    }
    }
    if (!isset($order) OR empty($order)) {
    if(isset($userinfo['uorder'])) {
    $order = $userinfo['uorder'];
    } else {
    $order = 0;
    }
    }
    if (!isset($thold) OR empty($thold)) {
    if(isset($userinfo['thold'])) {
    $thold = $userinfo['thold'];
    } else {
    $thold = 0;
    }
    }
    // Quake - end

    echo "<input type=\"hidden\" name=\"pid\" value=\"$pid\">\n"
    ."<input type=\"hidden\" name=\"sid\" value=\"$sid\">\n"
    ."<input type=\"hidden\" name=\"mode\" value=\"$mode\">\n"
    ."<input type=\"hidden\" name=\"order\" value=\"$order\">\n"
    ."<input type=\"hidden\" name=\"thold\" value=\"$thold\">\n"
    ."<input type=\"submit\" name=\"op\" value=\""._PREVIEW."\">\n"
    ."<input type=\"submit\" name=\"op\" value=\""._OK."\">\n"
    ."<select name=\"posttype\">\n"
    ."<option value=\"exttrans\">"._EXTRANS."</option>\n"
    ."<option value=\"html\" >"._HTMLFORMATED."</option>\n"
    ."<option value=\"plaintext\" selected>"._PLAINTEXT."</option>\n"
    ."</select></font></form>\n";
    CloseTable();
    }
    include("footer.php");
    }
    Questo è il codice, parte, all'interno del file.php

    ShadowRec

  4. #4

    Nessun aiuto!

    Nessun aiuto!
    Se porto la variabile via hidden,
    non è pericoloso per la sicurezza?
    C'è nessuno?

    ShadowRec

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.