mire hace poco funcionaa bien el portal .pero ahora.
me surge un problema el sistema de login. tiene recapcha.
pero el cuadro no se muestra nose porque y no me deja entrar con el nombre de usuario y contraseña. puse la claves key todo bien pero nada nose muestra e intentado sacar el recapcha pero nose como
nose si me podran ayudar aki les dejo el scrip..
Cita:
espero su respuesta <?
require "header.php";
require_once('inc/recaptchalib.php');
// Get a key from http://recaptcha.net/api/getkey
$publickey = "puselosmios";
$privatekey = "puselosmios";
# the response from reCAPTCHA
$resp = null;
# the error code from reCAPTCHA, if any
$error = null;
# was there a reCAPTCHA response?
if ($_POST["recaptcha_response_field"]) {
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if ($resp->is_valid) {
if (isset($_POST['uname']))
{
$msg="";
if($_POST['uname']==""){
$msg.="<br />User Name cannot be left empty!<br />";}
if($_POST['pass']==""){
$msg.="<br />Password cannot be left empty!<br />";}
else {
$po_uname=check_input($_POST['uname']);
$po_pass=md5($_POST['pass']);
$query =sprintf("select * from users where username='$po_uname' and password='$po_pass'");
$result = mysql_query($query);
// print_r($query);
if(mysql_num_rows($result) ==0) {
$msg.="Wrong login details entered!";
@mysql_close();
}
else {
while ($row = mysql_fetch_assoc($result)) {
$auth_id=$row['userid'];
$auth_gid=$row['usergid'];
$auth_name=$row['username'];
$auth_pass=$row['password'];
$auth_status=$row['status'];
}
if($auth_status == '0') {
$msg.="This account is not active, Please activate the account first!";
@mysql_close();
}
if($auth_status == '2') {
$msg.="This account is suspended by site admin!";
@mysql_close();
}
if($auth_status == '1') {
session_start();
$_SESSION['userid']=$auth_id;
$_SESSION['usergid']=$auth_gid;
$_SESSION['username']=$auth_name;
$_SESSION['password']=$auth_pass;
$_SESSION['status']=$auth_status;
@mysql_close();
if(isset($_POST['remember'])){
setcookie("cookname", $auth_name, time()+60*60*24*30, "/");
setcookie("cookpass", $auth_pass, time()+60*60*24*30, "/");
}
header("Location: myimages.php");
exit;
}
}
}
} // if post
} // if captcha ok
else {
$msg.="<br />Verify the text in the red box!<br />";
# set the error code so that we can display it
$error = $resp->error;
}
} // if captcha post
?>
<center>
<?if($msg){?>
<div id="error"><span class="error"><?=$msg?></span></div>
<?}?>
<form name="config" action="<?= $_SERVER['PHP_SELF'] ?>" method="post" style="margin-top: 0px; margin-bottom: 0px;" onSubmit="return validate();">
Nombre de Usuario:<br />
<input type="text" name="uname" id="uname" value="<?=$po_uname?>" maxlength="20"><br />
Password:<br />
<input type="password" name="pass" value="<?=$po_pass?>" maxlength="32"><br />
<br />
<input type="checkbox" name="remember">
<font size="2">Recordarme<br />
<br />
<?
echo recaptcha_get_html($publickey, $error);
?><br /><br />
<input type="submit" value="Login" type="submit">
<br /><br />
<a href="forgotpass.php">Has olvidado tu Contraseña?</a>
<br /><br /><br /><br />
</center>
</form>
<? require "footer.php"; ?>
require "header.php";
require_once('inc/recaptchalib.php');
// Get a key from http://recaptcha.net/api/getkey
$publickey = "puselosmios";
$privatekey = "puselosmios";
# the response from reCAPTCHA
$resp = null;
# the error code from reCAPTCHA, if any
$error = null;
# was there a reCAPTCHA response?
if ($_POST["recaptcha_response_field"]) {
$resp = recaptcha_check_answer ($privatekey,
$_SERVER["REMOTE_ADDR"],
$_POST["recaptcha_challenge_field"],
$_POST["recaptcha_response_field"]);
if ($resp->is_valid) {
if (isset($_POST['uname']))
{
$msg="";
if($_POST['uname']==""){
$msg.="<br />User Name cannot be left empty!<br />";}
if($_POST['pass']==""){
$msg.="<br />Password cannot be left empty!<br />";}
else {
$po_uname=check_input($_POST['uname']);
$po_pass=md5($_POST['pass']);
$query =sprintf("select * from users where username='$po_uname' and password='$po_pass'");
$result = mysql_query($query);
// print_r($query);
if(mysql_num_rows($result) ==0) {
$msg.="Wrong login details entered!";
@mysql_close();
}
else {
while ($row = mysql_fetch_assoc($result)) {
$auth_id=$row['userid'];
$auth_gid=$row['usergid'];
$auth_name=$row['username'];
$auth_pass=$row['password'];
$auth_status=$row['status'];
}
if($auth_status == '0') {
$msg.="This account is not active, Please activate the account first!";
@mysql_close();
}
if($auth_status == '2') {
$msg.="This account is suspended by site admin!";
@mysql_close();
}
if($auth_status == '1') {
session_start();
$_SESSION['userid']=$auth_id;
$_SESSION['usergid']=$auth_gid;
$_SESSION['username']=$auth_name;
$_SESSION['password']=$auth_pass;
$_SESSION['status']=$auth_status;
@mysql_close();
if(isset($_POST['remember'])){
setcookie("cookname", $auth_name, time()+60*60*24*30, "/");
setcookie("cookpass", $auth_pass, time()+60*60*24*30, "/");
}
header("Location: myimages.php");
exit;
}
}
}
} // if post
} // if captcha ok
else {
$msg.="<br />Verify the text in the red box!<br />";
# set the error code so that we can display it
$error = $resp->error;
}
} // if captcha post
?>
<center>
<?if($msg){?>
<div id="error"><span class="error"><?=$msg?></span></div>
<?}?>
<form name="config" action="<?= $_SERVER['PHP_SELF'] ?>" method="post" style="margin-top: 0px; margin-bottom: 0px;" onSubmit="return validate();">
Nombre de Usuario:<br />
<input type="text" name="uname" id="uname" value="<?=$po_uname?>" maxlength="20"><br />
Password:<br />
<input type="password" name="pass" value="<?=$po_pass?>" maxlength="32"><br />
<br />
<input type="checkbox" name="remember">
<font size="2">Recordarme<br />
<br />
<?
echo recaptcha_get_html($publickey, $error);
?><br /><br />
<input type="submit" value="Login" type="submit">
<br /><br />
<a href="forgotpass.php">Has olvidado tu Contraseña?</a>
<br /><br /><br /><br />
</center>
</form>
<? require "footer.php"; ?>
saludos