S
Slabon
Curioso
¡Usuario con pocos negocios! ¡Utiliza siempre saldo de Forobeta!
Hola, deseo poner el recaptcha en el siguiente formulario sin embargo no he logrado hacerlo funcional, agradecería que alguien me ayudará por favor a hacer que funcione correctamente.
PHP:
<div class="main main_title">
<p style="margin-top:10px"> >> Registro
</div><div class="main main_content">
<?PHP
require_once('./captcha/recaptchalib.php');
Llaves de la captcha
$captcha_publickey = "xxx";
$captcha_privatekey = "xxx";
$error_captcha=null;
if ($_POST){
$captcha_respuesta = recaptcha_check_answer ($captcha_privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if ($captcha_respuesta->is_valid) {
}else{
El reCAPTCHA no se ha introducido correctamente volver e intentar otra vez.
}
}
$regCoins = 0;
$comprobante = 0;
$fecha = date('Y-m-j H:i:s');
$fecha = strtotime ( '-5 hour' , strtotime ( $fecha ) ) ;
$fecha = strtotime ( '+0 minute' , $fecha ) ;
$fecha = strtotime ( '+0 second' , $fecha ) ;
$fecha = date ( 'Y-m-j H:i:s' , $fecha );
$expireDate = strtotime ( '+7 year' , strtotime ( $fecha ) ) ;
$expireDate = date ( 'Y-m-j H:i:s' , $expireDate );
$expireEXP = strtotime ( '+7 day' , strtotime ( $fecha ) ) ;
$expireEXP = date ( 'Y-m-j H:i:s' , $expireEXP );
if($serverSettings['register_on'] && (!isset($_SESSION['user_admin']) && !checkInt($_SESSION['user_admin']) && !$_SESSION['user_admin']>=0)) {
if(isset($_POST['submit']) && $_POST['submit']=="Enviar") {
if((checkAnum($_POST['account']) && strlen($_POST['account'])>=4 && strlen($_POST['account'])<=16) && checkAnum($_POST['pass']) && strlen($_POST['pass'])>=6 && strlen($_POST['pass2'])<=16 && !empty($_POST['pass2']) && (checkName($_POST['uname']) && strlen($_POST['uname'])>=3 && strlen($_POST['uname'])<=20) && $_POST['pass']==$_POST['pass2'] && checkMail($_POST['email']) && strlen($_POST['email'])<=40 && $_POST['email']==$_POST['email2'] && (checkAnum($_POST['sicherheitsa']) && strlen($_POST['sicherheitsa'])>=3 && strlen($_POST['sicherheitsa'])<=16) && checkInt($_POST['sicherheitsf']) && (checkAnum($_POST['loeschcode']) && strlen($_POST['loeschcode'])==7) && isset($_POST['agb']) && $_POST['sicherheitsa']==$_POST['sicherheitsa2']) {
// if((checkAnum($_POST['account']) && strlen($_POST['account'])>=4 && strlen($_POST['account'])<=16) && checkAnum($_POST['pass']) && strlen($_POST['pass'])>=6 && strlen($_POST['pass2'])<=16 && !empty($_POST['pass2']) && (checkName($_POST['uname']) && strlen($_POST['uname'])>=3 && strlen($_POST['uname'])<=20) && $_POST['pass']==$_POST['pass2'] && checkMail($_POST['email']) && strlen($_POST['email'])<=40 && $_POST['captcha']==$_SESSION['captcha_id'] && $_POST['email']==$_POST['email2'] && (checkAnum($_POST['sicherheitsa']) && strlen($_POST['sicherheitsa'])>=3 && strlen($_POST['sicherheitsa'])<=16) && checkInt($_POST['sicherheitsf']) && (checkAnum($_POST['loeschcode']) && strlen($_POST['loeschcode'])==7) && isset($_POST['agb']) && $_POST['sicherheitsa']==$_POST['sicherheitsa2']) {
$hashSF = md5($_POST['sicherheitsa']); //encriptacion de la respuesta de seguridad
$sfNum = mysql_real_escape_string($_POST['sicherheitsf']); //pregunta de seguridad
$lcode = mysql_real_escape_string($_POST['loeschcode']); //codigo de borrado
$zuFall = rand(99999,999999999);
$userpass=mysql_real_escape_string($_POST['pass']); //trae la contraseña
$aktivHash = ($serverSettings['mail_activation']) ? md5($zuFall):'';
$accountStatus = ($serverSettings['mail_activation']) ? 'BLOCK':'OK';
$sqlCmd = "INSERT INTO ".SQL_HP_DB.".account
(login,password,password_unhash,real_name,email,social_id,question1,answer1,create_time,status,coins,gold_expire,silver_expire,money_drop_rate_expire,autoloot_expire,safebox_expire,web_aktiviert)
VALUES
('".$_POST['account']."',PASSWORD('".$userpass."'),'".$userpass."','".mysql_real_escape_string($_POST['uname'])."','".mysql_real_escape_string($_POST['email'])."','".$lcode."','".$sfNum."','".$hashSF."','".$fecha."','".$accountStatus."','".$regCoins."','".$expireDate."','".$expireEXP."','".$expireDate."','".$expireDate."','".$expireDate."','".$aktivHash."')";
$sqlQry = mysql_query($sqlCmd,$sqlServ);
if($sqlQry) {
$absender = $serverSettings['titel']." Registro";
$email = $serverSettings['reg_mail'];
$empfaenger = $_POST['email'];
$mail_body = "Hola ".$_POST['uname'].",
su registro en ".$serverSettings['titel']." se ha realizado correctamente! Para poder jugar sólo debes activar tu cuenta.
Puedes hacerlo desde el siguiente enlace:
".$serverSettings['url']."/index.php?s=login&do=aktivieren&hash=".$aktivHash."
Tus Datos son:
Usuario: ".$_POST['account']."
Contraseña: ".$userpass."
Código de Borrado: ".$lcode."
Pregunta de Seguridad: ".$sFrage[$sfNum]."
Respuesta: ".$_POST['sicherheitsa']."
Bienvenido, diviértete jugando!
Atentamente,
".$serverSettings['titel']."-Staff
Este mensaje ha sido generado automáticamente. Por favor, no enviar respuestas a esta dirección.";
$titel = "Registro de ".$serverSettings['titel'];
$header = "X-Priority: 3\n";
$header .= "X-Mailer: ".$serverSettings['titel']." Homepage Mailer\n";
$header .= "MIME-Version: 1.0\n";
$header .= "From: ".$absender." <".$serverSettings['reg_mail'].">\n";
$header .= "Reply-To: ".$serverSettings['reg_mail']."\n";
$header .= "Content-Type: text/plain; charset=iso-8859-1\n";
if($serverSettings['mail_activation']) {
mail($empfaenger, $titel, $mail_body, $header);
$comprobante = 1;
echo '
<script language="JavaScript">
alert("Cuenta registrada con éxito, por favor revise su correo para confirmar el registro y poder ser parte de esta Gran Aventura");
</script>
';
echo'<div class="online"><center><font color="32bc08">Cuenta registrada con éxito, por favor revise su correo para confirmar el registro.</font></center></div><hr class="ranking_hr" />';
}
else {
echo'<div class="online"><center>Cuenta registrada con éxito, puedes iniciar sesión ahora.<br> Bienvenido, a , diviértete! .</center></div><hr class="ranking_hr" />';
}
}
else {
echo'<div class="offline"><center><font color="red">El Usuario ya existe!</font></center></div><hr class="ranking_hr" />';
}
}
else {
echo'<div class="offline"><center><font color="red">Por favor llene, todos los campos correctamente...</font></center></div><hr class="ranking_hr" />';
}
}
?>
<form id="regis tooltip" name="registro" action="./index.php?s=register" method="POST">
<table width="100%" style="font-size:12px;">
<tr>
<th width="150" class="topLine">Usuario:</th>
<td width="215" class="tdunkel">
<input type="text" required class="Input_ID_Text2" name="account" minlength="4" maxlength="16" size="16" title="4-16 Carácteres (Sólo Alfanuméricos) "/></td>
<td width="235" class="info"><i>* 4-16 Caracteres (Sólo Alfanuméricos)</i></th>
</tr>
<tr>
<th class="topLine">Contraseña:</th>
<td class="tdunkel"><input type="password" required class="Input_PW_Text2" name="pass" maxlength="16" size="16" autocomplete="off" title="6-16 Carácteres (Sólo Alfanuméricos)"/></td>
<td class="info"><i>* 6-16 Caracteres (Sólo Alfanuméricos)</i></th>
</tr>
<tr>
<th class="topLine">Confirmar Contraseña:</th>
<td class="thell"><input type="password" required class="Input_PW_Text2" name="pass2" maxlength="16" size="16" autocomplete="off" title="Repita su Contraseña"/></td>
<td class="info"><i>* Repita su Contraseña</i></th>
</tr>
<tr>
<th class="topLine">Correo Electrónico:</th>
<td class="tdunkel"><input type="email" required placeholder="user@domain.com" class="Input_ID_Text2" name="email" maxlength="50" size="20" title="Introduce una Dirección de Correo Electrónico válida."/></td>
<td class="info"><i>* Introduce una Dirección de Correo Válida.</i></th>
</tr>
<tr>
<th class="topLine">Confirmar Correo Electrónico:</th>
<td class="thell"><input type="email" required placeholder="user@domain.com" class="Input_ID_Text2" name="email2" maxlength="50" size="20" autocomplete="off" title="Repita su Dirección de Correo"/></td>
<td class="info"><i>* Repita su Dirección de Correo</i></th>
</tr>
<tr>
<th class="topLine">Nombre:</th>
<td class="thell"><input type="text" required class="Input_ID_Text2" name="uname" maxlength="16" size="16" title="3-20 Carácteres (Sólo Alfanuméricos)"/></td>
<td class="info"><i>* 3-20 Caracteres (Sólo Alfanuméricos)</i></th>
</tr>
<tr>
<th class="topLine">Código de Borrado:</th>
<td class="tdunkel">
<input type="txt" required class="Input_ID_Text2" onfocus="javascript: cambio ();" readonly name="loeschcode" maxlength="7" size="7" autocomplete="off" title="Código generado Aleatoriamente"/></td>
<td class="info"><input type="button" value="Generar Código De Borrado" onclick="javascript: cambio ();"/></th>
</tr>
<tr>
<th class="topLine">Pregunta de Seguridad:</th>
<td class="thell">
<select name="sicherheitsf" title="Seleccione una Pregunta">
<?PHP
foreach($sFrage AS $fragew => $frage) {
echo'<option value="'.$fragew.'">'.$frage.'</option>';
}
?>
</select>
</td>
</tr>
<tr>
<th>Respuesta:</th>
<td><input type="text" required name="sicherheitsa" class="Input_ID_Text2" maxlength="16" size="16" autocomplete="off" title="Da una respuesta a la Pregunta de Seguridad"/></td>
<td class="info"><i>* Da una respuesta a la Pregunta de Seguridad</i></th>
</tr>
<tr>
<th>Confirmar Respuesta:
</th>
<td>
<input type="text" required name="sicherheitsa2" class="Input_ID_Text2" maxlength="16" size="16" autocomplete="off" title="Repita su Respuesta"/>
</td>
<td class="info"><i>* Repita su Respuesta</i></th>
</tr>
<!--
<tr>
<th class="topLine">Captcha: <img src="./captcha/captcha.php" title="Captcha"/></th>
<td class="tdunkel"><input type="text" required name="captcha" class="Input_ID_Text2" maxlength="5" size="5" autocomplete="off" title="Schreiben sie die Zahlen ab"/></td>
<tr>
-->
<td class="topLine" style="text-align:center;" colspan="2"><input type="checkbox" name="agb" title="Aceptar">
He leido y acepto los <a href="javascript:popUp('?s=agb')">T&C </a>y la <a href="/index.php?s=agb">Declaración de protección de datos.</a>
</th>
</tr>
<tr>
<?php
require_once('./captcha/recaptchalib.php');
$publickey = "xxx"; // you got this from the signup page
echo recaptcha_get_html($publickey);
?>
<th class="topLine" style="text-align:center;" colspan="3"><input type="submit" name="submit" class="btn" value="Enviar"/></th>
</tr>
</table>
</form>
<?PHP
}
else {
echo'<p class="offline" style="margin-left:20px">El Registro está Deshabilitado o Usted ya tiene una cuenta. No se puede crear una cuenta nueva por ahora.</p>';
}
?>
<center><p><b><font color="8E0707">Si el Registro se realiza con éxito, para poder jugar deberás <br> activar la cuenta creada desde tu correo.</font></b></p></center>
</div>
<div class="main main_bottom">
</div>
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8" />
<title>Generar Números Aleatorios dentro de un Rango</title>
<script language="javascript"> <!--
function cambio () {
var min = 1000000;
var max = 9999999;
var res = Math.floor(Math.random() * (max - min + 1)) + min;
//document.getElementById('resultado').innerHTML = res.toString();
//document.registro.loeschcode.value = document.getElementById('resultado').innerHTML
document.registro.loeschcode.value = res.toString();
}
--> </script>
</head>
</html>
Última edición: