Ver Mensaje Individual
  #1 (permalink)  
Antiguo 28/10/2008, 21:01
Avatar de EmaD
EmaD
 
Fecha de Ingreso: marzo-2008
Mensajes: 93
Antigüedad: 16 años, 1 mes
Puntos: 2
Problema securimage captcha variable vacia?.

Gente de los foros de la gran web.

Ando con un problema con implementar securimage.

El securimage es un sistema de captcha , que al parecer se implementa muy rapido y con poco codigo.

http://www.phpcaptcha.org/documentation/quickstart/

EL problema es que en mi caso . Lo implemente en mi web de prueba en el servidor de prueba gratishost y funciono.

Cuando lo llevo a mi server oficial , no em funciona , es decir , su subo los archivos para testear si el server cumple los requerimientos pasa la prueba y funciona todo.

El problema que tengo es , que al parecer mi codigo no me esta comprobando si el codigo de imagen ingresado es correcto o no. Y al parecer la variable

captcha_code
Código:
<input type="text" name="captcha_code" size="10" maxlength="6" />
No se pasa por post , y al aprobe de muchas formas como.

<input type="text" name="'.$_POST['captcha_code'].'" size="10" maxlength="6" />

Recogerla con

$imagen = $_POST['captcha_code'];

pero nada. sigue sin funcionar.


Aver si alguien me da una mano , la verdad qeu los bots ya se me estar viniendo ensima y hace 3 dias que duermo pensando en este maldito codigo.

LEs dejo el codigo completo de el archivo register.php de mi web aver si alguien me quiere un poquito.

Código PHP:
<div id="register">
<?php
echo '<h1>'.MSG_register.'</h1>';
$website->include_language_definition("modulos/user");
include_once 
$_SERVER['DOCUMENT_ROOT'] . '/securimage/securimage.php';

