Jump to content
MakeWebGames

Captca code mccodeV2


TipZ
 Share

Recommended Posts

when i installed the game and went in to staff panel and set captcha code on registre and crime+gym

then i go in and se it ther is just a black picture with lines and stuff on but no numbers or letters

have anyone have the same problem ??

Link to comment
Share on other sites

  • 2 weeks later...

Re: Captca code mccodeV2

Only problem i've had with the captcha test is that when registering, even if you put in the corrent letters/numbers the test will always fail, so i just turned it off. The captcha on the crimes and gym is very annoying anyway.

Link to comment
Share on other sites

Re: Captca code mccodeV2

macro 1

<?php
include "globals.php";
if(!$set['validate_on'] || $ir['verified'])
{
die("WTF are you doing on this page? Go home losr.");
}
$ref=$_GET['refer'];
unset($_SESSION['captcha']);
$chars="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!?\\/%^";
 $len=strlen($chars);
 $_SESSION['captcha']="";
 for($i=0;$i<6;$i++)
 $_SESSION['captcha'].=$chars[rand(0, $len - 1)];
print "<h3>Validation</h3><hr />
Enter the text you see in the image into the box below.<form action='macro2.php' method='post'>";
if($_GET['code'])
{
print "<font color='red'>[b]Invalid code or blank[/b]</font>
";
}
print "
[img=captcha_verify.php]

Text: <input type='text' name='captcha' />

<input type='hidden' name='refer' value='{$_GET['refer']}' />
<input type='submit' value='Verify' /></form>";
$h->endpage();
?>

 

and the captcha verify

 

<?php
function parse_bgcolor()
{
 if(strlen($_GET['bgcolor']) == 6)
 {
 $p1=$_GET['bgcolor'][0].$_GET['bgcolor'][1];
 $p2=$_GET['bgcolor'][2].$_GET['bgcolor'][3];
 $p3=$_GET['bgcolor'][4].$_GET['bgcolor'][5];
 }
 else
 {
 $p1=$_GET['bgcolor'][0].$_GET['bgcolor'][0];
 $p2=$_GET['bgcolor'][1].$_GET['bgcolor'][1];
 $p3=$_GET['bgcolor'][2].$_GET['bgcolor'][2];
 }
 return array(hexdec($p1),hexdec($p2),hexdec($p3));
}
session_start();
$bgcolor=($_GET['bgcolor']) ? parse_bgcolor() : array(255,255,255);
$text=array(255-$bgcolor[0],255-$bgcolor[1],255-$bgcolor[2]);
$distort=rand(80,120)/100;
$distort2=rand(80,120)/100;
$f_x=round(75*$distort);
$f_y=round(25*$distort);
$s_x=round(175*$distort2);
$s_y=round(70*$distort2);
$first=imagecreatetruecolor($f_x, $f_y);
$second=imagecreatetruecolor($s_x, $s_y);
$white=imagecolorallocate($first, $bgcolor[0], $bgcolor[1], $bgcolor[2]);
$black=imagecolorallocate($first, 0, 0, 0);
$red=imagecolorallocate($first, 255, 0, 0);
$green=imagecolorallocate($first, 0, 128, 0);
$blue=imagecolorallocate($first, 0, 0, 255);
imagefill($first, 0, 0, $white);
$color[0]=$red;
$color[1]=$green;
$color[2]=$blue;
for($i=0; $i<=2; $i++)
{
 $points = array(
 0 => array(10, $f_x - 10),
 1 => array(5, $f_y - 5),
 2 => array(10, $f_x - 10),
 3 => array(5, $f_y - 5),
 4 => array(10, $f_x - 10),
 5 => array(5, $f_y - 5),
 6 => array(10, $f_x - 10),
 7 => array(5, $f_y - 5),
 8 => array(10, $f_x - 10),
 9 => array(5, $f_y - 5),
 );
 imagefilledpolygon($first, $points, 5, $red);
}
imagestring($first, 4, rand(0, $f_x/3), rand(0,$f_y/2.5), $_SESSION['captcha'], $black);
imagecopyresized($second, $first, 0, 0, 0, 0, $s_x, $s_y, $f_x, $f_y);
imagedestroy($first);
$red=imagecolorallocate($second, 255, 0, 0);
$green=imagecolorallocate($second, 0, 128, 0);
$blue=imagecolorallocate($second, 0, 0, 255);
$RandomPixels=ceil($s_x*$s_y/100);
for($i=0;$i<$RandomPixels;$i++)
{
 $locx=rand(0,$s_x-1);
 $locy=rand(0,$s_y-1);
 imagesetpixel($second, $locx, $locy, $red);
}
for($i=0;$i<$RandomPixels;$i++)
{
 $locx=rand(0,$s_x-1);
 $locy=rand(0,$s_y-1);
 imagesetpixel($second, $locx, $locy, $green);
}
for($i=0;$i<$RandomPixels;$i++)
{
 $locx=rand(0,$s_x-1);
 $locy=rand(0,$s_y-1);
 imagesetpixel($second, $locx, $locy, $blue);
}
$randcolor=imagecolorallocate($second, rand(100,255), rand(100,255), rand(100,255));
for($i=0; $i<5; $i++)
{
 imageline($second, rand(0, $s_x), rand(0, $s_y), rand(0, $s_x), rand(0, $s_y), $randcolor);
 $randcolor=imagecolorallocate($second, rand(100,255), rand(100,255), rand(100,255));
}
@header("Content-Type: image/png");
$finished=imagerotate($second, rand(0,15)-7.5, $bgcolor[2]*65536+$bgcolor[1]*256+$bgcolor[0]);
imagedestroy($second);
imagepng($finished);
imagedestroy($finished);
?>[/scode]
Link to comment
Share on other sites

