Link Farm Code
  Home arrow Link Farm Code arrow FreshSoftware Banner Image Rotater
Codewalker Forums 
  Tutorials  
Database Articles  
Miscellaneous  
Navigation Usability  
PEAR Articles  
Programming Basics  
Server Administration  
XML Tutorials  
  Reviews  
Database Book Reviews  
Linux Book Reviews  
Miscellaneous Reviews  
PHP Book Reviews  
PHP Software Reviews  
Server Admin Reviews  
SQL Tool Reviews  
  Code Gallery  
Content Management Code  
Contest Code  
Counters Code  
Database Code  
Date Time Code  
Discussion Board Code  
Email Code  
File Manipulation Code  
GUI Code  
Link Farm Code  
Miscellaneous Code  
Search Code  
Site Navigation Code  
User Management Code  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Download TestComplete 
Forums Sitemap 
Weekly Newsletter 
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
LINK FARM CODE

FreshSoftware Banner Image Rotater
By: Codewalkers
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2004-09-24

    Table of Contents:

    Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    A PHP script that automatically rotates randomally selected banner images.

    By : thebomani

    <?
    /*
    *******************************
    FreshSoftware Banner Image Rotater
    Version: 1.0
    *******************************

    *******************************
    Intention
    *******************************
    This script is a script desigend to display random banner images in
    jpg, gif and png formates. This script can also be modified to display
    any other file type by altering the $image_ext_array array bellow. Notice that
    the ARRAY_RAND function may choose the same file many times before selecting a different file.

    *******************************
    System Requirments.
    *******************************
    1. PHP 4.2.0 or higher.
    2. A Unix based Opertating System.
    3. A Web Server (Apache Perphered).
    4. Executable priviages on your server.
    Even in Safe Mode the PWD command is available
    provided that the executable directory has the same UID
    as this script.

    *******************************
    Author.
    *******************************
    This script was designed by Sulaiman Aleem of FreshSoftware.net. Send questions to
    webmaster@freshsoftware.net

    To watch this script in action visit http://www.freshsoftware.net/images/advertisments/freshsoftware/index.php

    *******************************
    HOW TO INSTALL
    *******************************

    1) Copy this file to a directory that is accessbile by a HTTP server.
    2) Copy banner images to the same directory containg this file.
    3) Use the HEADER, ECHO or FPASSTHRU (recommended)function to display the banner image in a browser window.
    */

    $dir = exec('pwd');

    $open_dir = opendir("$dir");

    //Add or remove files extensions to suit your needs.
    //Notice that the extensions are in upper and lower case.
    $image_ext_array = array(
    "jpg",
    "jpeg",
    "gif",
    "png",

    "JPG",
    "JPEG",
    "GIF",
    "PNG",
    );

    $image_files = array();

    if(!$open_dir){
    die("can not $dir");
    }
    else{
    while(false !== ($file = readdir($open_dir))){

    $ext = explode(".", "$file");

    if(in_array($ext[1], $image_ext_array)){
    $image = "$ext[0]" . "." . "$ext[1]";
    array_push($image_files, $image);
    }

    }

    //If the PHP server is less that 4.2.0 the SRAND function is needed.
    //srand((float) microtime() * 10000000);
    $show_img = array_rand($image_files);

    //Optional: use the HEADER function to prevent the browser from caching the html content and image.
    //This is most use full when using the HEADER function to display the image
    //header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    //header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    //header ("Cache-Control: no-cache, no-store, must-revalidate, private, max-age=0, proxy-revalidate, no-transform");
    //header ("Pragma: no-cache");
    //header("Vary: User-Agents");

    //Edit the image ALT field to suit your needs.
    $image_alt = "FreshSoftware 1-866-343-3343";

    $image_location = $dir . "/" . $image_files[$show_img];

    $image_width = getimagesize($image_location);
    $image_height = getimagesize($image_location);

    //USE the ECHO function to display HTML Code.
    //echo "<img src=\"$image_files[$show_img]\" width=\"$image_width[0]\" height=\"$image_height[1]\" alt=\"$image_alt\">";

    //The HEADER function often times fails to rotate an image when refreshing a browser.
    //header("location: http://freshsoftware-internal.net/images/advertisments/freshsoftware/$image_files[$show_img]");

    //Recommended. These three lines make use of the FPASSTHRUE function.
    $open_image = fopen($image_location, 'rb');
    fpassthru($open_image);
    fclose($open_image);

    closedir($open_dir);
    }
    ?>
    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 Link Farm Code Articles
    More By Codewalkers

     

    IBM® developerWorks developerWorks - FREE Tools!


    Be the first to hear about i5/OS V6R1!

    Hold your calendar on January 30, 2008 for this free webcast on the new i5/OS. Rational's Enterprise Modernization products will be discussed at this webcast as they help to drive the application development environment for this new System i OS. <br />And learn how i5/OS will take you to the next step of efficient, resilient business processing. You will hear about the new i5/OS capabilities as it will be the most significant i5/OS release in years. If you cannot join the webcast on 1/30/08 you can still use this link to listen to the replay.<br />
    FREE! Go There Now!


    NEW! Addressing software-as-a-service challenges using Tivoli security and WebSphere solutions

    Building a software-as-a-service solution requires addressing a few key technical challenges. In this webcast, we'll focus on the role of IBM Tivoli Directory Server and WebSphere Portlet Factory in creating a Software as a Service solution. We will demonstrate how to use Tivoli Directory Server to prevent the user population of one tenant from accessing the virtual portal and portlet components of another tenant. We will also use the dynamic profile capability of WebSphere Portlet Factory to create multiple highly customized applications from one code base.
    FREE! Go There Now!


    NEW! Download a free trial of WebSphere Business Modeler Advanced V6.1.1

    Visit IBM developerWorks to download a free trial version of WebSphere Business Modeler Advanced V6.1.1, IBM’s premier business process modeling and analysis tool for business users that offers process modeling, simulation, and analysis capabilities. IBM WebSphere Business Modeler helps you visualize, understand, and document business processes for continuous improvement.
    FREE! Go There Now!


    NEW! Info 2.0: Harnessing the power of Web 2.0 and Enterprise Mashups

    Listen to this webcast to get an overview of Info 2.0 and a technical demo of how to quickly build an enterprise mashup. IBM's Info 2.0 technology leverages emerging Web 2.0 technologies such as mashups, feeds, AJAX, and JSON in order to simplify assembly of information using feeds and services. Come learn about the technical elements of Info 2.0 including the Feed Generation framework, Mashup Engine, and mashup assembly components. Learn how to pull information from databases, departmental information, and the Web to create mashups critical to your company’s success. We will also discuss best practices to help you get started.
    FREE! Go There Now!


    NEW! Rational Talks to You:Per Kroll on Rational Method Composer Plug-in customization

    Join this Rational Talks to You teleconference on December 11 at 1:00 pm ET to get tips on building your own plugins with Rational Method Composer. Get your questions answered!
    FREE! Go There Now!


    NEW! Run your first CICS application on a PC using TXSeries for Windows

    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!


    NEW! The dirty dozen: preventing common application-level hack attacks

    As organizations have grown increasingly dependent on online software, the risk of malicious attacks has also become far more serious. Fortunately, well-governed organizations can protect their Web applications by injecting vulnerability assessments and ethical hacks into their software development and delivery processes. This paper describes 12 of the most common hacker attacks and provides basic rules that you can follow to help create more hack-resistant Web applications.
    FREE! Go There Now!


    NEW! Try the IBM SOA Sandbox for Connectivity

    Visit IBM developerWorks to try the IBM SOA Sandbox for connectivity. The SOA Sandbox for connectivity provides a trial environment with the tooling and components to help you explore how to effectively connect your infrastructure and integrate all of the people, processes and information in your company. Use the hosted sandbox to explore SOA techniques that streamline connecting existing IT assets together, as well as learn how to connect them to new business logic.
    FREE! Go There Now!


    NEW! Try the IBM SOA Sandbox for Process

    Visit IBM developerWorks to try the IBM SOA Sandbox for process. The SOA Sandbox for process focuses on providing a trial environment with the necessary tooling and components required to gain a better understanding of business processes and how to best improve existing business processes to derive value quickly.
    FREE! Go There Now!


    NEW! Webcast: WebSphere Process Server

    WebSphere Process Server delivers a unique integration framework that simplifies existing IT resources. Often, as IT assets grow to support business demand, so too does their complexity and manageability. In this webcast, we’ll discuss how WebSphere Process Server helps deliver an SOA infrastructure that provides a common model to orchestrate, mediate, connect, map, and execute the underlying IT functions. Discover how WebSphere Process Server simplifies integration of business processes by leveraging existing IT assets as reusable services without the complexities of traditional integration methodologies.
    FREE! Go There Now!



    All FREE IBM® developerWorks Tools!

    LINK FARM CODE ARTICLES

    - FreshSoftware Banner Image Rotater
    - LinkMachine
    - Pagination
    - Ask and Receive version 2.0
    - MyLinks Version 1.1
    - Flexphplink Pro
    - Flexphplink
    - Please remove
    - Simple Outgoing Links/Url Hit Counter
    - PHP-LINKS





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 1 Hosted by Hostway
    Stay green...Green IT