PHP Web Host - Quality Web Hosting For All PHP Applications Just Great Software
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
<
Author Message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 15235
Location: Kansas

PostPosted: Wed Oct 29, 2003 8:06 am Reply with quote Back to top

Tired of the same, dreary old security code? Well, try this code. You can modify it to your heart's content! If you create something really neat, nice, pretty, etc., please post it back! Note that it needs no images and it is using JPG, but can easily be modified to PNG or any other format.
Code:
function gfx($random_num) {
   global $prefix, $db;
   require("config.php");
   $datekey = date("F j");
   $rcode = hexdec(md5($_SERVER[HTTP_USER_AGENT] . $sitekey . $random_num . $datekey));
   $code = substr($rcode, 2, 6);

   $circles=5;
   $width=100;
   $height=40;
   $font=5;

   $fontwidth = ImageFontWidth($font) * strlen($string);
   $fontheight = ImageFontHeight($font);

   $im = @imagecreate ($width,$height);
   $background_color = imagecolorallocate ($im, 255, 255, 255);
   $text_color = imagecolorallocate ($im, rand(0,100), rand(0,100),rand(0,100)); // Random Text

   for ($i=1;$i<=$circles;$i++) {
      $randomcolor = imagecolorallocate ($im , rand(100,255),rand(100,255),rand(100,255));
      imagefilledellipse($im,rand(0,$width-10),rand(0,$height-3),rand(20,70),rand(20,70),$randomcolor);
   }

   imagerectangle($im,0,0,$width-1,$height-1,$text_color);
   imagestring ($im, $font, 12, 12,$code,$text_color);
   header ("Content-type: image/jpeg");
   imagejpeg ($im,'',80);
   ImageDestroy($im);
   die();
}


Last edited by Raven on Fri Oct 31, 2003 8:50 am; edited 1 time in total
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
scottr
PHP-Portal Project


Joined: Jan 21, 2003
Posts: 41
Location: Southern California

PostPosted: Wed Oct 29, 2003 8:39 am Reply with quote Back to top

cool, can we see it in action Smile
View user's profile Send private message Visit poster's website Yahoo Messenger
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 15235
Location: Kansas

PostPosted: Wed Oct 29, 2003 8:44 am Reply with quote Back to top

Sure. Just replace your gfx() function in modules/Your_Account/index.php Smile and/or admin.php. You think I'm going to do EVERYTHING for you people? Laughing
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
scottr
PHP-Portal Project


Joined: Jan 21, 2003
Posts: 41
Location: Southern California

PostPosted: Wed Oct 29, 2003 8:49 am Reply with quote Back to top

Don't you already ? hehe. Laughing
I don't have GD loaded at home and i got everything working
and don't want to risk breaking things.
Actually i would like GD loaded here.
View user's profile Send private message Visit poster's website Yahoo Messenger
blith
Life Cycles Becoming CPU Cycles


Joined: Jul 18, 2003
Posts: 953

PostPosted: Wed Oct 29, 2003 9:00 am Reply with quote Back to top

Great!! Thanks Raven!! Now I have something else to tweak... such fun!
View user's profile Send private message Visit poster's website
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 15235
Location: Kansas

PostPosted: Wed Oct 29, 2003 9:01 am Reply with quote Back to top

scottr wrote:
Don't you already ? hehe. Laughing
I don't have GD loaded at home and i got everything working
and don't want to risk breaking things.
Actually i would like GD loaded here.

Only registered users can see links on this board!
Get registered or login to the forums!


So many excuses .... Laughing
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
scottr
PHP-Portal Project


Joined: Jan 21, 2003
Posts: 41
Location: Southern California

PostPosted: Wed Oct 29, 2003 9:24 am Reply with quote Back to top

hey that's neat, i hit refresh on that page and see different background designs everytime Cool
View user's profile Send private message Visit poster's website Yahoo Messenger
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 15235
Location: Kansas

PostPosted: Wed Oct 29, 2003 9:27 am Reply with quote Back to top

Ah the wonderful world of randomization functions Laughing
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Frogger
Worker
Worker


Joined: Oct 06, 2003
Posts: 108

PostPosted: Thu Oct 30, 2003 9:10 am Reply with quote Back to top

What would be causing this. It isn't a major issue, just wondering if I can remedy the problem.

Code:
PHP Warning:  imagedestroy(): supplied argument is not a valid Image resource in /home/froggerz/public_html/admin.php on line 149



Code:
Line 149    ImageDestroy($image);
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger ICQ Number
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 15235
Location: Kansas

PostPosted: Thu Oct 30, 2003 9:14 am Reply with quote Back to top

Did you remember to change your JPG to PNG logic? I think you would change
Code:
   header ("Content-type: image/jpeg");
   imagejpeg ($im,'',80);
to
Code:
   header ("Content-type: image/png");
   imagepng ($im,'',80);
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
TheosEleos
Moderator


Joined: Sep 18, 2003
Posts: 958
Location: Missouri

PostPosted: Thu Oct 30, 2003 2:16 pm Reply with quote Back to top

This should work with 6.9 right?