Re: Captca code mccodeV2

 

<?php
include "config.php";
global $_CONFIG;
define("MONO_ON", 1);
require "class/class_db_{$_CONFIG['driver']}.php";
$db=new database;
$db->configure($_CONFIG['hostname'],
$_CONFIG['username'],
$_CONFIG['password'],
$_CONFIG['database'],
$_CONFIG['persistent']);
$db->connect();
$c=$db->connection_id;
$set=array();
$settq=$db->query("SELECT * FROM settings");
while($r=$db->fetch_row($settq))
{
$set[$r['conf_name']]=$r['conf_value'];
}
//thx to [url]http://www.phpit.net/code/valid-email/[/url] for valid_email
function valid_email($email) {
 // First, we check that there's one @ symbol, and that the lengths are right
 if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) {
   // Email invalid because wrong number of characters in one section, or wrong number of @ symbols.
   return false;
 }
 // Split it into sections to make life easier
 $email_array = explode("@", $email);
 $local_array = explode(".", $email_array[0]);
 for ($i = 0; $i < sizeof($local_array); $i++) {
    if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) {
     return false;
   }
 }  
 if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name
   $domain_array = explode(".", $email_array[1]);
   if (sizeof($domain_array) < 2) {
       return false; // Not enough parts to domain
   }
   for ($i = 0; $i < sizeof($domain_array); $i++) {
     if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) {
       return false;
     }
   }
 }
 return true;
}
print <<<EOF
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{$set['game_name']}</title>
<script type="text/javascript">
var xmlHttp // xmlHttp variable

function GetXmlHttpObject(){ // This function we will use to call our xmlhttpobject.
var objXMLHttp=null // Sets objXMLHttp to null as default.
if (window.XMLHttpRequest){ // If we are using Netscape or any other browser than IE lets use xmlhttp.
objXMLHttp=new XMLHttpRequest() // Creates a xmlhttp request.
}else if (window.ActiveXObject){ // ElseIf we are using IE lets use Active X.
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP") // Creates a new Active X Object.
} // End ElseIf.
return objXMLHttp // Returns the xhttp object.
} // Close Function

