Jump to content

Recommended Posts

Hey everyone,

 

I have a script that validates the users that use my website with a box displaying 9 numbers.  They have to click the number that is displayed at the top with the "Click 9" for example, and they have to click 9 in the list.

 

The problem I have is that the script was given to me by a friend, and I can't work out how to make the boxes/text bigger.  I have fiddled before and the results have been fruitless..  If someone could post back to me with the areas I need to change, and what I have to change, I would be extremely grateful.

 

the first page is below:

 

<?php


//////////////////////////////////////////////////////////////
/////////////////////////////////////////////

if($_SESSION['validated'] == 1) { //changed the = with ==
echo "<meta http-equiv=\"refresh\" content=\"0;URL=$destination.php\">";
exit();
}

//buffer
ob_start('ob_gzhandler'); 





// if submit
if ($_POST[x]){ 
// posted 
$x = $_POST[x];	 
$y = $_POST[y];	
// decode and round number 
$aa = round(base64_decode($_SESSION['afloat']));
// x&y coords	
$xc[1] = ($x >= 1) && ($x <= 17); 
$xc[2] = ($x >= 18) && ($x <= 36);
$xc[3] = ($x >= 37) && ($x <= 53); 
if (($y >= 18) && ($y <= 35)){$ab = $aa;}
elseif (($y >= 36) && ($y <= 51)){$ab = $aa - 3;}
else {$ab = $aa - 6;}
//demo ERROR message below
$mess = "ERROR"; 
//
if ($xc[$ab]){
// submit your form 
//demo SUCCESS message below
$mess = "SUCCESS";
}
//demo alert message below



if($mess=='SUCCESS'){


	echo "<meta http-equiv=\"refresh\" content=\"0;URL=$destination.php\">";
	exit();
}

if($mess=='ERROR'){


	echo "<meta http-equiv=\"refresh\" content=\"0;URL=validate_$destination.php?msg=error\">";


}

ob_end_flush(); 
exit; 
} 
$afloat = base64_encode(" " .  $num1 = rand(1, . "." .  $num2 = rand(100,999) . "  ");
// rectangle y coord 
$aler = "> 18";  
// create random image
$_SESSION[igif] = "image_grid.php?a=" . $afloat . "";
$_SESSION['afloat'] = $afloat; 
?>
<html>
<head>
<style type="text/css"> 
/* click image */
.cd { 
width: 54px;
height: 69px; 
background-image: url(<?=$_SESSION[igif];?>);
background-repeat: no-repeat;
position: relative; 
left:<?=rand(-100,100);?>px;
bottom:<?=rand(25,25);?>px;
z-index: 2;
} 
</style>
<script language="JavaScript"> 
// submit form func 
function submitform() { 
// if box coord submit else rectangle coord alert 
// Do not edit javascript below this line. you can edit the alert message 
if (document.xycoords.y.value <?=$aler;?>) { 
document.xycoords.submit();
} else { 
alert("Click number in square identicale to number in rectangle to submit.");
} 
}
// image x&y value
function xycoord(event) { 
imagex = event.offsetX?(event.offsetX):event.pageX-document.getElementById("coord").offsetLeft;
document.xycoords.x.value = imagex;
imagey = event.offsetY?(event.offsetY):event.pageY-document.getElementById("coord").offsetTop;
document.xycoords.y.value = imagey;
} 
</script>	

<div align="center"><form name="xycoords" action="<?=$_SERVER['PHP_SELF']; ?>" method="post">
<table summary="" border="0">
                    	<tr> <!-- include hidden form input: x >>>>>--><input type="hidden" name="x" /><!-- include hidden form input: y >>>>>--><input type="hidden" name="y" />
                    		<td><span class="h1">Verify yourself</span></td>
                    	</tr>
                    </table>  </form><!-- This line >>>> <div id="coord" onclick="submitform(xycoord(event))" class="cd"></div> >>> Must be outside of form tags <form></form> to work in FF, NS and Opera >>>> -->
	<p><br></p><div id="coord" class="cd" onclick="submitform(xycoord(event))"></div>  
</div>

<div align="center">

<?php 
if($_GET['msg']=="error"){
$msg="<span class='error'>Incorrect Choice.  Please click the right number</span>";

echo "$msg"; 
}
?>

</div>

</body>
</html>
<? ob_end_flush();?>

 

 

 

The second script which is included in this file is:

 

<?php 

//buffer
ob_start('ob_gzhandler');
session_start();
//DEC 67 
//get a, decode and round
// 
$a = $_GET['a'];
if ($a == $_SESSION['afloat']){
$aa = round(base64_decode($a)) - 1; 
$im = imagecreatetruecolor (54, 69);
//DEC 79 
//random numbers
// 
$myn = array(1, 2, 3, 4, 5, 6, 7, 8, 9);
$rn = array_rand($myn, 9);
$string1 = "" . $myn[$rn[0]] . " " . $myn[$rn[1]] . " " . $myn[$rn[2]] . "";
$string2 = "" . $myn[$rn[3]] . " " . $myn[$rn[4]] . " " . $myn[$rn[5]] . "";
$string3 = "" . $myn[$rn[6]] . " " . $myn[$rn[7]] . " " . $myn[$rn[8]] . "";   
$mynum = "" . $string1 . " " . $string2 . " " . $string3 . "";
//DEC 68 DEC 69 DEC 66  DEC 89  DEC 82
//string, random click number and line coord
$na = 17;
$nb = 54;
$nc = 0; 
$nd = 54;
$ab = explode(" ", $mynum);
$mystring = "Click $ab[$aa]";
//random image color
//
$change = rand(1,9);
$lime = imagecolorallocate($im,0,255,0);
$yellow = imagecolorallocate($im,255,255,0);
$white = imagecolorallocate($im,255,255,255);
$lgray = imagecolorallocate($im,206,206,206); 
$gray = imagecolorallocate($im,115,115,115); 
$black = imagecolorallocate($im,0,0,0);
$green = imagecolorallocate($im,1,107,0);
$grc = " $lime $yellow $white $lgray $yellow $white $gray $black $green";
$rc = explode(" ", $grc);
$bgc = $rc[$change]; 
//DEC 72 
//line & number colors
//
$bc = imagecolorallocate ($im, 0, 0, 0); 
$rd = imagecolorallocate ($im, 255, 0, 0); 
$wh = imagecolorallocate ($im, 255, 255, 255);
//DEC 73 
//if color = this change line & number color 
//
if (($change > 3) && ($change < 7)) { $bc = $rd;} 
elseif ($change > 6) { $bc = $wh;}
//DEC 67 
//fill image color
// 
imagefilledrectangle ($im, 0, 0, 54, 69, $bgc);
imagerectangle ($im, 0, 0, 53, 68, $bc); 
//DEC 75 
//vertical lines 
//
for($i=$na;$i<=$nb;$i+=19)
imageline($im,$i,17,$i,(69)-2,$bc);
// Horizontal Lines
for($i=$na;$i<=$nb;$i+=17)
imageline($im,2,$i,(54)-2,$i,$bc);
//DEC 69 
//image string
//    
imagestring ( $im, 5, 5, 18,$string1, $bc);
imagestring ( $im, 5, 5, 35,$string2, $bc);
imagestring ( $im, 5, 5, 52,$string3, $bc);  
imagestring ($im, 3, 2, 3, "$mystring", $bc); 
//DEC 89 
//header content 
//
header("Content-Type: image/gif"); 
//DEC 48 
//send image
//
imagegif($im); 
//DEC 55 
//destroy image 
//
imagedestroy($im); 
}
//flush


ob_end_flush();
?>

 

Thank you in advance everyone :)

 

Goose.

Link to comment
https://forums.phpfreaks.com/topic/172575-user-validation-test-improvement/
Share on other sites

Ok, I have read some information about that..but it says that the max font can be put as 5, the font I have is too small, so how do I make it bigger?

 

Could you also confirm if I only have to change the parameters for the top-left and bottom-right part to make the clicking area bigger?  Will this make the grid inside bigger too?  Can someone point me at which lines I need to edit, I want to get this right first time and done quickly, as I've spent so much time on this previously with no results.

 

Many thanks,

 

Goose.

This thread is more than a year old. Please don't revive it unless you have something important to add.

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.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.