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! |
<a href="http://zeus.developershed.com/shonuff.php?blackbird=3853&zoneid=442&source=&dest=http%3A%2F%2Fwww.ibm.com%2Fdeveloperworks%2Fspaces%2Fjazz%3FS_TACT%3D105AGY31%26S_CMP%3DDEVSHED&ismap="><img src="http://images.devshed.com/corp/img/news/jazz01.gif" alt="developerWorks Jazz space" align="left"></a>You've heard the buzz about Jazz... want to know more about it from a developer's perspective? Check out the Jazz space on developerWorks. This space is an up-to-date resource for developers, including technical information about Jazz and products built on Jazz, like Rational Team Concert Express. The Jazz space includes content from a wide variety of sources, including links, feeds, and comments from experts. FREE! Go There Now!
|
|
|
|
Join this webcast, to learn how the Rational Process Library can help with compliance issues, drive process improvement, and assist in service-oriented architecture (SOA) or Agile development. We will take a peek into the Rational Process Library with content around software and systems engineering (including RUP), operations and systems management, program and portfolio management, and asset and SOA governance. FREE! Go There Now!
|
|
|
|
Poor Requirements Management capabilities in an Enterprise have been linked to excessive project failures, escalating IT costs, and failure to deliver competitive advantage into the marketplace. Join Brianna M Smith from IBM Rational and learn about how successful organizations align IT and Business stakeholders through collaborative processes and tools for effective requirements management, and how an integrated approach across the IT lifecycle can provide unparalleled visibility and traceability to ensure that project teams are delivering on the business vision by "doing the right things" and "doing things right." FREE! Go There Now!
|
|
|
|
Visit IBM developerWorks to download a free trial version of Lotus Quickr 8.0, which enables collaboration by transforming the way everyday business content such as documents, rich media, photos, and video can be shared. Lotus Quickr makes it faster and easier to share content of all types (not just documents) within virtual teams. It is designed to make it easier to collaborate across organizational boundaries, while continuing to work within the context of familiar desktop applications. FREE! Go There Now!
|
|
|
|
Download a free trial version of IBM Rational Developer for System z, software that can help you deliver core development capabilities; the power of Java Platform, Enterprise Edition (Java EE); and rapid application development support to diverse enterprise application development teams. With comprehensive development tools to help create, deploy and maintain traditional enterprise and composite applications, Rational Developer for System z enables developers with different technical backgrounds to easily participate in important technology projects. FREE! Go There Now!
|
|
|
|
Download the IBM WebSphere Portal V6.1 beta code and learn more about the rich features and enhancements in IBM WebSphere Portal V6.1. WebSphere Portal provides a composite application or business mashup framework and the advanced tooling needed to build flexible, SOA-based solutions, and scalability to meet the needs of any size organization. FREE! Go There Now!
|
|
|
|
Visit IBM developerWorks to download a free trial of the latest release of IBM Lotus Sametime Standard V8.0. Lotus Sametime Standard V8.0 is a platform for unified communications and collaboration that combines security features with an extensible, open solution including integrated Voice over IP, geographic location awareness, mobile clients, and a robust Business Partner community offering telephony and video integration. FREE! Go There Now!
|
|
|
|
Learn how Rational Build Forge can extend a simple compile and package build process by adding customization and deployment capability. Go from a manual method to automating: checking for code changes; getting the latest source; compiling and packaging; customizing; copying to and restarting a deployment server; and sending e-mail notification that a new version is available. FREE! Go There Now!
|
|
|
|
Join this webcast to discover the key requirements for successful change and release management. Learn how to extend your .NET environment to improve productivity and collaboration, and address core problems afflicting team development. In this webcast, we’ll review typical challenges faced by customers and how to resolve them with the IBM Rational Change and Release Management solution, including Rational ClearCase, Rational ClearQuest and Rational Build Forge. Replay is available for 9 months. FREE! Go There Now!
|
|
|
|
Explore how Rational and WebSphere software enable enterprise documentation in SOA environments. Specifically, a new integration between IBM WebSphere® Business Modeler and IBM Rational® Method Composer software can help technical writers more easily keep enterprise operations manuals in sync with changes that are made to business processes, resulting in more accurate and timely documentation that benefits the entire enterprise. FREE! Go There Now!
|
|
|
|
All FREE IBM® developerWorks Tools! |