hey guys, i have a problem who i need help to fix..
register.php page:
this line is from core.php
my captcha is this:
each time someone try to register him see "captcha non valid" if is wrong or if is correct the same message..
Can anyone help me in fix this?
Thanks
register.php page:
PHP Code:
<?php
session_start();
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
//header('Content-type: application/vnd.wap.xhtml+xml');
echo "<?xml version="1.0"?>";
echo "<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">";
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
$uid = $_POST["uid"];
$pwd = $_POST["pwd"];
$cpw = $_POST["cpw"];
$email = $_POST["email"];
include("config.php");
include("core.php");
$bcon = connectdb();
if (!$bcon)
{
echo "<head>";
echo "<title>$sitename</title>";
echo "<link rel="stylesheet" type="text/css" href="{$path}css/style.css">";
echo "</head>";
echo "<body>";
echo "<div id="notif">";
echo "<b>Error</b></div>";
echo "<br/>Error, retry .<br/><br/><br/>";
echo "<div align="center">";
echo "<a href="index.php">Home</a>";
echo "</div>";
echo "<br/>";
echo "</body>";
echo "</html>";
exit();
}
if( !get_magic_quotes_gpc() )
{
if( is_array($_GET) )
{
while( list($k, $v) = each($_GET) )
{
if( is_array($_GET[$k]) )
{
while( list($k2, $v2) = each($_GET[$k]) )
{
$_GET[$k][$k2] = addslashes($v2);
}
@reset($_GET[$k]);
}
else
{
$_GET[$k] = addslashes($v);
}
}
@reset($_GET);
}
if( is_array($_POST) )
{
while( list($k, $v) = each($_POST) )
{
if( is_array($_POST[$k]) )
{
while( list($k2, $v2) = each($_POST[$k]) )
{
$_POST[$k][$k2] = addslashes($v2);
}
@reset($_POST[$k]);
}
else
{
$_POST[$k] = addslashes($v);
}
}
@reset($_POST);
}
}
$sitename = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='sitename'"));
$sitename = $sitename[0];
$brws = explode(" / ",$HTTP_USER_AGENT);
//$brws = explode(" ",$HTTP_USER_AGENT);
$ubr = $brws[0];
$subno = explode("/",$HTTP_X_UP_SUBNO);
$sub = $subno[0];
$ip = explode("/",$REMOTE_ADDR);
$ips = $ip[0];
$template = mysql_fetch_array(mysql_query("SELECT template FROM ibwf_users WHERE id='".$uid."'"));
if($template[0]=="")
{
$template[0] = "default.css";
}
echo "<head>";
echo "<title>$sitename</title>";
echo "<link rel="stylesheet" type="text/css" href="{$path}css/style.css">";
echo "</head>";
echo "<body>";
$ipr = getip();
$uip = explode(".",$ipr);
if((!canreg())||(isipbanned($ipr,$ubr)))
{
echo "<div align="center">";
echo "<u>Registration Closed.</u><br/><br/>\n";
echo "</div>";
}else{
// anti-flood registrazione
$actime = mysql_fetch_array(mysql_query("SELECT regdate FROM ibwf_users WHERE browserm='".$ubr."' ORDER BY regdate DESC LIMIT 1"));
$timeout = $actime[0] + (20);
if(time()<$timeout)
{
$tm = time();
$ramas = $timeout - $tm;
echo "<div align="center">";
echo "Antiflood Control ON.<br/>\n";
echo "</div>";
}else{
// anti-flood browser
$brwsu = explode("$_SERVER",$HTTP_USER_AGENT);
$ubr = $brwsu[0];
$actime = mysql_fetch_array(mysql_query("SELECT regdate FROM ibwf_users WHERE browserm='".$ubr."' ORDER BY regdate DESC LIMIT 1"));
$timeout = $actime[0] + (20*20);
if(time()<$timeout)
{
$tm = time();
$ramas = $timeout - $tm;
echo "<div align="center">";
echo "Antiflood Control ON.<br/>";
echo "</div>";
}else{
// anti-flood ip
$uip = getip();
$actime = mysql_fetch_array(mysql_query("SELECT regdate FROM ibwf_users WHERE ipadd='".$uip."' ORDER BY regdate DESC LIMIT 1"));
$timeout = $actime[0] + (20*20);
if(time()<$timeout)
{
$tm = time();
$ramas = $timeout - $tm;
echo "<div align="center">";
echo "Antiflood Control ON.<br/>";
echo "</div>";
}else{
echo "<div align="center">";
echo "<u>Registration Free Account:</u><br/><br/>\n";
echo "</div>";
?>
<center>
<img src="../images/point.gif" alt="!"/>
Text1<br/>
<img src="../images/point.gif" alt="!"/>
Text2<br/>
<img src="../images/point.gif" alt="!"/>
Text3<br/>
<img src="../images/point.gif" alt="!"/>
Text4<br/>
<img src="../images/point.gif" alt="!"/>
Text5<br/>
<img src="../images/point.gif" alt="!"/>
Text6<br/><br/>
</center>
</p>
<?php
$cfg = mysql_fetch_assoc(mysql_query("SELECT value FROM ibwf_settings WHERE name = 'cfg'"));
$cfg = $cfg['value'];
$tolog = false;
if(trim($uid)=="")
{
echo registerform(1);
}
elseif(spacesin($uid)||scharin($uid))
{
echo registerform(4);
}
else if(strlen($uid)<4)
{
echo registerform(7);
}
else if(isdigitf($uid))
{
echo registerform(11);
}else if(checknick($uid)==1)
{
echo registerform(12);
}else if(checknick($uid)==2)
{
echo registerform(13);
}
elseif($captcha != $_SESSION['vercode'])
{
echo registerform(15);
}
elseif($cfg[1] == '0')
{
if(trim($pwd)=="")
{
echo registerform(2);
}
else if(trim($cpw)=="")
{
echo registerform(3);
}
else if(spacesin($pwd)||scharin($pwd))
{
echo registerform(5);
}
else if($pwd!=$cpw)
{
echo registerform(6);
}
else if(strlen($pwd)<4)
{
echo registerform(8);
}
elseif(register($uid,$pwd,$usx,$ubr)==1)
{
echo registerform(9);
}
elseif(register($uid,$pwd,$usx,$ubr)==2)
{
echo registerform(10);
}
else
{
echo "<div align="center">";
echo "<u>Registration Done!</u><br/>\n";
echo "<br/>Your Details:<br/><br/><b>Nickname: </b>$uid<br/>";
echo "<b>Password: </b>$pwd<br/><br/>";
echo "</div>";
if(validation())
{
echo "Your Account Need a Validation.<br/> !";
}
$tolog = true;
}
}
elseif($cfg[1] == '1')
{
$pwd = "";
for($i = 0; $i < 6; $i++)
{
if(rand(0, 200) > 100)
$pwd .= chr(rand(65, 90));
else
$pwd .= rand(0, 9);
}
$q = mysql_query("SELECT COUNT(*) AS c FROM ibwf_users WHERE email = '{$email}' LIMIT 1");
$r = mysql_fetch_assoc($q);
if(trim($email) == '')
{
echo registerform(14);
}
elseif($r['c'] > 0)
{
echo registerform(16);
}
elseif(register($uid,$pwd,$usx,$ubr)==1)
{
echo registerform(9);
}
elseif(register($uid,$pwd,$usx,$ubr)==2)
{
echo registerform(10);
}
else
{
echo "<div align="center">";
echo "<u>Registration Done!</u><br/>\n";
echo "<br/>You will receive your details to your email.<br/><br/>";
echo "</div>";
if(validation())
{
echo "Account Need a validation!";
}
$tolog = true;
}
}
}
}
}
echo "</p>";
}
echo "<p>";
if($tolog)
{
$msg = "\n Nickname: ".$uid." \n Password: ".$pwd." \n\n ".$sitename." Thanks to join in out community\n".$sitename."";
$subj = "Login Details of ".$sitename."";
$headers = 'From: no-reply@email.com' . "\r\n" .
'Reply-To: no-reply@email.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
mail($email, $subj, $msg, $headers);
echo "<a href="{$path}login.php?loguid=$uid&logpwd=$pwd"><img src="{$path}images/home.gif" alt=""/>Login</a>";
}else{
echo "<br/><br/>";
echo "<a href="index.php">Home</a>";
echo "<br/>";
}
echo "</body>";
?>
</html>
<?
@mysql_close($bcon);
?>
this line is from core.php
PHP Code:
function registerform($ef)
{
global $path;
$ue = $errl = $pe = $ce = $te = $em = '';
switch($ef)
{
case 1:
$errl = "<img src="{$path}images/point.gif" alt="!"/> Complete all fields";
$ue = "<img src="{$path}images/point.gif" alt="!"/>";
break;
case 2:
$errl = "<img src="{$path}images/point.gif" alt="!"/> Your password";
$pe = "<img src="{$path}images/point.gif" alt="!"/>";
break;
case 3:
$errl = "<img src="{$path}images/point.gif" alt="!"/> Confirm your password";
$ce = "<img src="{$path}images/point.gif" alt="!"/>";
break;
case 4:
$errl = "<img src="{$path}images/point.gif" alt="!"/> Nick not valid";
$ue = "<img src="{$path}images/point.gif" alt="!"/>";
break;
case 5:
$errl = "<img src="{$path}images/point.gif" alt="!"/> Password not valid";
$pe = "<img src="{$path}images/point.gif" alt="!"/>";
break;
case 6:
$errl = "<img src="{$path}images/point.gif" alt="!"/> Password not valid";
$ce = "<img src="{$path}images/point.gif" alt="!"/>";
break;
case 7:
$errl = "<img src="{$path}images/point.gif" alt="!"/> Nickname min 4 char";
$ue = "<img src="{$path}images/point.gif" alt="!"/>";
break;
case 8:
$errl = "<img src="{$path}images/point.gif" alt="!"/> Password min 4 char";
$pe = "<img src="{$path}images/point.gif" alt="!"/>";
break;
case 9:
$errl = "<img src="{$path}images/point.gif" alt="!"/> Nickname already take";
$ue = "<img src="{$path}images/point.gif" alt="!"/>";
break;
case 10:
$errl = "<img src="{$path}images/point.gif" alt="!"/> Error database.";
break;
case 11:
$errl = "<img src="{$path}images/point.gif" alt="!"/> Nickname need start with letter";
$ue = "<img src="{$path}images/point.gif" alt="!"/>";
break;
case 12:
$errl = "<img src="{$path}images/point.gif" alt="!"/> Nickname reserved";
$ue = "<img src="{$path}images/point.gif" alt="!"/>";
break;
case 13:
$errl = "<img src="{$path}images/point.gif" alt="!"/> Choose another Nickname";
$ue = "<img src="{$path}images/point.gif" alt="!"/>";
break;
case 14:
$errl = "<img src="{$path}images/point.gif" alt="!"/> You need provide email adress";
$em = "<img src="{$path}images/point.gif" alt="!"/>";
break;
case 15:
$errl = "<img src="{$path}images/point.gif" alt="!"/> Captcha non valid";
$te = "<img src="{$path}images/point.gif" alt="!"/>";
break;
case 16:
$errl = "<img src="{$path}images/point.gif" alt="!"/> Email already used";
$em = "<img src="{$path}images/point.gif" alt="!"/>";
break;
}
$cfg = mysql_fetch_assoc(mysql_query("SELECT value FROM ibwf_settings WHERE name = 'cfg'"));
$cfg = $cfg['value'];
$rform = "<form action="{$path}register.php" method="post">";
$rform .= "<br/>$ue Nickname: <input name="uid" style="-wap-input-format: '*x'" maxlength="12"/><br/><br/>";
if($cfg['1'] == '0')
{
$rform .= "$pe Password: <input type="password" name="pwd" maxlength="10"/><br/><br/>";
$rform .= "$ce Retype Password: <input type="password" name="cpw" maxlength="10"/><br/><br/>";
}
$rform .= "Gender:";
$rform .= "<select name="usx">";
$rform .= "<option value="M">Male</option>";
$rform .= "<option value="F">Female</option>";
$rform .= "</select><br/><br/>";
$rform .= "Birthday:";
$rform .= "<select name='nascita'>";
for($i = date('Y')-10; $i >= 1960; $i--)
$rform .= "<option value='{$i}'>{$i}</option>";
$rform .= "</select><br /><br />";
if($cfg[1] == '1')
{
$rform .= $em . " E-mail: <input type='text' name='email' /><br /><br />";
}
if($cfg[0] == '1')
{
$rform .= "Captcha: <img src='captcha.php?" . time() . "' alt='Captcha' align='absmiddle' /><br />";
$rform .= "{$te} Confirm: <input type='text' name='captcha' maxlength='5' style="-wap-input-format: '*N'" />";
$rform .= "<br/><br/>";
}
$rform .= "<input type="Submit" name="invio" Value="invio"></form>";
$rform .= "<br/><br/>$errl";
return $rform;
}
PHP Code:
<?
session_start();
header('content-type: image/jpeg');
$text = rand(10000,99999);
$_SESSION["vercode"] = $text;
$height = 25;
$width = 65;
$image_p = imagecreate($width, $height);
$black = imagecolorallocate($image_p, 0, 0, 0);
$white = imagecolorallocate($image_p, 255, 255, 255);
$font_size = 14;
imagestring($image_p, $font_size, 5, 5, $text, $white);
imagejpeg($image_p, null, 80);
imagedestroy($image_p);
?>
each time someone try to register him see "captcha non valid" if is wrong or if is correct the same message..
Can anyone help me in fix this?
Thanks
Comment