php fopen issues: Can't use block-random.php anymore

Cahir

Joined: 2005-04-22
Posts: 11
Posted: Fri, 2005-04-22 23:51

Well, my random block was working perfectly for years until my webhost decided to disable the "allow_url_fopen". I can't use this in my albums.php file anymore:

<? include ("http://www.domain.com/gallery/block-random.php")?>

What else can I do to get this working again?

 
fryfrog

Joined: 2002-10-30
Posts: 3236
Posted: Sat, 2005-04-23 00:30

You might be able to use the full system path to the file instead. If you do that and have a current version of block-random, you may find you need to remove anything that might be deemed "header info" like <body> and <html> maybe?

I could be wrong about that, but give it a shot. You could always ask em to enable url open... or move hosts :)

 
Cahir

Joined: 2005-04-22
Posts: 11
Posted: Sat, 2005-04-23 15:46

Thanks, the webhost did this for security reasons, so I don't think they'll be enabling it again anytime soon :( They suggested using the path as well, but when I do that, I get the following error:

"Fatal error: Cannot redeclare editfield() (previously declared in /home/.danza/ewaldchen/waldchen/gallery/util.php:27)"

I'm taking a look at util.php right now, but I'm no PHP coder, so any tips you have are greatly appreciated.

 
Cahir

Joined: 2005-04-22
Posts: 11
Posted: Sat, 2005-04-23 16:26

Just a brief follow-up: I've spent some time searching the boards for anyone else having this error. I noticed a couple times that it's been said it can only be called via http and not from the file location. I really hope there's a work around, because I'd hate to lose these handy scripts. I came across the suggestion to use require_once and include_once, and I've tried playing around with them, but I'm not exactly sure what I need to be changing (albums.php, util.php or init.php)

 
signe
signe's picture

Joined: 2003-07-27
Posts: 2322
Posted: Sat, 2005-04-23 19:58

It will work, but only under one condition.

The random block can never appear on the same page as Gallery. If you can do that, then you can use it via file... if you can't do that, then you can't run the random block.

 
Trizzle

Joined: 2004-07-12
Posts: 12
Posted: Tue, 2005-04-26 06:03
Quote:
you can use it via file

Can you please dumb that down for me? I pretty much have no clue what that means, but i don't have gallery on the same page as the random image block.

I'm having the same problem as the original poster. I just noticed that my random image is gone from my postnuke homepage. I'm hosted by dreamhost and they also disabled that ability. I have a pretty loose grasp on all this stuff, i'm learning as much as i can but i only have so much spare time :)

 
signe
signe's picture

Joined: 2003-07-27
Posts: 2322
Posted: Tue, 2005-04-26 06:18

via file = "/home/youruser/gallery/block-random.php" instead of "http://..."

If you're using it in postnuke, then it will probably show up on the same pages as Gallery unless they have added the ability to restrict which pages blocks show on.

 
Trizzle

Joined: 2004-07-12
Posts: 12
Posted: Tue, 2005-04-26 06:47

My gallery is not integrated into my postnuke site.

So you're saying that in the portion of my postnuke sight where i use the include command to call block-random.php from my gallery directory, use the file path rather than the http path?

So i did that, like so "include('../../gallery/block-random.php');" but it didnt work, so then i thought maybe i had the wrong slashes which was causing it to not work, but that wasn't it.

Or am i going about this all wrong. Is there anything i need to change in the block-random.php file? I didn't find "http" in that file anywhere except in comments regions so i'm assuming i don't need to modify it.

Thanks for your help, any idea what i'm doing wrong?

Oh, one other thing, i also recently upgraded gallery from 1.4.4 to 1.5. That change and the disabling of fopen happened around the same time and i didn't notice that the random block was gone until after both those changes. So i'm not sure which caused it but the existence of this thread leads me to believe it was the disabling of fopen.

 
Trizzle

Joined: 2004-07-12
Posts: 12
Posted: Tue, 2005-04-26 06:52

Ah, nevermind, i got it. I changed the directory syntax and got it going, went from home/username/blah blah like you said instead of trying to use a relative path. It's all good now, thanks for your help! :)

 
Cahir

Joined: 2005-04-22
Posts: 11
Posted: Wed, 2005-04-27 14:50

Just to follow up a little more...like signe said, I wasn't able to put the block directly into Gallery (such as inside the albums.php file). What I did to work around this was to create a small php file called "random.php" with the appropriate code for block-random.php, then I embedded that file into albums.php via an IFRAME. It's not the prettiest, but it gets the random block on the front page of my Gallery which was important. (lastXupdates.php works this way, too.) Hope that helps anyone else who's been screwed by Dreamhost's tinkering with PHP.