(getting tired of being high maintnance but my admin is broke now and I can't log in)
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger ICQ Number
msimonds
Regular
Regular


Joined: Jul 15, 2003
Posts: 56
Location: Dallas

PostPosted: Thu Oct 30, 2003 8:41 pm Reply with quote Back to top

how do you control the size of the image if I have it set on my default theme to a certain size
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 15235
Location: Kansas

PostPosted: Thu Oct 30, 2003 8:50 pm Reply with quote Back to top

TheosEleos wrote:
This should work with 6.9 right?

(getting tired of being high maintnance but my admin is broke now and I can't log in)
Well, it works with my 6.9
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
TheosEleos
Moderator


Joined: Sep 18, 2003
Posts: 958
Location: Missouri

PostPosted: Thu Oct 30, 2003 9:32 pm Reply with quote Back to top

I give up, on all of this. I'll cut loose so you can have a break from me. See you in a couple of weeks. Sad
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger ICQ Number
Frogger
Worker
Worker


Joined: Oct 06, 2003
Posts: 108

PostPosted: Thu Oct 30, 2003 10:46 pm Reply with quote Back to top

Works for me in 6.8, 6.9 and 7.0 beta
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger ICQ Number
Frogger
Worker
Worker


Joined: Oct 06, 2003
Posts: 108

PostPosted: Fri Oct 31, 2003 7:52 am Reply with quote Back to top

Anyone know what is causing this:

Code:
PHP Warning:  imagedestroy(): supplied argument is not a valid Image resource in /home/WWW/public_html/admin.php on line 149
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger ICQ Number
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 15235
Location: Kansas

PostPosted: Fri Oct 31, 2003 8:50 am Reply with quote Back to top

I think this line
Code:
ImageDestroy($image);
should be
Code:
ImageDestroy($im);
I corrected my original post - SORRY!
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
Frogger
Worker
Worker


Joined: Oct 06, 2003
Posts: 108

PostPosted: Fri Oct 31, 2003 9:12 am Reply with quote Back to top

Not a fo-pah? Laughing

Thanks, will update it.
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger ICQ Number
paranor
Client


Joined: Aug 28, 2003
Posts: 227

PostPosted: Thu Nov 13, 2003 3:50 pm Reply with quote Back to top

got around to installing it.

very cool. yo.
View user's profile Send private message
BigDaddyEBK
New Member
New Member


Joined: Nov 21, 2003
Posts: 5
Location: La Mesa, CA(suburb of San Diego)

PostPosted: Sat Nov 22, 2003 12:39 am Reply with quote Back to top

THANKS for this code hack info "Raven"!! I've been trying to figure this one out for a while!

Would you happen to know a way to make it look similar to the one found on the
Only registered users can see links on this board!
Get registered or login to the forums!
? Or at least, something close to that random
Only registered users can see links on this board!
Get registered or login to the forums!
image they have on that page Question

It TOTALLY works like a charm on my website!!!
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger ICQ Number
paranor
Client


Joined: Aug 28, 2003
Posts: 227

PostPosted: Sat Nov 22, 2003 6:36 am Reply with quote Back to top

Why would you ant it soo hard to read? That's one of the things I hate about ordering tickets on ticketmaster - some of their images aren't readable.
View user's profile Send private message
BigDaddyEBK
New Member
New Member


Joined: Nov 21, 2003
Posts: 5
Location: La Mesa, CA(suburb of San Diego)

PostPosted: Sat Nov 22, 2003 9:28 pm Reply with quote Back to top

paranor wrote:
Why would you ant it soo hard to read? That's one of the things I hate about ordering tickets on ticketmaster - some of their images aren't readable.


Well, I have to take extra security precautions since I co-locate my server at work (I happen to work at a local ISP) & I'm getting free unlimited bandwidth. I just can't abuse that now can I? Wink
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger ICQ Number
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 15235
Location: Kansas

PostPosted: Sat Nov 22, 2003 10:19 pm Reply with quote Back to top

BigDaddyEBK wrote:
THANKS for this code hack info "Raven"!! I've been trying to figure this one out for a while!

Would you happen to know a way to make it look similar to the one found on the
Only registered users can see links on this board!
Get registered or login to the forums!
? Or at least, something close to that random
Only registered users can see links on this board!
Get registered or login to the forums!
image they have on that page Question

It TOTALLY works like a charm on my website!!!
So you just want the checkerboard background? If so, why not just use the one that comes with nuke?
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
BigDaddyEBK
New Member
New Member


Joined: Nov 21, 2003
Posts: 5
Location: La Mesa, CA(suburb of San Diego)

PostPosted: Sat Nov 22, 2003 11:55 pm Reply with quote Back to top

Raven wrote:
So you just want the checkerboard background? If so, why not just use the one that comes with nuke?


NOPE.....I wanted something different than the plain security code that comes with nuke!! Like the code you posted earlier in this topic, but I was also wondering if there's a code hack to make it look similar the one on the
Only registered users can see links on this board!
Get registered or login to the forums!
page Question

Their's has randomly generated background images & words (it can be seen if you refresh the page a couple of times)!! Confused
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger ICQ Number
BigDaddyEBK
New Member
New Member


Joined: Nov 21, 2003
Posts: 5
Location: La Mesa, CA(suburb of San Diego)

PostPosted: Thu Dec 04, 2003 1:03 am Reply with quote Back to top

Hey....I've found another way to customize the security code, in addition to Raven's suggestions!! Razz

This info was given to me by
Only registered users can see links on this board!
Get registered or login to the forums!
on the NukeCops site.

Written by
Only registered users can see links on this board!
Get registered or login to the forums!
:
yeah i made something similiar for 6.7 (should work on 6.8 but will break 6.9& up security code on/off switch)
Only registered users can see links on this board!
Get registered or login to the forums!

(refresh a few times)

Turn on/off security images for user login, user registration, and admin panel
specify the length of the code (3-10)
use "Enhanced" security codes similiar to those found on major sites like
yahoo!
aol IM
Hotmail

Create you own security code graphics
Only registered users can see links on this board!
Get registered or login to the forums!
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger ICQ Number