function CheckPasswords(password){ // This is our fucntion that will check to see how strong the users password is.
xmlHttp=GetXmlHttpObject() // Creates a new Xmlhttp object.
if (xmlHttp==null){ // If it cannot create a new Xmlhttp object.
alert ("Browser does not support HTTP Request") // Alert Them!
return // Returns.
} // End If.

var url="check.php?password="+escape(password) // Url that we will use to check the password.
xmlHttp.open("GET",url,true) // Opens the URL using GET
xmlHttp.onreadystatechange = function () { // This is the most important piece of the puzzle, if onreadystatechange = equal to 4 than that means the request is done.
if (xmlHttp.readyState == 4) { // If the onreadystatechange is equal to 4 lets show the response text.
document.getElementById("passwordresult").innerHTML = xmlHttp.responseText; // Updates the div with the response text from check.php
} // End If.
}; // Close Function
xmlHttp.send(null); // Sends NULL insted of sending data.
} // Close Function.

function CheckUsername(password){ // This is our fucntion that will check to see how strong the users password is.
xmlHttp=GetXmlHttpObject() // Creates a new Xmlhttp object.
if (xmlHttp==null){ // If it cannot create a new Xmlhttp object.
alert ("Browser does not support HTTP Request") // Alert Them!
return // Returns.
} // End If.

var url="checkun.php?password="+escape(password) // Url that we will use to check the password.
xmlHttp.open("GET",url,true) // Opens the URL using GET
xmlHttp.onreadystatechange = function () { // This is the most important piece of the puzzle, if onreadystatechange = equal to 4 than that means the request is done.
if (xmlHttp.readyState == 4) { // If the onreadystatechange is equal to 4 lets show the response text.
document.getElementById("usernameresult").innerHTML = xmlHttp.responseText; // Updates the div with the response text from check.php
} // End If.
}; // Close Function
xmlHttp.send(null); // Sends NULL insted of sending data.
} // Close Function.

function CheckEmail(password){ // This is our fucntion that will check to see how strong the users password is.
xmlHttp=GetXmlHttpObject() // Creates a new Xmlhttp object.
if (xmlHttp==null){ // If it cannot create a new Xmlhttp object.
alert ("Browser does not support HTTP Request") // Alert Them!
return // Returns.
} // End If.

var url="checkem.php?password="+escape(password) // Url that we will use to check the password.
xmlHttp.open("GET",url,true) // Opens the URL using GET
xmlHttp.onreadystatechange = function () { // This is the most important piece of the puzzle, if onreadystatechange = equal to 4 than that means the request is done.
if (xmlHttp.readyState == 4) { // If the onreadystatechange is equal to 4 lets show the response text.
document.getElementById("emailresult").innerHTML = xmlHttp.responseText; // Updates the div with the response text from check.php
} // End If.
}; // Close Function
xmlHttp.send(null); // Sends NULL insted of sending data.
} // Close Function.

function PasswordMatch()
{
pwt1=document.getElementById('pw1').value;
pwt2=document.getElementById('pw2').value;
if(pwt1 == pwt2)
{
document.getElementById('cpasswordresult').innerHTML="<font color='green'>OK</font>";
}
else
{
document.getElementById('cpasswordresult').innerHTML="<font color='red'>Not Matching</font>";
}
}
</script>
<style type="text/css">
<!--
body {
background-color: #000000;
margin-top: 0px;
margin-bottom: 0px;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:12px;
}

.lgrad {
background-image:url(lgrad.jpg);
background-repeat:repeat-y;
width:19px;
}
.linegrad {
background-image:url(linegrad.PNG);
background-repeat:repeat-y;
background-align: center;
width:2px;
}
.rgrad {
background-image:url(rgrad.jpg);
background-repeat:repeat-y;
width:19px;
}
.dgrad {
background-image:url(dgrad.jpg);
background-repeat:repeat-x;
height:38px;
}
.dgradl {
background-image:url(dgradl.jpg);
background-repeat:no-repeat;
height:38px;
width:38px;
}
.dgradr {
background-image:url(dgradr.jpg);
background-repeat:no-repeat;
height:38px;
width:38px;
}
.center {
width:932px;
background-color:#360b05;
vertical-align:top;
text-align:center;
}
.table {
background-color:#360b05;
}
.table3 {
background-color:#360b05;
}
.table td {
background-color:#360b05;
height:22px;
}
.table3 td {
background-color:#360b05;
}
td .alt {
background-color:#360b05;
height:22px;
}
td .h {
background-image:url(tablehgrad.png);
background-repeat:repeat-x;
font-weight: bold;
}
.table th {
background-image:url(tablehgrad.png);
background-repeat:repeat-x;
font-weight: bold;
}
-->
</style></head>
<body>
<center>
<table width="400" border="0" cellpadding="0" cellspacing="0" class="table2">
<tr>
<td class="lgrad"></td>
<td class="center">


