ok the way this is gonna work is ... from monday to saturday you will be asking for scripts that go along with the theme... then on sunday every one will vote on a new theme for the next week... any one can ask for a script... any one can post a script...

the script DOESN'T NECESSARILY NEED TO BE ASKED FOR inorder for you to post it... just make sure it goes along with the theme... or you will loose all respect biggrin.gif

any ways this weeks theme is

SECURITY



So for the first script i thought i would show you how to make the randomly generated number images that you see on most registration pages....

i am not going to go into too much detail because this post would be a mile long if i did so here is the code:

CODE
<?php
  Header("(anti-spam-(anti-spam-content-type:)) image/gif");
  $fface = "fonts/TIMES.TTF";
  if(!$_GET['num'])
     $text = rand(100,999);
  else
     $text = $_GET['num'];
  if(!isset($s)) $s=25;
  $size = imagettfbbox($s,0,$fface,$text);
  $dx = abs($size[2]-$size[0]);
  $dy = abs($size[5]-$size[3]);
  $xpad=9;
  $ypad=9;



  $im = imagecreate($dx+$xpad,$dy+$ypad);
  $background = ImageColorAllocate($im, 0,0,0);

imagesetthickness($im,1);
$typeis = "circle";
for($i = 0; $i <= 10; $i++)
{
$mycol = ImageColorAllocate($im, rand(0,255),rand(0,255),rand(0,255));

if($typeis == "line")
ImageLine($im, rand(0,$dx+$xpad),rand(0,$dy+$ypad),rand(0,$dx+$xpad),rand(0,$dy+$ypad), $mycol);
else
ImageEllipse($im, rand(0,$dx+$xpad),rand(0,$dy+$ypad), 20,20, $mycol);
}

  $shadow = ImageColorAllocate($im, 100,100,100);
  $textcol = ImageColorAllocate($im, 150,150,150);
  ImageTTFText($im, $s, 0, (int)($xpad/2)+2, $dy+(int)($ypad/2), $shadow,$fface, $text);
  ImageTTFText($im, $s, 0, (int)($xpad/2), $dy+(int)($ypad/2)-2, $textcol,$fface, $text);
  ImageGif($im);
  ImageDestroy($im);
?>


Ok... some of the nice features of this script is that it allows you to pass in a number generated from the client page or you can just have one randomly generated... if you want to check for validity, i would pass it in... but here are previews of both:

here is a preview Tsunami's number generator
Go ahead.. reload the page... or try it on your own site...
To do a randomly generated number... just use this as an image tag: http://tsunamicentral.trap17.com/randnum.php3

to use your own... put a number in like so: http://tsunamicentral.trap17.com/randnum.php3?num=YOUR#HERE

right click and save as... ITS A PICTURE!!!
enjoy

 

 

 


Reply