Visualizzazione dei risultati da 1 a 2 su 2
  1. #1

    Problema con Captcha in Form di Registrazione

    Ciao ragazzi, spero che riuscirete a aiutarmi perchè non capisco proprio il motivo per cui il mio captcha non funziona più.
    questi sono i form dove lo utilizzo:


    Codice PHP:
    function registerform($ef)
    {
        global 
    $path;
      
    $ue $errl $pe $ce $te $em '';
      switch(
    $ef)
      {
        case 
    1:
            
    $errl "<img src=\"{$path}images/point.gif\" alt=\"!\"/> Compilare i campi di registrazione richiesti";
            
    $ue "<img src=\"{$path}images/point.gif\" alt=\"!\"/>";
            break;
        case 
    2:
            
    $errl "<img src=\"{$path}images/point.gif\" alt=\"!\"/> Inserisca la password";
            
    $pe "<img src=\"{$path}images/point.gif\" alt=\"!\"/>";
            break;
        case 
    3:
            
    $errl "<img src=\"{$path}images/point.gif\" alt=\"!\"/> Reinserisca la password per conferma";
            
    $ce "<img src=\"{$path}images/point.gif\" alt=\"!\"/>";
            break;
        case 
    4:
            
    $errl "<img src=\"{$path}images/point.gif\" alt=\"!\"/> Nick non valido";
            
    $ue "<img src=\"{$path}images/point.gif\" alt=\"!\"/>";
            break;
        case 
    5:
            
    $errl "<img src=\"{$path}images/point.gif\" alt=\"!\"/> Password non valida";
            
    $pe "<img src=\"{$path}images/point.gif\" alt=\"!\"/>";
            break;
        case 
    6:
            
    $errl "<img src=\"{$path}images/point.gif\" alt=\"!\"/> Passwords non trovata";
            
    $ce "<img src=\"{$path}images/point.gif\" alt=\"!\"/>";
            break;
        case 
    7:
            
    $errl "<img src=\"{$path}images/point.gif\" alt=\"!\"/> Nickname lunghezza minima 4 caratteri";
            
    $ue "<img src=\"{$path}images/point.gif\" alt=\"!\"/>";
            break;
        case 
    8:
            
    $errl "<img src=\"{$path}images/point.gif\" alt=\"!\"/> Password lunghezza minima 4 caratteri";
            
    $pe "<img src=\"{$path}images/point.gif\" alt=\"!\"/>";
            break;
        case 
    9:
            
    $errl "<img src=\"{$path}images/point.gif\" alt=\"!\"/> Nickname già utilizzato";
            
    $ue "<img src=\"{$path}images/point.gif\" alt=\"!\"/>";
            break;
        case 
    10:
            
    $errl "<img src=\"{$path}images/point.gif\" alt=\"!\"/> Errore database, riprova a registrarti più tardi";
            break;
        case 
    11:
            
    $errl "<img src=\"{$path}images/point.gif\" alt=\"!\"/> Il nickname deve iniziare con una lettera";
            
    $ue "<img src=\"{$path}images/point.gif\" alt=\"!\"/>";
            break;
        case 
    12:
            
    $errl "<img src=\"{$path}images/point.gif\" alt=\"!\"/> Nickname riservato";
            
    $ue "<img src=\"{$path}images/point.gif\" alt=\"!\"/>";
            break;
        case 
    13:
            
    $errl "<img src=\"{$path}images/point.gif\" alt=\"!\"/> Scegliere un nickname differente";
            
    $ue "<img src=\"{$path}images/point.gif\" alt=\"!\"/>";
            break;
        case 
    14:
            
    $errl "<img src=\"{$path}images/point.gif\" alt=\"!\"/> Indirizzo email obbligatorio";
            
    $em "<img src=\"{$path}images/point.gif\" alt=\"!\"/>";
            break;
        case 
    15:
            
    $errl "<img src=\"{$path}images/point.gif\" alt=\"!\"/> Codice conferma visuale non corretto";
            
    $te "<img src=\"{$path}images/point.gif\" alt=\"!\"/>";
            break;
        case 
    16:
            
    $errl "<img src=\"{$path}images/point.gif\" alt=\"!\"/> Indirizzo email gi&agrave; utilizzato";
            
    $em "<img src=\"{$path}images/point.gif\" alt=\"!\"/>";
            break;
      }
      
      
    $cfg mysql_fetch_assoc(mysql_query("SELECT value FROM ibwf_settings WHERE name = 'cfg'"));
      
    $cfg $cfg['value'];
      
      
    $rform "<form action=\"{$path}register.php\" method=\"post\">";
      
    $rform .= "<br/>$ue Nickname: <input name=\"uid\" style=\"-wap-input-format: '*x'\" maxlength=\"12\"/><br/><br/>";

      if(
    $cfg['1'] == '0')
      {
          
    $rform .= "$pe Password: <input type=\"password\" name=\"pwd\" maxlength=\"10\"/><br/><br/>";
          
    $rform .= "$ce Ripeti Password: <input type=\"password\" name=\"cpw\" maxlength=\"10\"/><br/><br/>";
      }
      
      
    $rform .= "Sesso:";
      
    $rform .= "<select name=\"usx\">";
      
    $rform .= "<option value=\"M\">Uomo</option>";
      
    $rform .= "<option value=\"F\">Donna</option>";
      
    $rform .= "</select><br/><br/>";
      
      
    $rform .= "Anno di nascita:";
      
    $rform .= "<select name='nascita'>";
      for(
    $i date('Y')-10$i >= 1960$i--)
          
    $rform .= "<option value='{$i}'>{$i}</option>";
      
    $rform .= "</select><br /><br />";
      
      if(
    $cfg[1] == '1')
      {
          
    $rform .= $em " E-mail: <input type='text' name='email' /><br /><br />";
      }
      
      if(
    $cfg[0] == '1')
      {
          
    $rform .= "Captcha: <img src='{$path}captcha.php?" time() . "' alt='Captcha' align='absmiddle' /><br />";
          
    $rform .= "{$te} Conferma: <input type='text' name='captcha' maxlength='5' style=\"-wap-input-format: '*N'\" />";
          
    $rform .= "<br/><br/>";
      }

      
    $rform .= "<input type=\"Submit\" name=\"invio\" Value=\"invio\"></form>";
      
    $rform .= "<br/><br/>$errl";

      return 
    $rform;


    Codice PHP:
    if((!canreg())||(isipbanned($ipr,$ubr)))
    {
    echo "<div align=\"center\">";
    echo "<u>Registrazioni Chiuse.</u><br/><br/>\n";
    echo "</div>";
    }else{

    // anti-flood registrazione
        
      $actime = mysql_fetch_array(mysql_query("SELECT regdate FROM ibwf_users WHERE browserm='".$ubr."' ORDER BY regdate DESC LIMIT 1"));
      $timeout = $actime[0] + (20);
    if(time()<$timeout)
    {
    $tm = time();
    $ramas = $timeout - $tm;
    echo "<div align=\"center\">";
    echo "<b>ANTI-FLOOD Attivo</b><u>pare che tu abbia gi&agrave' registrato un nick, devi aspettare <b>$ramas secondi</b></u><br/><br/>\n";
    echo "</div>";
    }else{

     // anti-flood browser

    $brwsu = explode("$_SERVER",$HTTP_USER_AGENT);
    $ubr = $brwsu[0];
    $actime = mysql_fetch_array(mysql_query("SELECT regdate FROM ibwf_users WHERE browserm='".$ubr."' ORDER BY regdate DESC LIMIT 1"));
    $timeout = $actime[0] + (20*20);
    if(time()<$timeout)
    {
    $tm = time();
    $ramas = $timeout - $tm;
    echo "<div align=\"center\">";
    echo "Un utente con il tuo stesso cellulare si &egrave appena iscritto.<br/>se non fossi tu questo utente aspetta <b>$ramas secondi</b> per registrarti<br/>";
    echo "</div>";
    }else{
     
     // anti-flood ip
    $uip = getip();
    $actime = mysql_fetch_array(mysql_query("SELECT regdate FROM ibwf_users WHERE ipadd='".$uip."' ORDER BY regdate DESC LIMIT 1"));
    $timeout = $actime[0] + (20*20);
    if(time()<$timeout)
    {
    $tm = time();
    $ramas = $timeout - $tm;
    echo "<div align=\"center\">";
    echo "Un utente con il tuo stesso numero di cellulare risulta gi&agrave' iscritto.<br/>";
    echo "</div>";

    }else{

    echo "<div align=\"center\">";
    echo "<u>Registrazione Account:</u><br/><br/>\n";
    echo "</div>";
    ?>
    <center>
    <img src="../images/point.gif" alt="!"/>
    Usare solo caratteri MAIUSCOLI/minuscoli e numeri da 0 a 9<br/>
    <img src="../images/point.gif" alt="!"/>
    Non usare nickname volgari<br/>
    <img src="../images/point.gif" alt="!"/>
    Nickname e Password lunghezza minima 4 caratteri<br/>
    <img src="../images/point.gif" alt="!"/>
    Il nick deve iniziare con una lettera<br/>
    <img src="../images/point.gif" alt="!"/>
    Attenzione,la password e casensitive ovvero conosce la differenza il sistema tra maiuscole e minuscole<br/>
    <img src="../images/point.gif" alt="!"/>
    Proseguendo con la registrazione dichiari di accettare il regolamento e di rispettare tutti i suoi punti!<br/><br/>
    </center>
    </p>
    <?php
    $cfg 
    mysql_fetch_assoc(mysql_query("SELECT value FROM ibwf_settings WHERE name = 'cfg'"));
    $cfg $cfg['value'];
      
    $tolog false;
    if(
    trim($uid)=="")
    {
        echo 
    registerform(1);
    }
    elseif(
    spacesin($uid)||scharin($uid))
    {
        echo 
    registerform(4);
    }
    else if(
    strlen($uid)<4)
    {
        echo 
    registerform(7);
    }
    else if(
    isdigitf($uid))
    {
        echo 
    registerform(11);
    }else if(
    checknick($uid)==1)
    {
        echo 
    registerform(12);

    }else if(
    checknick($uid)==2)
    {
        echo 
    registerform(13);
    }
    elseif(
    $captcha != $_SESSION['vercode'])
    {
        echo 
    registerform(15);
    }
    elseif(
    $cfg[1] == '0')
    {
        if(
    trim($pwd)=="")
        {
            echo 
    registerform(2);
        }
        else if(
    trim($cpw)=="")
        {
            echo 
    registerform(3);
        }
        else if(
    spacesin($pwd)||scharin($pwd))
        {
            echo 
    registerform(5);
        }
        else if(
    $pwd!=$cpw)
        {
            echo 
    registerform(6);
        }
        else if(
    strlen($pwd)<4)
        {
            echo 
    registerform(8);
        }
        elseif(
    register($uid,$pwd,$usx,$ubr)==1)
        {
            echo 
    registerform(9);
        }
        elseif(
    register($uid,$pwd,$usx,$ubr)==2)
        {
            echo 
    registerform(10);
        }
        else
        {
    echo 
    "<div align=\"center\">";
    echo 
    "<u>Registrazione Conclusa Con Successo!</u><br/>\n";
    echo 
    "<br/>Tuoi Dati di accesso:<br/><br/><b>Nickname: </b>$uid<br/>";
    echo 
    "<b>Password: </b>$pwd<br/><br/>";
    echo 
    "</div>";
            
    if(
    validation())
    {
    echo 
    "Account registrato correttamente, &egrave tuttavia necessario attendere che il nick da lei scelto venga convalidato dall'admin.<br/> se questo non avviene nelle prossime 24 ore scrivi una email a: feedback@.<br/> A presto !";
    }
    $tolog true;
    }
    }
    elseif(
    $cfg[1] == '1')
    {
        
    $pwd "";
        for(
    $i 0$i 6$i++)
        {
            if(
    rand(0200) > 100)
                
    $pwd .= chr(rand(6590));
            else
                
    $pwd .= rand(09);
        }
        
        
    $q mysql_query("SELECT COUNT(*) AS c FROM ibwf_users WHERE email = '{$email}' LIMIT 1");
        
    $r mysql_fetch_assoc($q);
        
        if(
    trim($email) == '')
        {
            echo 
    registerform(14);
        }
        elseif(
    $r['c'] > 0)
        {
            echo 
    registerform(16);
        }
        elseif(
    register($uid,$pwd,$usx,$ubr)==1)
        {
            echo 
    registerform(9);
        }
        elseif(
    register($uid,$pwd,$usx,$ubr)==2)
        {
            echo 
    registerform(10);
        }
        else
        {
    echo 
    "<div align=\"center\">";
    echo 
    "<u>Registrazione Conclusa Con Successo!</u><br/>\n";
    echo 
    "<br/>I tuoi dati di accesso sono stati inviati alla tua casella e-mail.<br/><br/>";
    echo 
    "</div>";
    if(
    validation())
    {
    echo 
    "Account registrato correttamente, &egrave tuttavia necessario attendere che il nick da lei scelto venga convalidato dall'admin.<br/> se questo non avviene nelle prossime 24 ore scrivi una email a: feedback@.<br/> A presto !";
    }
    $tolog true;
    }
    }
    }
    }
    }
    echo 
    "</p>";
    }
    echo 
    "<p>";
    if(
    $tolog)
    {
    $msg "\n Nickname: ".$uid." \n Password: ".$pwd." \n\n ".$sitename." siamo felici di averti tra di noi, ti confermiamo la avvenuta registrazione. ti aspettiamo online \n\n Grazie\n".$sitename."";
    $subj "Dettagli di login per accedere a ".$sitename."";
    $headers 'From: no-reply@' "\r\n" .
    'Reply-To: no-reply@' "\r\n" .
    'X-Mailer: PHP/' phpversion();
    mail($email$subj$msg$headers);
    echo 
    "<a href=\"{$path}login.php?loguid=$uid&amp;logpwd=$pwd\"><img src=\"{$path}images/home.gif\" alt=\"\"/>Accedi</a>";
    }else{
    echo 
    "<br/><br/>";
    echo 
    "<div id=\"displayBlock\">";
    echo 
    "<div align=\"center\">";
    echo 
    "<a href=\"index.php\">Home</a>";
    echo 
    " ¤ ";
    echo 
    "<a href=\"privacy.php\">Privacy</a>";
    echo 
    " ¤ ";
    echo 
    "<a href=\"contact.php\">Contattaci</a></div></div>";
    echo 
    "</div>";  
    echo 
    "<br/>";
    }
    Qualcuno sa aiutarmi?
    anche quando un utente digita il captcha corretto il sistema dice che è errato..
    spero che riuscirete a aiutarmi..

    Grazie

  2. #2
    questo è il codice captcha.php
    Codice PHP:
    <?
    session_start
    ();
    header('content-type: image/jpeg');
    $text rand(10000,99999);
    $_SESSION["vercode"] = $text;

    $height 25;
    $width 65;

    $image_p imagecreate($width$height);
    $black imagecolorallocate($image_p000);
    $white imagecolorallocate($image_p255255255);
    $font_size 14
    imagestring($image_p$font_size55$text$white);
    imagejpeg($image_pnull80);
    imagedestroy($image_p);
    ?>
    All'inizio della seconda parte del codice che ho postato ho anche definite queste:
    $uid = $_POST["uid"];
    $pwd = $_POST["pwd"];
    $cpw = $_POST["cpw"];
    $email = $_POST["email"];

    ma sembra che quella di captcha non sia definita o sbaglio?!
    Ultima modifica di Fabietto89; 08-01-2017 a 20:53

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.