EOF;
$IP = ($_SERVER['HTTP_X_FORWARDED_FOR'])
   ?  $_SERVER['HTTP_X_FORWARDED_FOR']
   :  $_SERVER['REMOTE_ADDR'];
if(file_exists('ipbans/'.$IP))
{
die("[b]<font color=red size=+1>Your IP has been banned, there is no way around this.</font>[/b]</body></html>");
}
if($_POST['username'])
{
if($set['regcap_on'])
{
 if(!$_SESSION['captcha'] or $_SESSION['captcha'] != $_POST['captcha'])
 {
   unset($_SESSION['captcha']);
   die("Captcha Test Failed

>[url='register.php']Back[/url]");
 }
 unset($_SESSION['captcha']);
}
if(!valid_email($_POST['email']))
{
die("Sorry, the email is invalid.

>[url='register.php']Back[/url]");
}
if(strlen($_POST['username']) < 4)
{
die("Sorry, the username is too short.

>[url='register.php']Back[/url]");
}
$sm=100;
if($_POST['promo'] == "Your Promo Code Here")
{
$sm+=100;
}
$username=$_POST['username'];
$username=str_replace(array("<", ">"), array("<", ">"), $username);
$q=$db->query("SELECT * FROM users WHERE username='{$username}' OR login_name='{$username}'");
$q2=$db->query("SELECT * FROM users WHERE email='{$_POST['email']}'");
if($db->num_rows($q))
{
print "Username already in use. Choose another.

>[url='register.php']Back[/url]";
}
else if($db->num_rows($q2))
{
print "E-Mail already in use. Choose another.

>[url='register.php']Back[/url]";
}
else if($_POST['password'] != $_POST['cpassword'])
{
print "The passwords did not match, go back and try again.

>[url='register.php']Back[/url]";
}
else
{
$_POST['ref'] = abs((int) $_POST['ref']);
$IP = ($_SERVER['HTTP_X_FORWARDED_FOR'])
   ?  $_SERVER['HTTP_X_FORWARDED_FOR']
   :  $_SERVER['REMOTE_ADDR'];
$q=$db->query("SELECT * FROM users WHERE lastip='$IP' AND userid={$_POST['ref']}");
if($db->num_rows($q))
{
die("No creating referral multies. Bad dog.

>[url='register.php']Back[/url]");
}
if($_POST['ref']) {
$q=$db->query("SELECT * FROM users WHERE userid={$_POST['ref']}");
$r=$db->fetch_row($q);
}
$db->query("INSERT INTO users (username, login_name, userpass, level, money, crystals, donatordays, user_level, energy, maxenergy, will, maxwill, brave, maxbrave, hp, maxhp, location, gender, signedup, email, bankmoney, lastip, lastip_signup) VALUES( '{$username}', '{$username}', md5('{$_POST['password']}'), 1, $sm, 0, 0, 1, 12, 12, 100, 100, 5, 5, 100, 100, 1, '{$_POST['gender']}', unix_timestamp(), '{$_POST['email']}', -1, '$IP', '$IP')");
$i=$db->insert_id();
$db->query("INSERT INTO userstats VALUES($i, 10, 10, 10, 10, 10)");

if($_POST['ref']) {
require "global_func.php";
$db->query("UPDATE users SET crystals=crystals+2 WHERE userid={$_POST['ref']}");
event_add($_POST['ref'],"For refering $username to the game, you have earnt 2 valuable crystals!",$c);
$db->query("INSERT INTO referals VALUES('', {$_POST['ref']}, $i, unix_timestamp(),'{$r['lastip']}','$IP')");
}
print "You have signed up, enjoy the game.

> [url='login.php']Login[/url]";
}
}
else
{
if($set['regcap_on'])
{  $chars="123456789abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!?\\/%^";
 $len=strlen($chars);
 $_SESSION['captcha']="";
 for($i=0;$i<6;$i++)
 $_SESSION['captcha'].=$chars[rand(0, $len - 1)];
}

print "<h3>{$set['game_name']} Registration</h3>";
print "<form action=register.php method=post>
<table width='75%' class='table' cellspacing='1'>
<tr>
<td width='30%'>Username</td>
<td width='40%'><input type=text name=username onkeyup='CheckUsername(this.value);'></td>
<td width='30%'><div id='usernameresult'></div></td>
</tr>
<tr>
<td>Password</td>
<td><input type=password id='pw1' name=password onkeyup='CheckPasswords(this.value);PasswordMatch();'></td>
<td><div id='passwordresult'></div></td>
</tr>
<tr>
<td>Confirm Password</td><td><input type=password name=cpassword id='pw2' onkeyup='PasswordMatch();'></td>
<td><div id='cpasswordresult'></div></td>
</tr>
<tr>
<td>Email</td><td><input type=text name=email onkeyup='CheckEmail(this.value);'></td>
<td><div id='emailresult'></div></td>
</tr>
<tr>
<td>Gender</td>
<td colspan='2'><select name='gender' type='dropdown'>
<option value='Male'>Male
<option value='Female'>Female</select></td>
</tr>
<tr>
<td>Promo Code</td><td colspan=2><input type=text name=promo></td>
</tr>

<input type=hidden name=ref value='";
if($_GET['REF']) { print $_GET['REF']; }
print "' />";
if($set['regcap_on'])
{
print "<tr>
<td colspan=3>[img=captcha_verify.php]

<input type='text' name='captcha' /></td>
</tr>";
}
print "
<tr>
<td colspan=3 align=center><input type=submit value=Submit></td>
</tr>
</table>
</form>

> [url='login.php']Go Back[/url]";
}
print <<<OUT

</td>
<td class="rgrad"></td>
</tr>
<tr>
<td colspan="3">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td class="dgradl"> </td>
<td class="dgrad"> </td>
<td class="dgradr"> </td>
</tr>
</table>
</td>
</tr>
</table>
</center>
</body>
</html>
OUT;
?>
Link to comment
Share on other sites

Guest Anonymous

Re: Captca code mccodeV2

Try...

 

<?php
include "config.php";
global $_CONFIG;
define("MONO_ON", 1);
require "class/class_db_{$_CONFIG['driver']}.php";
$db=new database;
$db->configure($_CONFIG['hostname'],
$_CONFIG['username'],
$_CONFIG['password'],
$_CONFIG['database'],
$_CONFIG['persistent']);
$db->connect();
$c=$db->connection_id;
$set=array();
$settq=$db->query("SELECT * FROM settings");
while($r=$db->fetch_row($settq))
{
$set[$r['conf_name']]=$r['conf_value'];
}
//thx to [url]http://www.phpit.net/code/valid-email/[/url] for valid_email
function valid_email($email) {
 // First, we check that there's one @ symbol, and that the lengths are right
 if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) {
   // Email invalid because wrong number of characters in one section, or wrong number of @ symbols.
   return false;
 }
 // Split it into sections to make life easier
 $email_array = explode("@", $email);
 $local_array = explode(".", $email_array[0]);
 for ($i = 0; $i < sizeof($local_array); $i++) {
    if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) {
     return false;
   }
 }  
 if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name
   $domain_array = explode(".", $email_array[1]);
   if (sizeof($domain_array) < 2) {
       return false; // Not enough parts to domain
   }
   for ($i = 0; $i < sizeof($domain_array); $i++) {
     if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) {
       return false;
     }
   }
 }
 return true;
}
print <<<EOF
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>{$set['game_name']}</title>
<script type="text/javascript">
var xmlHttp // xmlHttp variable

