Go Back   Novahq.net Forum > Computers > Web design and Programming
FAQ Community Calendar Today's Posts Search

Web design and Programming Discuss website creation and other programming topics.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-31-2005, 07:50 PM
Lucky is offline Lucky
Registered User

Join Date: Aug 2004
Posts: 4,705

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;
}
}
?>
__________________

Last edited by Lucky; 05-31-2005 at 08:30 PM.
Reply With Quote
  #2  
Old 05-31-2005, 08:21 PM
IcIshoot is offline IcIshoot

Join Date: Mar 2004
Location: Farmington Hills, MI
Posts: 1,473

Send a message via AIM to IcIshoot Send a message via MSN to IcIshoot Send a message via Yahoo to IcIshoot
what is your problem?

IcI
Reply With Quote
  #3  
Old 05-31-2005, 08:27 PM
Lucky is offline Lucky
Registered User

Join Date: Aug 2004
Posts: 4,705

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
__________________
Reply With Quote
  #4  
Old 05-31-2005, 08:39 PM
DevilDog#1 is offline DevilDog#1

Join Date: Jul 2002
Posts: 7,040

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








Quote:
If I don't do that doesn't mean I can't - DD#1
Reply With Quote
  #5  
Old 05-31-2005, 08:45 PM
IcIshoot is offline IcIshoot

Join Date: Mar 2004
Location: Farmington Hills, MI
Posts: 1,473

Send a message via AIM to IcIshoot Send a message via MSN to IcIshoot Send a message via Yahoo to IcIshoot
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
Reply With Quote
  #6  
Old 05-31-2005, 08:49 PM
Lucky is offline Lucky
Registered User

Join Date: Aug 2004
Posts: 4,705

ok ill just try to get a new host i found out what happened
__________________
Reply With Quote
  #7  
Old 05-31-2005, 09:11 PM
EDGE is offline EDGE
EDGE's Avatar

Join Date: Feb 2003
Location: North Carolina
Posts: 7,184

Send a message via ICQ to EDGE Send a message via AIM to EDGE Send a message via Yahoo to EDGE
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.
__________________
Quote:
Voltaire
It is forbidden to kill; therefore all murderers are punished unless they kill in large numbers and to the sound of trumpets.
Reply With Quote
  #8  
Old 05-31-2005, 09:12 PM
Lucky is offline Lucky
Registered User

Join Date: Aug 2004
Posts: 4,705

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;
}
}
?>
__________________
Reply With Quote
  #9  
Old 05-31-2005, 10:33 PM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,922

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;
    }
}
?>
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 04:56 PM.




Powered by vBulletin®