Rotating banner script/randomship.php

From 118Wiki
< Rotating banner script
Revision as of 17:51, 30 October 2005 by FltAdml. Wolf (talk | contribs) (Creation)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
<?php
function randomImage($ini) {

    $images = @parse_ini_file($ini,true);

    if (! $images) {
        die('Error reading INI file.');
    }

    $img = array_rand($images);
    $size = @getimagesize($images[$img]['src']);

    if ($images[$img]['url']) {
        printf ('<a style="border:none" target="_blank" href="%s" title="%s">',
            $images[$img]['url'],
            $images[$img]['title']);
    }

    printf('<img src="%s" alt="%s" width="%s"
            height="%s" border="0" />',
            $images[$img]['src'],
            $images[$img]['alt'],
            $size[0],
            $size[1]);

    if ($images[$img]['url']) {
        print '</a>';
    }
}
php?>