function GetXmlHttpObject(){ // This function we will use to call our xmlhttpobject.
var objXMLHttp=null // Sets objXMLHttp to null as default.
if (window.XMLHttpRequest){ // If we are using Netscape or any other browser than IE lets use xmlhttp.
objXMLHttp=new XMLHttpRequest() // Creates a xmlhttp request.
}else if (window.ActiveXObject){ // ElseIf we are using IE lets use Active X.
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP") // Creates a new Active X Object.
} // End ElseIf.
return objXMLHttp // Returns the xhttp object.
} // Close Function

function CheckPasswords(password){ // This is our fucntion that will check to see how strong the users password is.
xmlHttp=GetXmlHttpObject() // Creates a new Xmlhttp object.
if (xmlHttp==null){ // If it cannot create a new Xmlhttp object.
alert ("Browser does not support HTTP Request") // Alert Them!
return // Returns.
} // End If.

var url="check.php?password="+escape(password) // Url that we will use to check the password.
xmlHttp.open("GET",url,true) // Opens the URL using GET
xmlHttp.onreadystatechange = function () { // This is the most important piece of the puzzle, if onreadystatechange = equal to 4 than that means the request is done.
if (xmlHttp.readyState == 4) { // If the onreadystatechange is equal to 4 lets show the response text.
document.getElementById("passwordresult").innerHTML = xmlHttp.responseText; // Updates the div with the response text from check.php
} // End If.
}; // Close Function
xmlHttp.send(null); // Sends NULL insted of sending data.
} // Close Function.

