# Anti spam when register code!

**URL:** https://forum.kirupa.com/t/anti-spam-when-register-code/42114
**Category:** Uncategorized
**Created:** [February 5, 2004, 10:29am UTC](https://forum.kirupa.com/t/anti-spam-when-register-code/42114 "2004-02-05T10:29:17Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![OKtrust](https://avatars.discourse-cdn.com/v4/letter/o/c77e96/32.png) [@OKtrust](https://forum.kirupa.com/u/OKtrust)
#### Post date: [February 5, 2004, 10:29am UTC](https://forum.kirupa.com/t/anti-spam-when-register-code/42114/1 "2004-02-05T10:29:17Z")

</div>

hi all, see what I found this:  
[http://zend.com/zend/tut/tutorial-mehmet1.php](http://zend.com/zend/tut/tutorial-mehmet1.php)  
but I don’t know how can it work on linux hosting ? because in image.php it required font path … on window lol  
I try all: define $font …  
and I found this code in IBF:

```php

*-------------------------------------------------------------------------*/
	//
	// Show GD created security image...
	//
	/*-------------------------------------------------------------------------*/
	
	function show_gd_img($content="")
	{
		global $ibforums, $DB;

		flush();
		
		@header("Content-Type: image/jpeg");
		
		if ( $ibforums->vars['use_ttf'] != 1 )
		{
			$font_style = 5;
			$no_chars = strlen($content);
			
			$charheight = ImageFontHeight($font_style);
			$charwidth = ImageFontWidth($font_style);
			$strwidth = $charwidth * intval($no_chars);
			$strheight = $charheight;
			
			$imgwidth = $strwidth + 15;
			$imgheight = $strheight + 15;
			$img_c_x = $imgwidth / 2;
			$img_c_y = $imgheight / 2;
			
			$im = ImageCreate($imgwidth, $imgheight);
			$text_col = ImageColorAllocate($im, 0, 0, 0);
			$back_col = ImageColorAllocate($im, 200,200,200);
			
			ImageFilledRectangle($im, 0, 0, $imgwidth, $imgheight, $text_col);
			ImageFilledRectangle($im, 3, 3, $imgwidth - 4, $imgheight - 4, $back_col);
			
			$draw_pos_x = $img_c_x - ($strwidth / 2) + 1;
			$draw_pos_y = $img_c_y - ($strheight / 2) + 1;
			
			ImageString($im, $font_style, $draw_pos_x, $draw_pos_y, $content, $text_col);
		
		}
		else
		{
			$image_x = isset($ibforums->vars['gd_width']) ? $ibforums->vars['gd_width'] : 250;
			$image_y = isset($ibforums->vars['gd_height']) ? $ibforums->vars['gd_height'] : 70;
			
			$im = imagecreate($image_x,$image_y);
			
			$white = ImageColorAllocate($im, 255, 255, 255);
			$black = ImageColorAllocate($im, 0, 0, 0);
			$grey = ImageColorAllocate($im, 200, 200, 200 );
			
			$no_x_lines = ($image_x - 1) / 5;
			
			for ( $i = 0; $i <= $no_x_lines; $i++ )
			{
				// X lines
				
				ImageLine( $im, $i * $no_x_lines, 0, $i * $no_x_lines, $image_y, $grey );
				
				// Diag lines
				
				ImageLine( $im, $i * $no_x_lines, 0, ($i * $no_x_lines)+$no_x_lines, $image_y, $grey );
			}
			
			$no_y_lines = ($image_y - 1) / 5;
			
			for ( $i = 0; $i <= $no_y_lines; $i++ )
			{
				ImageLine( $im, 0, $i * $no_y_lines, $image_x, $i * $no_y_lines, $grey );
			}
			
			$font = isset($ibforums->vars['gd_font']) ? $ibforums->vars['gd_font'] : getcwd().'/fonts/progbot.ttf';
		
			$text_bbox = ImageTTFBBox(20, 0, $font, $content);
			
			$sx = ($image_x - ($text_bbox[2] - $text_bbox[0])) / 2; 
			$sy = ($image_y - ($text_bbox[1] - $text_bbox[7])) / 2; 
			$sy -= $text_bbox[7];
			
			imageTTFtext($im, 20, 0, $sx, $sy, $black, $font, $content);
		}
		
		
		ImageJPEG($im);
		ImageDestroy($im);
		
		exit();
		
	}

```

in this code I dont know what \*\* $font = isset($ibforums-\>vars[‘gd\_font’]) ? $ibforums-\>vars[‘gd\_font’] : getcwd().’/fonts/progbot.ttf’; [/] mean too!  
please help me, guys!
