Using the image, getenv, and rand functions, we draw unique png images for every visit to the page. Kinda just for fun,
take a peek:By : bigphish
<?php
$your_ip = getenv ("REMOTE_ADDR");
$your_var = preg_split("/\./",$your_ip);
$oc1 = $your_var[0];
$oc2 = $your_var[1];
$oc3 = $your_var[2];
$oc4 = $your_var[3];
Header ("Content-type: image/png");
$your_image = ImageCreate (600, 600);
$bg_grey = ImageColorAllocate ($your_image, 169, 169, 255);
if($oc1 > 15 && $oc2 > 15 && $oc3 > 15 && $oc4 > 15){
$your_poly = array(
"0" => $oc3 * rand(1,20) * 0.1,
"1" => $oc4 * rand(1,20) * 0.1,
"2" => $oc1 * rand(1,20) * 0.1,
"3" => $oc2 * rand(1,20) * 0.1,
"4" => $oc4 * rand(1,20) * 0.1,
"5" => $oc2 * rand(1,20) * 0.1,
"6" => $oc3 * rand(1,20) * 0.1,
"7" => $oc3 * rand(1,20) * 0.1,
"8" => $oc3 * rand(1,20) * 0.1,
"9" => $oc3 * rand(1,20) * 0.1,
"10" => $oc3 * rand(1,20) * 0.1,
"11" => $oc3 * rand(1,20) * 0.1,
);
$shape = "POLY";
} else {
$clr1 = imagecolorallocate ($your_image, $oc4, $oc4, $oc3);
$clr2 = imagecolorallocate ($your_image, $oc3, $oc3, $oc2);
$clr3 = imagecolorallocate ($your_image, $oc2, $oc2, $oc1);
$clr4 = imagecolorallocate ($your_image, $oc1, $oc1, $oc4);
$shape = "CIRCLE";
}
$black = imagecolorallocate ($your_image, 0, 0, 0);
$shp_clr = ImageColorAllocate ($your_image, rand($oc3,255), rand($oc2,255), rand(1,$oc1));
$font = 5;
$width = ImageFontWidth($font) * strlen($your_ip);
$height = ImageFontHeight($font);
if ($shape == "POLY"){
ImageFilledPolygon ($your_image, $your_poly, 6, $shp_clr);
}
else if ($shape == "CIRCLE"){
imagefilledarc ($your_image, $oc2 + rand(80,600), $oc1 + rand(80,600), $oc3 + rand(40,400), $oc3 + rand(40,400), 0, 359, $clr1, IMG_ARC_PIE);
imagefilledarc ($your_image, $oc3 + rand(200,400), $oc4 + rand(200,400), $oc2, $oc2, 0, 359, $clr2, IMG_ARC_PIE);
imagefilledarc ($your_image, $oc4 + rand(100,500), $oc3 + rand(100,500), $oc4 + rand(20,40), $oc4 + rand(20,40), 0, 359, $clr3, IMG_ARC_PIE);
imagefilledarc ($your_image, $oc1 + rand(80,100), $oc2 + rand(80,100), $oc1, $oc1, 0, 359, $clr4, IMG_ARC_PIE);
}
ImageString($your_image, $font, 0, 0, $your_ip, $black);
ImagePng ($your_image);
ImageDestroy ($your_image);
?>
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |
More Miscellaneous Code Articles
More By Codewalkers
developerWorks - FREE Tools! |
The IBM DB2 Deep Compression ROI tool is designed for DBA’s and IT management personnel to perform a clinical analysis of the cost savings gained from the Storage Optimization feature of DB2 9 for Linux, UNIX and Windows. The feature, also known as Deep Compression, compresses data that lies within a database by up to 80% at times. FREE! Go There Now!
|
|
|
|
Learn to enable users to both rate existing animations and to combine existing animations into new snippets. This is the third in a series of three tutorials that chronicle the building of a site that enables collaborative discussion and animation building using Domino and OpenLaszlo. FREE! Go There Now!
|
|
|
|
Visit IBM developerWorks to download IBM DB2 Express-C 9.5, a no-charge version of DB2 Express 9 database server. DB2 Express-C offers the same core data server base features as other DB2 Express editions and provides a solid base to build and deploy applications developed using C/C++, Java, .NET, PHP, and other programming languages. FREE! Go There Now!
|
|
|
|
Visit IBM developerWorks to download the latest trial version of IBM Data Studio V1.1 at no cost. IBM Data Studio is a comprehensive data management solution that helps you effectively design, develop, deploy and manage your data, databases, and database applications throughout the data management life cycle utilizing a consistent and integrated user interface. Unlike other client-side data management solutions that focus on only one aspect of the application lifecycle or database administration, Data Studio complements the Rational Software Delivery platform, providing unparalleled flexibility for a heterogeneous data server environment across platforms. FREE! Go There Now!
|
|
|
|
As systems increase in complexity, communication between systems and software teams becomes more and more difficult. Now, there’s a way to improve product quality and communication.<br />Read the “Model Driven Systems Development” white paper to see how. Also included in this kit are more educational white papers, customer examples, tutorials, informative Webcasts, and best practices for designing, building and managing systems.<br /> FREE! Go There Now!
|
|
|
|
Learn the basics of the IBM Customer Information Control System (CICS). With a hands-on exercise, learn how to get your first CICS application up and running on your desktop using TXSeries V6.1 for Windows. The tutorial shows you how to download and install a free trial version of TXSeries V6.1. FREE! Go There Now!
|
|
|
|
This whitepaper provides areas to consider when evaluating any software configuration management solution. It addresses how the IBM solutions (Rational ClearCase and Rational ClearQuest) meet the needs and requirements of both project leaders and developers to provide successful Software Change and Configuration Management. FREE! Go There Now!
|
|
|
|
Get a free trial download of the latest version of IBM Rational Tester for SOA Quality V7.0.1, a functional and regression testing tool that enables the creation, comprehension, modification and execution of testing GUI-less Web services. FREE! Go There Now!
|
|
|
|
As businesses grow increasingly dependent upon Web applications, these complex entities grow more difficult to secure. Most companies equip their Web sites with firewalls, Secure Sockets Layer (SSL), and network and host security, but the majority of attacks are on applications themselves – and these technologies cannot prevent them. This paper explains what you can do to help protect your organization, and it discusses an approach for improving your organization’s Web application security. FREE! Go There Now!
|
|
|
|
The discipline of assembling and delivering software is maturing beyond standard developer-centric compile/test software builds. The end-to-end software development lifecycle is emerging as the new focus moves “Beyond the Build.” Join this on demand webcast to learn about methods for streamlining software delivery and key capabilities of the IBM Rational Build Forge framework for automating build and release management in environments of any size. FREE! Go There Now!
|
|
|
|
All FREE IBM® developerWorks Tools! |