function CheckUsername(password){ // This is our fucntion that will check to see how strong the users password is.
xmlHttp=GetXmlHttpObject() // Creates a new Xmlhttp object.
if (xmlHttp==null){ // If it cannot create a new Xmlhttp object.
alert ("Browser does not support HTTP Request") // Alert Them!
return // Returns.
} // End If.

var url="checkun.php?password="+escape(password) // Url that we will use to check the password.
xmlHttp.open("GET",url,true) // Opens the URL using GET
xmlHttp.onreadystatechange = function () { // This is the most important piece of the puzzle, if onreadystatechange = equal to 4 than that means the request is done.
if (xmlHttp.readyState == 4) { // If the onreadystatechange is equal to 4 lets show the response text.
document.getElementById("usernameresult").innerHTML = xmlHttp.responseText; // Updates the div with the response text from check.php
} // End If.
}; // Close Function
xmlHttp.send(null); // Sends NULL insted of sending data.
} // Close Function.

function CheckEmail(password){ // This is our fucntion that will check to see how strong the users password is.
xmlHttp=GetXmlHttpObject() // Creates a new Xmlhttp object.
if (xmlHttp==null){ // If it cannot create a new Xmlhttp object.
alert ("Browser does not support HTTP Request") // Alert Them!
return // Returns.
} // End If.

var url="checkem.php?password="+escape(password) // Url that we will use to check the password.
xmlHttp.open("GET",url,true) // Opens the URL using GET
xmlHttp.onreadystatechange = function () { // This is the most important piece of the puzzle, if onreadystatechange = equal to 4 than that means the request is done.
if (xmlHttp.readyState == 4) { // If the onreadystatechange is equal to 4 lets show the response text.
document.getElementById("emailresult").innerHTML = xmlHttp.responseText; // Updates the div with the response text from check.php
} // End If.
}; // Close Function
xmlHttp.send(null); // Sends NULL insted of sending data.
} // Close Function.

function PasswordMatch()
{
pwt1=document.getElementById('pw1').value;
pwt2=document.getElementById('pw2').value;
if(pwt1 == pwt2)
{
document.getElementById('cpasswordresult').innerHTML="<font color='green'>OK</font>";
}
else
{
document.getElementById('cpasswordresult').innerHTML="<font color='red'>Not Matching</font>";
}
}
</script>
<style type="text/css">
<!--
body {
background-color: #000000;
margin-top: 0px;
margin-bottom: 0px;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:12px;
}