$securimage = new Securimage();
if(
$website->get_config("allow_registration"))
{

if(!isset(
$_SESSION['xid'])){
    
$errors=array();
    
$user_added=false;
    if(isset(
$_POST['suite_button']))// Verificacion y insercion de los datos
    
{
        
// Check the data
        
if(user_exist(addslashes($_POST['pseudo']))){
            
$errors[]=MSG_usertaken;
        }
        else{
            
$check_pseudo=eregi('[A-Za-z0-9]{3,}',$_POST['pseudo']);
            if (!
$check_pseudo || strlen($_POST['pseudo']) >50 )
                
$errors[]=MSG_pseudoinvalid." "sprintf(MSG_atleastmax,3,50) ;
        }
        
        if(
$_POST['pass1']=="")
            
$errors[]= MSG_enterpassword;
        if(
$_POST['pass1']!=$_POST['pass2'])
            
$errors[]=MSG_passerror;
        if(
mail_exist($_POST['email'])){
            
$errors[]= MSG_mailused;
        
        }
        else{
            
$check_mail=eregi('^[_A-Za-z0-9-]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9]+)*$',$_POST['email']);
            if (!
$check_mail)
                
$errors[]=MSG_notvalidemail;
        }
        if(
strlen($_POST['signature'])>150)
            
$errors[]=MSG_sigtoolong;
        
        if(
$_POST['avatar']!="none.gif")
            
$avatar="avatar_base/".$_POST['avatar'];
        else
            
$avatar="";
        
        
            if(
count($errors)!=0){
                
                echo
'<div class="cadre">';
                echo
'<h2>'.MSG_ERRORS.'</h2>';
                echo
'<ul>';
                for(
$i=0;$i<sizeof($errors);$i++)
                {    
                    echo 
"<li>"$errors[$i]."</li>";
                } 
                echo
'</ul>';
                echo
'</div>';
            }
            
if (
$securimage->check($_POST['captcha_code']) == false) {
  
// the code was incorrect
  // handle the error accordingly with your other error checking
echo'<div class="cadre">';
                echo
'<h2>'.MSG_ERRORS.'</h2>';
  
// or you can do something really basic like this
  
die('Codigo De Seguridad Incorrecto <a href="javascript:history.back(1)">Intenta Nuevamente</a>');
echo
'</div>';
}

            else{
                
$user_added=true;

$email2=$_POST['email'];
$pseudo2=$_POST['pseudo'];
$pass12=$_POST['pass1'];
                
$headers  'MIME-Version: 1.0' "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' "\r\n";
//dirección del remitente
$headers .= 'From: Nuevo Usuario xxxxxx <[email protected]>' "\r\n";
//dirección de respuesta, si queremos que sea distinta que la del remitente
$headers .= "Reply-To: [email protected]\r\n";
mail($email2"Nuevo Usuario xxxxx""Gracias Por registrarse en www.xxxx.com.ar<br>Sus datos De usuario en nuestra web son <br> Usuario:$pseudo2 , Password:$pass12 <br>Puede cambiar sus datos desde la opcion Mi cuenta > Editar Mi cuenta <br> Guarde Este Correo <br> Cualquier consulta Puede Hacerla desde el contacto  de la web. "$headers);

                
$sql="INSERT INTO users (pseudo,pass_crypt,email,avatar,signature,register_date,theme) VALUES ('".addslashes($_POST['pseudo'])."','".md5($_POST['pass1'])."','".$_POST['email']."','".$avatar."','".addslashes($_POST['signature'])."','".time()."','".$_POST['theme']."')";
                
$req=mysql_query($sql) or die('SQL ERROR'); 
                
// enviamos el email con los datos del usuario

                
redirection("index.php",5,"success",sprintf(MSG_welcomeuser,"<b>".htmlentities($_POST['pseudo'])."</b>") );
                
            }
    }
    
    if(!
$user_added){ 
        echo
'<form name="register_form" method="post" action="?p=register" enctype="multipart/form-data">';//
        
echo'<table >
          <tr>
            <th colspan="2">'
.MSG_userinfo.'</th>
          </tr>
          <tr>
            <td class="dark">'
.MSG_pseudo.'</td>
            <td class="bright"><input type="text" name="pseudo" '
;
            if(isset(
$_POST['pseudo']))
                echo 
'value="'.$_POST['pseudo'].'"';
            echo
'/>* '.sprintf(MSG_atleastmax,3,50).'</td>
          </tr>
          <tr>
            <td class="dark">'
.MSG_password.'</td>
            <td class="bright"><input type="password" name="pass1" '
;
            if(isset(
$_POST['pass1']))
                echo 
'value="'.$_POST['pass1'].'"';
            echo
' />*</td>
          </tr>
           <tr>
            <td class="dark">'
.MSG_passwordverif.'</td>
            <td class="bright"><input type="password" name="pass2" '
;
            if(isset(
$_POST['pass2']))
                echo 
'value="'.$_POST['pass2'].'"';
            echo
' />*</td>
          </tr>
          <tr>
            <td class="dark">'
.MSG_mail.'</td>
            <td class="bright"><input type="text" name="email" '
;
            if(isset(
$_POST['email']))
                echo 
'value="'.$_POST['email'].'"';
            echo
' />*</td>
          </tr>
          <tr>
            <td class="dark">'
.MSG_signature.'</td>
            <td class="bright"><textarea name="signature" cols="30" rows="5">'
;
            if(isset(
$_POST['signature']))
                echo 
$_POST['signature'];
            echo
'</textarea><br /> ('.MSG_characteresmax.' - NO HTML)</td>
          </tr>
          <tr>
                <td class="dark"><b>'
.MSG_theme.'</b></td>
                <td class="bright">'
;
            echo
'<select name="theme" >';
                
$sql="SELECT id,name FROM themes WHERE activated=1 order by id asc";
                
$req=mysql_query($sql);
                while(
$data=mysql_fetch_array($req))
                {
                    echo
'<option value="'.$data['id'].'" '.$s.'>'.$data['name'].'</option>';
                }
            echo
"</select>";
            echo
'</td>
          <tr>
            <td class="dark">'
.MSG_avatar.'</td>
            <td class="bright">'
;
            echo
'<select name="avatar" onChange ="imgDepart1.src=\'avatars/avatar_base/\' + form.avatar.options[form.avatar.selectedIndex].value;">';
            
$dossier opendir ("avatars/avatar_base/"); 
            
$i 0;
            if(isset(
$_POST['avatar']) && $_POST['avatar']=="none.gif")
            {
                
$fichier1="none.gif";
                
$s2="selected";
            }
            while (
$fichier readdir ($dossier)){
                if (
$fichier != "." && $fichier != ".." && $fichier != "index.html" && $fichier != "avatar_base_temp" && $fichier != "Thumbs.db" && $fichier != "none.gif") {
                    if(!isset(
$fichier1)) $fichier1=$fichier;
                    
//$fichier = substr($fichier, 0, strlen($fichier)-4);
                        
if(isset($_POST['avatar']) && $_POST['avatar']==$fichier ){
                            
$s="selected";
                            
$fichier1=$fichier;
                        }
                        else{
                            if(!isset(
$fichier1)) $fichier1=$fichier;
                            
$s="";
                        }
                        echo 
'<option value="'.$fichier.'" '.$s.'>'.$fichier.'</option>';
                    
$i $i 1;
                }
            } 
        
closedir ($dossier);
                if(!isset(
$s2))$s2="";
                echo
'<option value="none.gif" '.$s2.'>'.MSG_noavatar.'</option>';
                echo
"</select>";
                echo
'<img name="imgDepart1" src="avatars/avatar_base/'.$fichier1.'" alt="'.MSG_noavatar.'" border="1" style="vertical-align:top">';
            echo
'</td>
          </tr>'
;
          
          echo
'
          <tr>
            <td class="dark">Codigo de Seguridad</td>
            <td class="bright">'
;
echo 
'<img id="captcha" src="/securimage/securimageshow.php" alt="CAPTCHA Image" /><br>Ingresar Codigo Imagen:<input type="text" name="'.$_POST['captcha_code'].'" size="10" maxlength="6" /><br>';
//echo '<a href="#" onclick="document.getElementById('captcha').src = "/securimage/securimage_show.php?"+Math.random();" >Reload Image1</a>';
echo'</td>
          </tr>'
;
          
        echo 
'</table>';

        echo
'<p><input type="submit" value="'.MSG_subscribe.'" name="suite_button"></p></form>';


    }
}
else{
    
redirection("index.php",3,"msgerror",MSG_alreadyconnected);
}


}
// Fin del registro
else
    echo
'<p class="msgerror">'.MSG_registerclose.'</p>';
?>
</div>
Bueno despues de ver el video de como escribir un buen post les plantie un buen proplema jajaj

Salu2