| Author |
Message |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 16987 Location: Kansas
|
Posted:
Wed Oct 29, 2003 8:06 am |
|
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 |
|
|
 |
scottr PHP-Portal Project

Joined: Jan 21, 2003 Posts: 41 Location: Southern California
|
Posted:
Wed Oct 29, 2003 8:39 am |
|
cool, can we see it in action  |
|
|
|
 |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 16987 Location: Kansas
|
Posted:
Wed Oct 29, 2003 8:44 am |
|
Sure. Just replace your gfx() function in modules/Your_Account/index.php and/or admin.php. You think I'm going to do EVERYTHING for you people?  |
|
|
|
 |
scottr PHP-Portal Project

Joined: Jan 21, 2003 Posts: 41 Location: Southern California
|
Posted:
Wed Oct 29, 2003 8:49 am |
|
Don't you already ? hehe.
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. |
|
|
|
 |
blith Client

Joined: Jul 18, 2003 Posts: 977
|
Posted:
Wed Oct 29, 2003 9:00 am |
|
Great!! Thanks Raven!! Now I have something else to tweak... such fun! |
|
|
|
 |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 16987 Location: Kansas
|
Posted:
Wed Oct 29, 2003 9:01 am |
|
| scottr wrote: | Don't you already ? hehe.
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. |
So many excuses ....  |
|
|
|
 |
scottr PHP-Portal Project

Joined: Jan 21, 2003 Posts: 41 Location: Southern California
|
Posted:
Wed Oct 29, 2003 9:24 am |
|
hey that's neat, i hit refresh on that page and see different background designs everytime  |
|
|
|
 |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 16987 Location: Kansas
|
Posted:
Wed Oct 29, 2003 9:27 am |
|
Ah the wonderful world of randomization functions  |
|
|
|
 |
Frogger Worker


Joined: Oct 06, 2003 Posts: 108
|
Posted:
Thu Oct 30, 2003 9:10 am |
|
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); |
|
|
|
 |
 |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 16987 Location: Kansas
|
Posted:
Thu Oct 30, 2003 9:14 am |
|
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); |
|
|
|
|
 |
TheosEleos Life Cycles Becoming CPU Cycles

Joined: Sep 18, 2003 Posts: 960 Location: Missouri
|
Posted:
Thu Oct 30, 2003 2:16 pm |
|
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) |
|
|
 |
 |
msimonds Regular


Joined: Jul 15, 2003 Posts: 56 Location: Dallas
|
Posted:
Thu Oct 30, 2003 8:41 pm |
|
how do you control the size of the image if I have it set on my default theme to a certain size |
|
|
|
 |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 16987 Location: Kansas
|
Posted:
Thu Oct 30, 2003 8:50 pm |
|
| 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 |
|
|
|
 |
TheosEleos Life Cycles Becoming CPU Cycles

Joined: Sep 18, 2003 Posts: 960 Location: Missouri
|
Posted:
Thu Oct 30, 2003 9:32 pm |
|
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.  |
|
|
 |
 |
Frogger Worker


Joined: Oct 06, 2003 Posts: 108
|
Posted:
Thu Oct 30, 2003 10:46 pm |
|
Works for me in 6.8, 6.9 and 7.0 beta |
|
|
 |
 |
Frogger Worker


Joined: Oct 06, 2003 Posts: 108
|
Posted:
Fri Oct 31, 2003 7:52 am |
|
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 |
|
|
|
 |
 |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 16987 Location: Kansas
|
Posted:
Fri Oct 31, 2003 8:50 am |
|
I think this line | Code: | | ImageDestroy($image); | should be I corrected my original post - SORRY! |
|
|
|
 |
Frogger Worker


Joined: Oct 06, 2003 Posts: 108
|
Posted:
Fri Oct 31, 2003 9:12 am |
|
Not a fo-pah?
Thanks, will update it. |
|
|
 |
 |
paranor Worker


Joined: Aug 28, 2003 Posts: 227
|
Posted:
Thu Nov 13, 2003 3:50 pm |
|
got around to installing it.
very cool. yo. |
|
|
|
 |
BigDaddyEBK New Member


Joined: Nov 21, 2003 Posts: 5 Location: La Mesa, CA(suburb of San Diego)
|
Posted:
Sat Nov 22, 2003 12:39 am |
|
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 ? Or at least, something close to that random image they have on that page
It TOTALLY works like a charm on my website!!! |
|
|
 |
 |
paranor Worker


Joined: Aug 28, 2003 Posts: 227
|
Posted:
Sat Nov 22, 2003 6:36 am |
|
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. |
|
|
|
 |
BigDaddyEBK New Member


Joined: Nov 21, 2003 Posts: 5 Location: La Mesa, CA(suburb of San Diego)
|
Posted:
Sat Nov 22, 2003 9:28 pm |
|
| 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?  |
|
|
 |
 |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 16987 Location: Kansas
|
Posted:
Sat Nov 22, 2003 10:19 pm |
|
| 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 ? Or at least, something close to that random image they have on that page
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? |
|
|
|
 |
BigDaddyEBK New Member


Joined: Nov 21, 2003 Posts: 5 Location: La Mesa, CA(suburb of San Diego)
|
Posted:
Sat Nov 22, 2003 11:55 pm |
|
| 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 page
Their's has randomly generated background images & words (it can be seen if you refresh the page a couple of times)!!  |
|
|
 |
 |
BigDaddyEBK New Member


Joined: Nov 21, 2003 Posts: 5 Location: La Mesa, CA(suburb of San Diego)
|
Posted:
Thu Dec 04, 2003 1:03 am |
|
Hey....I've found another way to customize the security code, in addition to Raven's suggestions!!
This info was given to me by on the NukeCops site.
Written by :
yeah i made something similiar for 6.7 (should work on 6.8 but will break 6.9& up security code on/off switch)
(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
|
|
|
 |
 |
|
|
|
|