.lgrad {
background-image:url(lgrad.jpg);
background-repeat:repeat-y;
width:19px;
}
.linegrad {
background-image:url(linegrad.PNG);
background-repeat:repeat-y;
background-align: center;
width:2px;
}
.rgrad {
background-image:url(rgrad.jpg);
background-repeat:repeat-y;
width:19px;
}
.dgrad {
background-image:url(dgrad.jpg);
background-repeat:repeat-x;
height:38px;
}
.dgradl {
background-image:url(dgradl.jpg);
background-repeat:no-repeat;
height:38px;
width:38px;
}
.dgradr {
background-image:url(dgradr.jpg);
background-repeat:no-repeat;
height:38px;
width:38px;
}
.center {
width:932px;
background-color:#360b05;
vertical-align:top;
text-align:center;
}
.table {
background-color:#360b05;
}
.table3 {
background-color:#360b05;
}
.table td {
background-color:#360b05;
height:22px;
}
.table3 td {
background-color:#360b05;
}
td .alt {
background-color:#360b05;
height:22px;
}
td .h {
background-image:url(tablehgrad.png);
background-repeat:repeat-x;
font-weight: bold;
}
.table th {
background-image:url(tablehgrad.png);
background-repeat:repeat-x;
font-weight: bold;
}
-->
</style></head>
<body>
<center>
<table width="400" border="0" cellpadding="0" cellspacing="0" class="table2">
<tr>
<td class="lgrad"></td>
<td class="center">


EOF;
$IP = ($_SERVER['HTTP_X_FORWARDED_FOR'])
   ?  $_SERVER['HTTP_X_FORWARDED_FOR']
   :  $_SERVER['REMOTE_ADDR'];
