Visualizzazione dei risultati da 1 a 8 su 8
  1. #1
    Utente di HTML.it
    Registrato dal
    May 2007
    Messaggi
    1,804

    inserire il controllo captka nel form

    ciao ragazzi ho un problema nel inserire il controllo capctka vi posto tutto il cod semi potreste dare una mano inoltre non saprei se inserire lo script sendmail.php dov e il form vi poso lo script
    Codice PHP:
    <?php
    include_once ("includes/include.php");
    $ip $_SERVER['REMOTE_ADDR'];
    $date date('Y-m-d H:i:s'); 

    ?>

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Documento senza titolo</title>
    <script type="text/javascript" src="script-javascript/flashobject.js"></script>
    <SCRIPT TYPE="text/javascript" SRC="script-javascript/content.js"></SCRIPT>
    <script src="script-javascript/AC_RunActiveContent.js" type="text/javascript"></script>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <link href="stili-css/marik.css" rel="stylesheet" type="text/css">
    <style  type="text/css"> 
    <!--
    html, body {
        width: 100% ;

        margin: 0px auto;
        text-align: center;
        padding: 15px;
        background-color: #dddddd;
        font-family: Arial, Helvetica, sans-serif;
        font-size: 12px;
    }
    #captcha{margin:0 auto;text-align:center}
    .errore{color:#f00}
    .style2 {
        font-size: 14px;
        font-family: Verdana, Arial, Helvetica, sans-serif;
    }
    .style3 {font-size: 14px; font-family: Verdana, Arial, Helvetica, sans-serif; color: #000099; }
    -->
    </style>
    <script language="JavaScript" type="text/JavaScript">
    <!--
    function MM_jumpMenu(targ,selObj,restore){ //v3.0
      eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
      if (restore) selObj.selectedIndex=0;
    }
    //-->
    </script>
    </head>

    <body>

    <table width="1024"  border="0" align="center" class="sfondo">
      
      <tr> 
         <td valign="top"> <table width="100%" border="0" cellpadding="0" cellspacing="0" class="sfondomenualto">
            
            <tr> 
              <td width="1024"></td>
              <div id ="menu"></div>
              <script type="text/javascript">
                var fo = new FlashObject("flash/banner.swf", "Menu", "100%", "300", "false", "");
                fo.addParam("quality", "high");
                fo.addParam("menu", "false");
                fo.write("menu");
            </script>

      </tr>
      <tr> 
      
            </tr>
          </table>
          <form action="" method="post">
            <table width="581" border="0" align="center">
              
              <tr> 
                <td width="177" rowspan="14"></td>
                <td height="44" colspan="9"></td>
              </tr>
              <tr> 
                <td height="20" colspan="9"> <div align="right"> </div></td>
              </tr>
              <tr> 
                <td colspan="3"></td>
                <td height="24" colspan="5" valign="top"><div align="right"> 
                    <input name="Name" type="text" id="Name3" size="30">
                  </div></td>
                <td width="29"></td>
              </tr>
              <tr> 
                <td colspan="3"></td>
                <td height="24" colspan="5" valign="top"><div align="right"> 
                    <input name="cognome" type="text" id="cognome2" size="30">
                  </div></td>
                <td width="29"></td>
              </tr>
              <tr> 
                <td height="24" colspan="3"></td>
                <td colspan="5" valign="top"> <div align="right"> </div>
                  <div align="right"> 
                    <input name="telefono" type="text" id="telefono2" size="30">
                  </div></td>
                <td width="29"></td>
              </tr>
              <tr> 
                <td height="26" colspan="3"></td>
                <td colspan="5" valign="top"> <div align="right"> </div>
                  <div align="right">
                    <select name="menu1" onChange="MM_jumpMenu('parent',this,0)">
                      <option selected>informazioni</option>
                    </select>
                  </div></td>
                <td width="29"></td>
              </tr>
              <tr> 
                <td height="26" colspan="3"></td>
                <td colspan="5" valign="top"><div align="right"> 
                    <input name="Email" type="text" id="cognome3" size="30">
                  </div></td>
                <td width="29"></td>
              </tr>
              <tr> 
                <td height="26" colspan="4"></td>
                <td width="46" valign="top"></td>
                <td colspan="3" valign="top"><div align="right"> 
                    <input name="Email2" type="text" id="Email" size="30">
                  </div></td>
                <td width="29"></td>
              </tr>
              <tr> 
                <td width="35" height="120"></td>
                <td width="21"></td>
                <td colspan="6"><div align="right"> 
                    <textarea name="Message" cols="30" rows="6" id="Message"></textarea>
                  </div></td>
                <td width="29"></td>
              </tr>
              <tr> 
                <td height="25"></td>
                <td></td>
                <td width="52"></td>
                <td colspan="5"><center>
                    <? echo "$ip";?></center></td>
                <td></td>
              </tr>
              <tr> 
                <td height="20"></td>
                <td></td>
                <td valign="top"></td>
                <td colspan="5" valign="top"><center>
                    <? echo "$date?></center></td>
                <td></td>
              </tr>
              <tr> 
                <td colspan="2" rowspan="2" valign="top"><div align="right"></div></td>
                <td rowspan="2" valign="top"><div align="right"></div></td>
                <td height="24" colspan="4" valign="top"> <div align="left"><img src= "captcha/captcha.php" /> 
                  </div></td>
                <td height="24" valign="top"><input name="code" type="text" id="code" size="10" /></td>
                <td rowspan="3"></td>
              </tr>
              <tr> 
                <td height="20" colspan="5" valign="top"></td>
              </tr>
              <tr> 
                <td height="26" colspan="2" valign="top"></td>
                <td valign="top"></td>
                <td colspan="3" valign="top"> </td>
                <td width="43" valign="top"><input type="submit" name="Submit" value="Invia"></td>
                <td width="135" valign="top"><div align="center">
                    <input type="submit" name="Submit2" value="Reset">
                  </div></td>
              </tr>
            </table>
          </form>
          

    </p></td>
      </tr>
      <tr> 
        <td height="24" valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="fotter">
            
            <tr> 
              <td width="1024" height="24"><div align="center"><? echo _NOME_BOLD_ ?></div></td>
            </tr>
          </table></td>
      </tr>
      <tr> 
        <td height="44"><div align="center" class="copyrigt" >Copyright &copy; 2005-2007 
            [url="http://www.xxxxxxxxx.it"]<? echo POWERED_BY ?>[/url]</div></td>
      </tr>
    </table>
    </body>
    </html>
    mailform.php
    Codice PHP:
    <?  


    include 'include/config.php';
    $adminaddress "info@xxxxxxxxxxxxxxxxxxx.it"
    $siteaddress ="http://www.xxxxxxxxxxxxxxx.it"
    $sitename "xxxxxxxxxxxxxxxxxxxx"
    $CONFIG['expire'] = 60;
    $CONFIG['regexpire'] = 24//in ore
    $CONFIG['expire'] = 60;
    $CONFIG['regexpire'] = 24//in ore

    $CONFIG['check_table'] = array(
    "name" => "check_global",
    "email" => "check_global"
    );
    function 
    check_email($value)
    {
    global 
    $CONFIG;

    $value trim($value);

    if ((
    $value == ""))
    {
    echo
    "Il campo non può essere lasciato vuoto";
    }

    else return
    "OK";
    }

    //--------------
    define('AUTH_LOGGED'99);
    define('AUTH_NOT_LOGGED'100);

    define('AUTH_USE_COOKIE'101);
    define('AUTH_USE_LINK'103);
    define('AUTH_INVALID_PARAMS'104);
    define('AUTH_LOGEDD_IN'105);
    define('AUTH_FAILED'106);

    define('REG_ERRORS'107);
    define('REG_SUCCESS'108);
    define('REG_FAILED'109);

    $conn = @mysql_connect($CONFIG['host'], $CONFIG['user'], $CONFIG['pass']) or die('Impossibile stabilire una connessione');
    @
    mysql_select_db($CONFIG['dbname']) or die("Errore nel DB");


    //No need to change anything below ... 
    // Gets the date and time from your server
    $date date("m/d/Y H:i:s");

    // Gets the IP Address
    if ($REMOTE_ADDR == ""$ip "no ip";
    else 
    $ip getHostByAddr($REMOTE_ADDR);

    // Gets the POST Headers - the Flash variables
    $action $HTTP_POST_VARS['action'] ;
    $email $HTTP_POST_VARS['email'] ;
    $name $HTTP_POST_VARS['name'] ;
    $cognome $HTTP_POST_VARS['cognome'] ;
    $comments $HTTP_POST_VARS['comments'] ;
    $telefono $HTTP_POST_VARS['telefono'] ;
    $oggetto $HTTP_POST_VARS['oggetto'] ;

    //Process the form data!
    // and send the information collected in the Flash form to Your nominated email address

    if ($action == "send"

    //Innanzitutto controlliamo la var.le name: 
    $controllo check_email($email); 

    if (
    $controllo != "OK"

    echo 
    $controllo

    //Qui potresti anche far visualizzare una cosa del genere: 
    echo "
    <A HREF=\"http://www.xxxxxxxxxxxx.com/homeita/\">Ritorna alla registrazione</A>"


    else 

    //Ora inseriamo i dati nel DB. 
    //Ovviamente devi creare una tabella in cui inserire i dati ke passi con il post. 


    $link_db mysql_connect($CONFIG['host'],$CONFIG['user'],$CONFIG['pass']); 
    mysql_select_db($CONFIG['dbname']); 
    $sql_insert "INSERT INTO contact (name,email,telefono,oggetto,comments,date,ip) VALUES('$name','$email','$telefono','$oggetto','$comments','".date('Y-m-d H:i:s')."','".$_SERVER['REMOTE_ADDR']."')"

    if (
    mysql_query($sql_insert))

    echo 
    "OK RIGA INSERITA 
    "
    ;

    else
    {
    die(
    mysql_error());


    mysql_close($link_db); 



        
    //
        
    mail ("$adminaddress","informazioni",
        
    "Il visitatore ha lasciato le seguenti informazioni \n
        Name: 
    $name 
        Email: 
    $email\n
        Telefono: 
    $telefono 
        Messaggio:
        ------------------------------
        
    $comments
        
        Logged Info :
        ------------------------------
        Using: 
    $HTTP_USER_AGENT
        Hostname: 
    $ip
        IP address: 
    $REMOTE_ADDR
        Date/Time:  
    $date","FROM:$email) ; 
        
        
    //This sends a confirmation to your visitor
        
    mail ("$email","Re:"
        
    "Salve $name $cognome ,\n
    abbiamo ricevuto il suo messaggio e presto sarà contattato.\n
         Saluti dallo Staff di 
    $sitename 
        By
        
    $siteaddress","FROM:$adminaddress ") ; 
        
        
    //Confirmation is sent back to the Flash form that the process is complete
        
    $sendresult "Thank you. You will receive a confirmation email shortly.";
        
    $send_answer "answer=";
        
    $send_answer .= rawurlencode($sendresult);
        echo 
    $send_answer;

    }

    ?>
    pagina dove c e il cod capcka

    Codice PHP:
    session_start();
    $PHP_SELF $_SERVER['PHP_SELF'];
    $errore 0;
    if(isset(
    $_POST['submit']) && isset($_SESSION['captcha'])) {
        if(isset(
    $_POST['code'])){
            
    $_code $_POST['code'];
            if(
    $_SESSION['captcha'] == $_code){
            
                print 
    " messaggio inviato  con successo";
                exit;
            } else {
                
    $errore 1;
            }
        } else {
            
    $errore 1;
        }
    }
    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
    Non è tanto importante saper fare,quanto ad avere voglia d imparare .

  2. #2
    Utente di HTML.it
    Registrato dal
    May 2007
    Messaggi
    1,804
    ragazzi mi date una mano per favore help!!!
    Non è tanto importante saper fare,quanto ad avere voglia d imparare .

  3. #3
    Io inizierei a fare una ricerca nel forum prima di postare

    http://forum.html.it/forum/search.ph...by=&sortorder=
    3/6/2003 è morto l'angelo della mia vita..
    www.markwebinformatica.net
    My BLOG

  4. #4
    Se postavi un pò di codice in più forse era meglio

    Ma poi magari essere più preciso...bo..

  5. #5
    Utente di HTML.it
    Registrato dal
    May 2007
    Messaggi
    1,804
    ciao posto lo script questo e il form del sito e qui vorrei che apparisse il messaggio d avvenuto invio e gli errori tipo campo non valido ecc
    Codice PHP:
    <?php
    include_once ("includes/include.php");

    include(
    'phpcaptcha/captchaCheck.php');

    $ip $_SERVER['REMOTE_ADDR'];
    $date date('Y-m-d H:i:s'); 
    session_start();
    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Documento senza titolo</title>
    <script type="text/javascript" src="script-javascript/flashobject.js"></script>
    <SCRIPT TYPE="text/javascript" SRC="script-javascript/content.js"></SCRIPT>
    <script src="script-javascript/AC_RunActiveContent.js" type="text/javascript"></script>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <link href="stili-css/marik.css" rel="stylesheet" type="text/css">
    <style  type="text/css"> 
    <!--
    html, body {
        width: 100% ;

        margin: 0px auto;
        text-align: center;
        padding: 15px;
        background-color: #dddddd;
        font-family: Arial, Helvetica, sans-serif;
        font-size: 12px;
    }
    #captcha{margin:0 auto;text-align:center}
    .errore{color:#f00}
    .style2 {
        font-size: 14px;
        font-family: Verdana, Arial, Helvetica, sans-serif;
    }
    .style3 {font-size: 14px; font-family: Verdana, Arial, Helvetica, sans-serif; color: #000099; }
    -->
    </style>
    <script language="JavaScript" type="text/JavaScript">
    <!--
    function MM_jumpMenu(targ,selObj,restore){ //v3.0
      eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
      if (restore) selObj.selectedIndex=0;
    }
    //-->
    </script>
    </head>

    <body>

    <table width="1024"  border="0" align="center" class="sfondo">
      
      <tr> 
         <td valign="top"> <table width="100%" border="0" cellpadding="0" cellspacing="0" class="sfondomenualto">
            
            <tr> 
              <td width="1024"></td>
              <div id ="menu"></div>
              <script type="text/javascript">
                var fo = new FlashObject("flash/banner.swf", "Menu", "100%", "300", "false", "");
                fo.addParam("quality", "high");
                fo.addParam("menu", "false");
                fo.write("menu");
            </script>

      </tr>
      <tr> 
      
            </tr>
          </table>
          <form id="captchaForm" name="captchaForm" action="" method="post">
            <table width="581" border="0" align="center">
              
              <tr> 
                <td width="173" rowspan="14"></td>
                <td height="44" colspan="9"></td>
              </tr>
              <tr> 
                <td height="20" colspan="9"> <div align="right"> </div></td>
              </tr>
              <tr> 
                <td colspan="3"></td>
                <td height="24" colspan="5" valign="top"><div align="right"> 
                    <input name="Name" type="text" id="Name3" size="30">
                  </div></td>
                <td width="25"></td>
              </tr>
              <tr> 
                <td colspan="3"></td>
                <td height="24" colspan="5" valign="top"><div align="right"> 
                    <input name="cognome" type="text" id="cognome2" size="30">
                  </div></td>
                <td width="25"></td>
              </tr>
              <tr> 
                <td height="24" colspan="3"></td>
                <td colspan="5" valign="top"> <div align="right"> </div>
                  <div align="right"> 
                    <input name="telefono" type="text" id="telefono2" size="30">
                  </div></td>
                <td width="25"></td>
              </tr>
              <tr> 
                <td height="26" colspan="3"></td>
                <td colspan="5" valign="top"> <div align="right"> </div>
                  <div align="right"> 
                    <select name="menu1" onChange="MM_jumpMenu('parent',this,0)">
                      <option selected>informazioni</option>
                    </select>
                  </div></td>
                <td width="25"></td>
              </tr>
              <tr> 
                <td height="26" colspan="3"></td>
                <td colspan="5" valign="top"><div align="right"> 
                    <input name="Email" type="text" id="cognome3" size="30">
                  </div></td>
                <td width="25"></td>
              </tr>
              <tr> 
                <td height="26" colspan="4"></td>
                <td width="42" valign="top"></td>
                <td colspan="3" valign="top"><div align="right"> 
                    <input name="Email2" type="text" id="Email" size="30">
                  </div></td>
                <td width="25"></td>
              </tr>
              <tr> 
                <td width="31" height="120"></td>
                <td width="17"></td>
                <td colspan="6"><div align="right"> 
                    <textarea name="Message" cols="30" rows="6" id="Message"></textarea>
                  </div></td>
                <td width="25"></td>
              </tr>
              <tr> 
                <td height="25" colspan="3"></td>
                <td colspan="5"><center>
                    <? echo "$ip";?></center></td>
                <td></td>
              </tr>
              <tr> 
                <td height="20" colspan="3"></td>
                <td colspan="5" valign="top"><center>
                    <? echo "$date?></center></td>
                <td></td>
              </tr>
              <tr> 
                <td colspan="3" rowspan="2" valign="top"><div align="right"></div>
                  <div align="right"></div></td>
                <td height="24" colspan="4" valign="top"> <div align="center">[img]phpcaptcha/captchaImage.php[/img]
                  </div></td>
                <td height="24" valign="top"><input name="captcha_input" type="text" id="captcha_input" size="10" /></td>
                <td rowspan="3"></td>
              </tr>
              <tr> 
                <td height="20" colspan="5" valign="top"></td>
              </tr>
              <tr> 
                <td height="26" colspan="3" valign="top"></td>
                <td colspan="3" valign="top"> </td>
                <td width="43" valign="top"><input type="submit" name="Submit" value="Invia"></td>
                <td width="131" valign="top"><div align="center"> 
                    <input type="submit" name="Submit2" value="Reset">
                  </div></td>
              </tr>
            </table>
          </form>
          

    </p></td>
      </tr>
      <tr> 
        <td height="24" valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="fotter">
            
            <tr> 
              <td width="1024" height="24"><div align="center"><? echo _NOME_BOLD_ ?></div></td>
            </tr>
          </table></td>
      </tr>
      <tr> 
        <td height="44"><div align="center" class="copyrigt" >Copyright &copy; 2005-2007 
            [url="http://www.rcwebagency.it"]<? echo POWERED_BY ?>[/url]</div></td>
      </tr>
    </table>
    </body>
    </html>
    qursto e il files che uso per l invio delle email ma manca il controllo dei campi

    Codice PHP:
    ?  


    include 
    'include/config.php';
    $adminaddress "info@xxxxxxx.it"
    $siteaddress ="http://www.xxxxxx.it"
    $sitename "xxxxxxx"
    $CONFIG['expire'] = 60;
    $CONFIG['regexpire'] = 24//in ore
    $CONFIG['expire'] = 60;
    $CONFIG['regexpire'] = 24//in ore

    $CONFIG['check_table'] = array(
    "name" => "check_global",
    "email" => "check_global"
    );
    function 
    check_email($value)
    {
    global 
    $CONFIG;

    $value trim($value);

    if ((
    $value == ""))
    {
    echo
    "Il campo non può essere lasciato vuoto";
    }

    else return
    "OK";
    }

    //--------------
    define('AUTH_LOGGED'99);
    define('AUTH_NOT_LOGGED'100);

    define('AUTH_USE_COOKIE'101);
    define('AUTH_USE_LINK'103);
    define('AUTH_INVALID_PARAMS'104);
    define('AUTH_LOGEDD_IN'105);
    define('AUTH_FAILED'106);

    define('REG_ERRORS'107);
    define('REG_SUCCESS'108);
    define('REG_FAILED'109);

    $conn = @mysql_connect($CONFIG['host'], $CONFIG['user'], $CONFIG['pass']) or die('Impossibile stabilire una connessione');
    @
    mysql_select_db($CONFIG['dbname']) or die("Errore nel DB");


    //No need to change anything below ... 
    // Gets the date and time from your server
    $date date("m/d/Y H:i:s");

    // Gets the IP Address
    if ($REMOTE_ADDR == ""$ip "no ip";
    else 
    $ip getHostByAddr($REMOTE_ADDR);

    // Gets the POST Headers - the Flash variables
    $action $HTTP_POST_VARS['action'] ;
    $email $HTTP_POST_VARS['email'] ;
    $name $HTTP_POST_VARS['name'] ;
    $cognome $HTTP_POST_VARS['cognome'] ;
    $comments $HTTP_POST_VARS['comments'] ;
    $telefono $HTTP_POST_VARS['telefono'] ;
    $oggetto $HTTP_POST_VARS['oggetto'] ;

    //Process the form data!
    // and send the information collected in the Flash form to Your nominated email address

    if ($action == "send"

    //Innanzitutto controlliamo la var.le name: 
    $controllo check_email($email); 

    if (
    $controllo != "OK"

    echo 
    $controllo

    //Qui potresti anche far visualizzare una cosa del genere: 
    echo "
    <A HREF=\"http://www.marikweb.com/homeita/\">Ritorna alla registrazione</A>"


    else 

    //Ora inseriamo i dati nel DB. 
    //Ovviamente devi creare una tabella in cui inserire i dati ke passi con il post. 


    $link_db mysql_connect($CONFIG['host'],$CONFIG['user'],$CONFIG['pass']); 
    mysql_select_db($CONFIG['dbname']); 
    $sql_insert "INSERT INTO contact (name,email,telefono,oggetto,comments,date,ip) VALUES('$name','$email','$telefono','$oggetto','$comments','".date('Y-m-d H:i:s')."','".$_SERVER['REMOTE_ADDR']."')"

    if (
    mysql_query($sql_insert))

    echo 
    "OK RIGA INSERITA 
    "
    ;

    else
    {
    die(
    mysql_error());


    mysql_close($link_db); 



        
    //
        
    mail ("$adminaddress","informazioni",
        
    "Il visitatore ha lasciato le seguenti informazioni \n
        Name: 
    $name 
        Email: 
    $email\n
        Telefono: 
    $telefono 
        Messaggio:
        ------------------------------
        
    $comments
        
        Logged Info :
        ------------------------------
        Using: 
    $HTTP_USER_AGENT
        Hostname: 
    $ip
        IP address: 
    $REMOTE_ADDR
        Date/Time:  
    $date","FROM:$email) ; 
        
        
    //This sends a confirmation to your visitor
        
    mail ("$email","Re:"
        
    "Salve $name $cognome ,\n
    abbiamo ricevuto il suo messaggio e presto sarà contattato.\n
         Saluti dallo Staff di 
    $sitename 
        By
        
    $siteaddress","FROM:$adminaddress ") ; 
        
        
    //Confirmation is sent back to the Flash form that the process is complete
        
    $sendresult "Thank you. You will receive a confirmation email shortly.";
        
    $send_answer "answer=";
        
    $send_answer .= rawurlencode($sendresult);
        echo 
    $send_answer;

    }

    ?> 
    Non è tanto importante saper fare,quanto ad avere voglia d imparare .

  6. #6
    Utente di HTML.it
    Registrato dal
    May 2007
    Messaggi
    1,804
    Codice PHP:
    /** by Antonio Palermi 2007 [url]www.captcha.biz[/url] */
    session_start();
    header("Content-Type: image/png");     // or image/jpg

    // custom parameters
    $box_w                 125;            // Width of the captha box
    $box_h                 35;            // Height of the captha box
    $font                 'arial.ttf';    // Used font
    $font_size             24;             // Size of the font
    $font_angle         0;             // Angle of text
    $font_x             10;             // Margin left
    $font_y             5;             // Margin top
    $color_background     'black';         // Bakground color: black, white, green, blu, red
    $color_text         'white';        // Text color:         black, white, green, blu, red
    $color_lines         'white';        // Lines color:        black, white, green, blu, red
    $thickness            1;            // Thickness of lines
    $lines_angle        5;            // angle of lines (from 1 to 10)
    $lines_number        5;            // numbers of lines

    // set a passcode 
    $pass '';
    $nchar 5;                            // number of characters in image
    for($i=1;$i<=$nchar;$i++){
        
    $charOnumber rand(1,2);
        if(
    $charOnumber == 1){
            
    $chars 'ABEFHKMNRVWX';    // custom used characters
            
    $n strlen($chars)-1;
            
    $x rand(1,$n);
            
    $char substr($chars,$x,1);
            
    $pass .= $char;
        } else {
            
    //$number = rand(3,7);
            
    $numbers = array(1,2,3,4,7);    // custom used numbers
            
    $n count($numbers)-1;
            
    $number $numbers[rand(1,$n)];
            
    $pass .= $number;
        }
    }

    // set the session 
    $_SESSION["pass"] = $pass;

    // create the image resource
    $image ImageCreatetruecolor($box_w,$box_h);

    // set colors
    $white     ImageColorAllocate($image255255255);
    $black     ImageColorAllocate($image000);
    $green     ImageColorAllocate($image02550);
    $red     ImageColorAllocate($image25500);
    $blu     ImageColorAllocate($image00255);

    switch(
    $color_background){
        case 
    'black':
        
    $color_background $black;
        break;
        case 
    'white':
        
    $color_background $white;
        break;
        case 
    'green':
        
    $color_background $green;
        break;
        case 
    'blu':
        
    $color_background $blu;
        break;
        case 
    'red':
        
    $color_background $red;
        break;
        default:
        
    $color_background $black;
    }
    switch(
    $color_text){
        case 
    'black':
        
    $color_text $black;
        break;
        case 
    'white':
        
    $color_text $white;
        break;
        case 
    'green':
        
    $color_text $green;
        break;
        case 
    'blu':
        
    $color_text $blu;
        break;
        case 
    'red':
        
    $color_text $red;
        break;
        default:
        
    $color_text $black;
    }
    switch(
    $color_lines){
        case 
    'black':
        
    $color_lines $black;
        break;
        case 
    'white':
        
    $color_lines $white;
        break;
        case 
    'green':
        
    $color_lines $green;
        break;
        case 
    'blu':
        
    $color_lines $blu;
        break;
        case 
    'red':
        
    $color_lines $red;
        break;
        default:
        
    $color_lines $white;
    }

    // set background 
    imagefill($image00$color_background);

    // set text 
    imagettftext($image$font_size$font_angle$font_x$font_size $font_y$color_text$font$pass);

    // set lines
    imagesetthickness($image,$thickness);

    $step $box_w/$lines_number;

    switch(
    $lines_angle){
        case 
    1:
        
    $start     5;
        
    $end    5;
        break;
        case 
    2:
        
    $start     5;
        
    $end    10;
        break;
        case 
    3:
        
    $start     5;
        
    $end    15;
        break;
        case 
    4:
        
    $start     5;
        
    $end    20;
        break;
        case 
    5:
        
    $start     5;
        
    $end    25;
        break;
        case 
    6:
        
    $start     5;
        
    $end    30;
        break;
        case 
    7:
        
    $start     5;
        
    $end    35;
        break;
        case 
    8:
        
    $start     5;
        
    $end    40;
        break;
        case 
    9:
        
    $start     5;
        
    $end    45;
        break;
        case 
    10:
        
    $start     5;
        
    $end    50;
        break;
    }

    $a $start;
    $b $end;

    for(
    $i=1;$i<=$lines_number;$i++){
        
    $l $start;
        
    $l1 $end;
        
    imageline($image$l1$l1$box_h$color_lines);
        
    $start $a + ($step*$i-1);
        
    $end $start $b;
    }

    // created image 
    imagejpeg($image);
    imagedestroy($image); 
    adesso vorrei inserire i controlli nel files mailform soltanto che gli errori si dovrebbero vedere nella pag del form
    Non è tanto importante saper fare,quanto ad avere voglia d imparare .

  7. #7
    Utente di HTML.it
    Registrato dal
    May 2007
    Messaggi
    1,804
    ciao a tutti mi date una mano
    Non è tanto importante saper fare,quanto ad avere voglia d imparare .

  8. #8
    Utente di HTML.it
    Registrato dal
    May 2007
    Messaggi
    1,804
    ragazzi mi potreste aiutare help
    Non è tanto importante saper fare,quanto ad avere voglia d imparare .

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.