Novahq.net Forum

Novahq.net Forum (https://novahq.net/forum/index.php)
-   Web design and Programming (https://novahq.net/forum/forumdisplay.php?f=32)
-   -   help (https://novahq.net/forum/showthread.php?t=26290)

Lucky 05-31-2005 07:50 PM

help
 
yeah, i need help wit the sig rotator, cause this is php i guess i shoulda put it
in here

<?php

if ($dir = opendir("/newfolder"))
{
$list = buildimagearray($dir);
displayrandomimage($list);
}

{
while (false !== ($file = readdir($dir)))
{
if (!is_dir($file) && getimagesize($file))
{
$list[] = $file;
}
}
return $list;
}


{
srand ((double) microtime() * 10000000);
$sig = array_rand ($list);

$size = getimagesize ($list[$sig]);
$fp = fopen($list[$sig], "rb");

if ($size && $fp)
{
header("Content-type: {$size['mime']}");
fpassthru($fp);
exit;
}
}
?>

IcIshoot 05-31-2005 08:21 PM

what is your problem?

IcI

Lucky 05-31-2005 08:27 PM

this code is actually in my sig right now
[/code][i mg]http://livings.i8.com/newfolder/index.php[/img][/code]
The images dont show up

DevilDog#1 05-31-2005 08:39 PM

Need more info that that bud. If you get any errors what's it??

IcIshoot 05-31-2005 08:45 PM

I just tried it and got this message: "Forbidden
Remote Host: [***.***.***.***]

You do not have permission to access http://livings.i8.com/newfolder/index.php

Data files must be stored on the same site they are linked from.

Thank you for using 50megs".

Try pasting your url in IE and see what happens...

IcI

Lucky 05-31-2005 08:49 PM

ok ill just try to get a new host i found out what happened

EDGE 05-31-2005 09:11 PM

PHP Code:

<?php

if ($dir opendir("/newfolder"))
{
$list buildimagearray($dir);
displayrandomimage($list);
}

{
while (
false !== ($file readdir($dir)))
{
if (!
is_dir($file) && getimagesize($file))
{
$list[] = $file;
}
}
return 
$list;
}


{
srand ((double) microtime() * 10000000);
$sig array_rand ($list);

$size getimagesize ($list[$sig]);
$fp fopen($list[$sig], "rb");

if (
$size && $fp)
{
header("Content-type: {$size['mime']}");
fpassthru($fp);
exit;
}
}
?>

Where it says
PHP Code:

if ($dir opendir("/newfolder")) 

, you need to change the "/newfolder" to the folder name you have uploaded to your host. So instead of it being "/newfolder", you name it something like "/randomphp". This has nothing to do with your host, you just need FTP access to do it.

Lucky 05-31-2005 09:12 PM

ok i got another host and it still isnt working here is the php
and edge-that was the folder i had it in :)

<?php

if ($dir = opendir("."))
{
$list = buildimagearray($dir);
displayrandomimage($list);
}

{
while (false !== ($file = readdir($dir)))
{
if (!is_dir($file) && getimagesize($file))
{
$list[] = $file;
}
}
return $list;
}

{
srand ((double) microtime() * 10000000);
$sig = array_rand ($list);

$size = getimagesize ($list[$sig]);
$fp = fopen($list[$sig], "rb");

if ($size && $fp)
{
header("Content-type: {$size['mime']}");
fpassthru($fp);
exit;
}
}
?>

Scott 05-31-2005 10:33 PM

Heres my version..
PHP Code:

<?
$files_array=array("jpg","gif","png");
$path="./img/logo/";


function get_ext($key) { 
    $key=strtolower(substr(strrchr($key, "."), 1));
    return(str_replace("jpeg", "jpg", $key)); 
}



$dir=opendir($path);
while (false !== ($file = readdir($dir))) {

    If(($file!=".") AND ($file!="..") AND (!is_dir($file)) AND (in_array(get_ext($file),$files_array))) {
        $files[]=$file;
    }

}

closedir($dir);
shuffle($files);
$sig=$files[0];
$size=getimagesize($path.$sig);

If($size) {

    $fp=fopen($path.$sig, "rb");

    If($fp) {
        header("Content-type: ".$size['mime']);
        fpassthru($fp);
        fclose($fp);
        exit;
    }
}
?>



All times are GMT -5. The time now is 11:42 AM.

Powered by vBulletin®