if(file_exists('ipbans/'.$IP))
{
die("[b]<font color=red size=+1>Your IP has been banned, there is no way around this.</font>[/b]</body></html>");
}
if($_POST['username'])
{
if($set['regcap_on'])
{
 if(!$_SESSION['captcha'] or $_SESSION['captcha'] != $_POST['captcha'])
 {
   unset($_SESSION['captcha']);
   die("Captcha Test Failed

>[url='register.php']Back[/url]");
 }
 unset($_SESSION['captcha']);
}
if(!valid_email($_POST['email']))
{
die("Sorry, the email is invalid.

>[url='register.php']Back[/url]");
}
if(strlen($_POST['username']) < 4)
{
die("Sorry, the username is too short.

>[url='register.php']Back[/url]");
}
$sm=100;
if($_POST['promo'] == "Your Promo Code Here")
{
$sm+=100;
}
$username=$_POST['username'];
$username=str_replace(array("<", ">"), array("<", ">"), $username);
$q=$db->query("SELECT * FROM users WHERE username='{$username}' OR login_name='{$username}'");
$q2=$db->query("SELECT * FROM users WHERE email='{$_POST['email']}'");
if($db->num_rows($q))
{
print "Username already in use. Choose another.

>[url='register.php']Back[/url]";
}
else if($db->num_rows($q2))
{
print "E-Mail already in use. Choose another.

>[url='register.php']Back[/url]";
}
else if($_POST['password'] != $_POST['cpassword'])
{
print "The passwords did not match, go back and try again.

>[url='register.php']Back[/url]";
}
else
{
$_POST['ref'] = abs((int) $_POST['ref']);
$IP = ($_SERVER['HTTP_X_FORWARDED_FOR'])
   ?  $_SERVER['HTTP_X_FORWARDED_FOR']
   :  $_SERVER['REMOTE_ADDR'];
$q=$db->query("SELECT * FROM users WHERE lastip='$IP' AND userid={$_POST['ref']}");
if($db->num_rows($q))
{
die("No creating referral multies. Bad dog.

>[url='register.php']Back[/url]");
}
if($_POST['ref']) {
$q=$db->query("SELECT * FROM users WHERE userid={$_POST['ref']}");
$r=$db->fetch_row($q);
}
$db->query("INSERT INTO users (username, login_name, userpass, level, money, crystals, donatordays, user_level, energy, maxenergy, will, maxwill, brave, maxbrave, hp, maxhp, location, gender, signedup, email, bankmoney, lastip, lastip_signup) VALUES( '{$username}', '{$username}', md5('{$_POST['password']}'), 1, $sm, 0, 0, 1, 12, 12, 100, 100, 5, 5, 100, 100, 1, '{$_POST['gender']}', unix_timestamp(), '{$_POST['email']}', -1, '$IP', '$IP')");
$i=$db->insert_id();
$db->query("INSERT INTO userstats VALUES($i, 10, 10, 10, 10, 10)");

if($_POST['ref']) {
require "global_func.php";
$db->query("UPDATE users SET crystals=crystals+2 WHERE userid={$_POST['ref']}");
event_add($_POST['ref'],"For refering $username to the game, you have earnt 2 valuable crystals!",$c);
$db->query("INSERT INTO referals VALUES('', {$_POST['ref']}, $i, unix_timestamp(),'{$r['lastip']}','$IP')");
}
print "You have signed up, enjoy the game.

> [url='login.php']Login[/url]";
}
}
else
{
if($set['regcap_on'])
{  $chars="123456789abcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!?\\/%^";
 $len=strlen($chars);
 $_SESSION['captcha']="";
 for($i=0;$i<6;$i++)
 $_SESSION['captcha'].=$chars[rand(0, $len - 1)];
}

print "<h3>{$set['game_name']} Registration</h3>";
print "<form action=register.php method=post>
<table width='75%' class='table' cellspacing='1'>
<tr>
<td width='30%'>Username</td>
<td width='40%'><input type=text name=username onkeyup='CheckUsername(this.value);'></td>
<td width='30%'><div id='usernameresult'></div></td>
</tr>
<tr>
<td>Password</td>
<td><input type=password id='pw1' name=password onkeyup='CheckPasswords(this.value);PasswordMatch();'></td>
<td><div id='passwordresult'></div></td>
</tr>
<tr>
<td>Confirm Password</td><td><input type=password name=cpassword id='pw2' onkeyup='PasswordMatch();'></td>
<td><div id='cpasswordresult'></div></td>
</tr>
<tr>
<td>Email</td><td><input type=text name=email onkeyup='CheckEmail(this.value);'></td>
<td><div id='emailresult'></div></td>
</tr>
<tr>
<td>Gender</td>
<td colspan='2'><select name='gender' type='dropdown'>
<option value='Male'>Male
<option value='Female'>Female</select></td>
</tr>
<tr>
<td>Promo Code</td><td colspan=2><input type=text name=promo></td>
</tr>

<input type=hidden name=ref value='";
if($_GET['REF']) { print $_GET['REF']; }
print "' />";
if($set['regcap_on'])
{
print "<tr>
<td colspan=3>[img=captcha_verify.php?bgcolor=cccccc]

<input type='text' name='captcha' /></td>
</tr>";
}
print "
<tr>
<td colspan=3 align=center><input type=submit value=Submit></td>
</tr>
</table>
</form>

> [url='login.php']Go Back[/url]";
}
print <<<OUT

</td>
<td class="rgrad"></td>
</tr>
<tr>
<td colspan="3">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td class="dgradl"> </td>
<td class="dgrad"> </td>
<td class="dgradr"> </td>
</tr>
</table>
</td>
</tr>
</table>
</center>
</body>
</html>
OUT;
?>
Link to comment
Share on other sites

  • 1 month later...

Re: Captca code mccodeV2

 

Yeh but if you dont use the Captcha code on the Gym people will be sitting there all Day Auto-Refreshing, Big mistake!

not just sitting there... it prevents people setting up bots to sit there all day... and on the register it prevents bots signing up!

Link to comment
Share on other sites

Re: Captca code mccodeV2

 

Yeh but if you dont use the Captcha code on the Gym people will be sitting there all Day Auto-Refreshing, Big mistake!

Or just have set a 2 hourly cron which forces user logout every 2 hours. That for one saves alot of hassle, and 2, deducts code...

I found captchas really annoying when i played games....

I think thats the way to go though, just auto log everyone out every 2 hours..

Link to comment
Share on other sites

Guest Anonymous

Re: Captca code mccodeV2

Logging people out --- hmm that's going cheese them of if half way through an attack or just about to sending a nice long mail to someone. Not to mention the fact you seem totally dependent on crons to perform this futile task.

How about you get rid of captchas all together. (gosh, shock, horror)

They are totally unnecessary, and an utter waste of time. Bypassing them is simple in (currently) around 90% of cases.

And yes... before somebody complains... AS still uses one captcha, however even we speak, I'm rewriting the module that relies on it.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...