Ver Mensaje Individual
  #5 (permalink)  
Antiguo 12/08/2010, 14:40
dezagus
 
Fecha de Ingreso: abril-2010
Ubicación: Ping: BSAS - Arg
Mensajes: 791
Antigüedad: 14 años
Puntos: 25
Respuesta: Problema con Sesión

Cita:
Iniciado por pateketrueke Ver Mensaje
mira, si crees que segmentando tu error y omitiendo cosas tales como el inicio de sesión, ¿que piensas?

- es tan simple que deben contemplarlo ya...
- es algo que saben que debo tener, y lo tengo por eso lo omito

si esperas algún tipo de solución, mientras das por hecho que "sabemos" ciertas partes de tu script... ¿o porque razón las omites?

así nadie te va a ayudar... de verdad, quieres ayuda completa... trata de dar la información completa!!

ya ni que pensar... con la forma en la que llevas tu cuestión ni dan ganas de poner atención...
Jajaj, tienes razon. Es muy egoista de mi parte pedir ayuda y no compartir nada.
Pasa que en el mismo blog de Maestros del Web se discute esta temática.
Igual, no pasa nada, solamente es un sistema de administración.

Este es el PHP que Procesa la Info:

Código PHP:
// Conectarse a la Database SQL e Iniciar Seción en Capcha

session_start();

include(
'conec.php');
include(
'getip.php');

date_default_timezone_set('GTM');
      

// Tomar las Variables desde URL

    
$Fname $_POST["nombre"];
    
$Lname $_POST["apellido"];
    
$Mail $_POST["mail"];
    
$Genere $_POST["sexo"];
    
$Host2 $_POST["servidor"];
    
$Port "80";
    
$IPOwner getRealIP();
    
$Pay "0";
    
$Method "None";
    
$TimeCreate date("c");

// Separar Guiones en Diferentes Variables

$hostsinseparar $Host2
$separado explode('-',$hostsinseparar);

// Quitar Espacios en Blanco
$espacio_sinespacio trim($separado[0]);
$condicionesuso_sinespacio trim($separado[1]);
$entregavariables_sinespacio trim($separado[2]);

// Separar Intervinculo

$Intervinculo trim($separado[3]);

// Definir Host para Guardar en SQL
$Host $nombresindominio

// Crear Nombre del Host con el dominio
$separadoporbarradiagonal explode('/',$entregavariables_sinespacio);
$nombredelhost trim($separadoporbarradiagonal[0]);

// Crear Nombre del Host con el dominio y acc (acc.midominio.com)
$nombredelhostconacc 'acc.'.$nombredelhost;


// Crear Nombre del Host sin el dominio
$separadorpunto explode('.',$nombredelhost);
$nombresindominio trim($separadorpunto[0]);

// Si es espacio es Igual a 0, mostrar ilimitado.
if ($espacio_sinespacio == 0)
{
$espacio_sinespacio2 'Ilimitado';
}else{
$espacio_sinespacio2 $espacio_sinespacio.' GB';
}

// Mostrar Variables Finales

// echo $espacio_sinespacio.'<< si estos guiones están al lado de la variable, entonces está todo bien.'.'<br>';
// echo $Host.'<< si estos guiones están al lado de la variable, entonces está todo bien.'.'<br>';
// echo $entregavariables_sinespacio.'<< si estos guiones están al lado de la variable, entonces está todo bien.'.'<br>';

// Generar Aleatoriamente un Código

function Gen_Cod_Aleatorio()
{
$Usuario "abcdefghjkmnpqrstuvwxyz123456789";
$Aleatorio str_shuffle($Usuario);
$Aleatorio substr($Aleatorio,0,12);
$Aleator $Aleatorio;
return 
$Aleator;
}

$Aleatorio Gen_Cod_Aleatorio();
Gen_Cod_Aleatorio_Verify_User($Aleatorio);

function 
Gen_Cod_Aleatorio_Verify_User($AleaUs){
$wea mysql_query("SELECT UserAcc FROM ActivesAcc where UserAcc ='$AleaUs'");
$row mysql_fetch_row($wea);
if (
$row[0] != ""){ 
Gen_Cod_Aleatorio_Verify_User($Aleatorio);
} else { 
return 
$AleaUs;
}}

$Aleatorio2 Gen_Cod_Aleatorio();
Gen_Cod_Aleatorio_Verify_Pass($Aleatorio2);

function 
Gen_Cod_Aleatorio_Verify_Pass($AleaPass){
$wea mysql_query("SELECT PasswordAcc FROM ActivesAcc where PasswordAcc ='$AleaPass'");
$row mysql_fetch_row($wea);
if (
$row[0] != ""){ 
Gen_Cod_Aleatorio_Verify_Pass($Aleatorio2);
} else { 
return 
$AleaPass;
}}


// Muestra de lo que se Genera y que las Variables son Enviadas.
// $Us = Gen_Cod_Aleatorio_Verify_User($Aleatorio);
// $Ps = Gen_Cod_Aleatorio_Verify_Pass($Aleatorio2);
// echo $Us.'     '.$Ps.'   Esto fue Generado al Azar.';

$UserAcc Gen_Cod_Aleatorio_Verify_User($Aleatorio);
$PasswordAcc Gen_Cod_Aleatorio_Verify_Pass($Aleatorio2);


// Validar el Formulario si fue completado correctamente



if (!preg_match("/^[a-zA-Z_-]+$/"$Fname) || strlen($Fname) == "0") {
header ("Location: $directorio/$idiomaurl.php?error=nom");
}elseif (!
preg_match("/^[a-zA-Z_-]+$/"$Lname) || strlen($Lname) == "0") {
header ("Location: $directorio/$idiomaurl.php?error=ape");
}elseif (!
eregi('^([a-zA-Z0-9\._-]+)\@([a-zA-Z0-9\.]+)\.([a-zA-Z]{2,4})$',$Mail)) { 
header ("Location: $directorio/$idiomaurl.php?error=mail");
}elseif (
$Genere == ''){
header ("Location: $directorio/$idiomaurl.php?error=ge");
}elseif(
strtoupper($_REQUEST["captcha"]) == $_SESSION["captcha"]){
// REMPLAZO EL CAPTCHA USADO POR UN TEXTO LARGO PARA EVITAR QUE SE VUELVA A INTENTAR
$_SESSION["captcha"] = md5(rand()*time());


mysql_query("INSERT INTO ActivesAcc
(Fname,Lname,Mail,Genere,Host,UserAcc,PasswordAcc,Port,IPOwner,Pay,Method,TimeCreate,Intervinculo) VALUES ('$Fname', '$Lname', '$Mail', '$Genere', '$nombresindominio', '$UserAcc', '$PasswordAcc', '$Port', '$IPOwner', '$Pay', '$Method', '$TimeCreate', '$Intervinculo')"
);


// Redireccionar entregando variables

header ("Location: $directorio/$idiomaurl-gracias.php?nombre=$Fname&urlacc=$linkacc&us=$UserAcc&con=$PasswordAcc&host=$nombredelhostconacc&port=$Port");


}else{
// REMPLAZO EL CAPTCHA USADO POR UN TEXTO LARGO PARA EVITAR QUE SE VUELVA A INTENTAR
$_SESSION["captcha"] = md5(rand()*time());
// INSERTA EL CÓDIGO DE ERROR AQUÍ
header ("Location: $directorio/$idiomaurl.php?error=capcha");

Este es el Link en el HTML al Captcha:

Código:
<table width="158" border="0" cellspacing="0" cellpadding="0">
                                                  <tr>
                                                    <td>&nbsp;</td>
                                                  </tr>
                                                  <tr>
                                                    <td><div align="center"><img src="captcha/captcha.php" /></div></td>
                                                  </tr>
                                                  <tr>
                                                    <td>&nbsp;</td>
                                                  </tr>
                                                  <tr>
                                                    <td><div align="center">
                                                      <input type="text" size="16" name="captcha" style="height:15px;color:grey" />
                                                    </div></td>
                                                  </tr>
                                                  <tr>
                                                    <td>&nbsp;</td>
                                                  </tr>
                                                  <tr>
                                                    <td><div align="center">
                                                      <input name="submit" type="submit" id="Enviar" value="Enviar" />
                                                    </div></td>
                                                  </tr>
                                                </table>
Y este es el Captcha en Si...

Código PHP:
    
    
#create image and set background color
    
$captcha imagecreatetruecolor(120,35);
    
$background_color imagecolorallocate($captcha255255255);
    
imagefill($captcha00$background_color);
    
    
#generate a random string of 5 characters
    
$string substr(md5(rand()*time()),0,5);

    
#make string uppercase and replace "O" and "0" to avoid mistakes
    
$string strtoupper($string);
    
$string str_replace("O","B"$string);
    
$string str_replace("0","C"$string);

    
#save string in session "captcha" key
    
session_start();
    
$_SESSION["captcha"]=$string;

    
#place each character in a random position
    
$font 'arial.ttf';
    for(
$i=0;$i<5;$i++){
        
$color rand(0,32);
        if(
file_exists($font)){
            
$x=4+$i*23+rand(0,6);
            
$y=rand(18,28);
            
imagettftext  ($captcha15rand(-25,25), $x$yimagecolorallocate($captcha$color$color$color), $font$string[$i]);
        }else{
            
$x=5+$i*24+rand(0,6);
            
$y=rand(1,18);
            
imagestring($captcha5$x$y$string[$i], imagecolorallocate($captcha$color$color$color));
        }
    }
    
    
#applies distorsion to image
    
$matrix = array(array(111), array(1.071.0), array(111));
    
imageconvolution($captcha$matrix1632);

    
#avoids catching
    
header("Expires: 0");
    
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    
header("Cache-Control: private",false); 

    
#return the image
    
header("Content-type: image/gif");
    
imagejpeg($captcha); 
Que lo saqué de Aca:

http://www.captchafacil.com.ar/



Disculpa pateketrueke.