PDA

View Full Version : PHP Photo Album script v2.11



SAB
10-18-2009, 08:06 PM
1) Script Title: PHP Photo Album script v2.11

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/php-photoalbum.htm

3) Describe problem: Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; Creative AutoUpdate v1.40.01)
Timestamp: Sun, 18 Oct 2009 19:57:22 UTC


Message: 'this.navlinks.1' is null or not an object
Line: 88
Char: 3
Code: 0
URI: http://www.woronline.net/ddphpalbum.js

http://www.woronline.net/Untitled_1.htm
I'm kinda new to php and don't quite understand how I could fix this.
any help would be appreciated.

jscheuer1
10-19-2009, 05:35 AM
There could be other problems. It appears though that there are no image files in your image files folder:

http://www.woronline.net/myimages/

Get a few images in there at least and then see what happens.

SAB
10-19-2009, 06:02 AM
Oh there are pictures in the folder.
pic1 (http://www.woronline.net/myimages/1Blue%20hills.jpg)

pic 2 (http://www.woronline.net/myimages/Winter.jpg)

pic 3 (http://www.woronline.net/myimages/Sunset.jpg)

wish it was that ez....thanks for the help

jscheuer1
10-19-2009, 06:21 AM
I see. OK, well as I said, there appear not to be. I can tell by looking at the server generated contents of your getalbumpics.php?id=Facility file. No images listed. Did you edit that file at all? If not, there is some sort of issue with how your server is interpreting it. In the past I've noticed some servers having an issue with:


$dirname="."

as used in that file, so you could try this:


<?
Header("content-type: application/x-javascript");

function returnimages($dirname="./") {
$pattern="\.(jpg|jpeg|png|gif|bmp)$";
$files = array();
$curimage=0;
if($handle = opendir($dirname)) {
while(false !== ($file = readdir($handle))){
if(eregi($pattern, $file)){
$filedate=date ("M d, Y H:i:s", filemtime($file));
echo " [$curimage, \"$file\", \"$filedate\"],\n";
$curimage++;
}
}
echo " [\"placeholder\"]\n";
closedir($handle);
}
return($files);
}

$photovar=$_GET['id'];
if (!eregi("^[a-zA-Z0-9_]+$", $photovar)){
echo "alert(\"Photo Album ID must contain only letters, numbers, or underscore, and cannot start with a number\")";
die();
}
echo "var $photovar={\n";
echo " baseurl: \"http://" . $_SERVER["SERVER_NAME"] . dirname($_SERVER['PHP_SELF']) . "/\",\n";
echo " images: [\n";
returnimages();
echo " ],\n";
echo " desc: []\n";
echo "}\n";
?>

But it could be some security restriction on the server not allowing a directory and/or files to be listed. Check with your host for more info on that.

SAB
10-20-2009, 03:35 AM
Well I tried the code that you posted and it didn't work.
I will try to contact the server provider and see if they can help me out.

But I am not too sure that may be the issue,I tried uploading those pages to another server and I get a different error (http://cabooseracin.net/Untitled_1.htm)
Again thanks for the help.

jscheuer1
10-20-2009, 04:59 AM
That other server appears to not be PHP enabled.

SAB
10-20-2009, 05:54 AM
Well it may not be totally configured,after all I was the one who installed it.
but I am sure php is working on cabooseracin web. TS_Viewer.php (http://cabooseracin.net/TeamSpeak/TS_Viewer.php)
The woronline web is hosted by godaddy...so they installed the php.

jscheuer1
10-20-2009, 06:11 AM
OK, then perhaps the cabooseracin.net server doesn't allow the:


<?

shortcut at the beginning of the file. For that server, change it to:


<?php

and see what happens. But the error was vague:


Error: invalid XML markup
Source File: http://74.100.20.24:5190/myimages/getalbumpics.php?id=Facility
Line: 2
Source Code:
<?

That's actually line 1, so it may be something else. For instance, the file appears to begin with a BOM, which is not recommended.

Also, and this shouldn't be an issue, but might - you have some odd redirect going on, the links you gave in your last two posts are actually framesets.

And I don't see the css on the cabooseracin.net server.

Also, see:

http://webdesign.ghhutch.com/tech_articles/2006/08/godaddy_php_restrictions.php

for an article on possible restrictions to PHP on godaddy. If the article is correct, that's your problem on that server, though the article seems to imply that they may lift these restrictions on an 'as need' basis. I'll look through the PHP file to see which restricted function(s) it requires.

OK, looks like these are the only ones:

opendir, readdir, closedir

But apparently you can lift all of these restrictions yourself, at least in some cases, see:

http://www.godaddy.com/community/SearchResults.aspx?tab=help&criteria=%2bopendir%2c%2breaddir%2c%2bclosedir&ci=15525

SAB
10-21-2009, 05:13 AM
OK, then perhaps the cabooseracin.net server doesn't allow the:


<?

shortcut at the beginning of the file. For that server, change it to:


<?php

and see what happens. But the error was vague:

Well that code helped a little on the caboose web New Code (http://cabooseracin.net/Untitled_1.htm)....didnt help on the godaddy web.
Now instead of getting the undefined error I get a page that is trying to display the pics but looks like it can't find the file path to pic.

And thanks alot for digging around for that info ...I will read that asap.

jscheuer1
10-21-2009, 06:12 AM
cabooseracin looks good now except you still are missing the css and that there appears to be either a problem due to the port number or some other information of that sort needing to be included in the path. The getalbumpics.php?id=Facility file is working correctly and the script is (as far as I can tell) writing the correct path and filenames to the page's generated HTML.

Perhaps if you add this port number or whatever it is to the getalbumpics.php file for that server only, it may work. To try that, change this line:


echo " baseurl: \"http://" . $_SERVER["SERVER_NAME"] . dirname($_SERVER['PHP_SELF']) . "/\",\n";

to:


echo " baseurl: \"http://74.100.20.24:5190/myimages/\",\n";

On the godaddy site, you will probably have to lift the restrictions on the PHP functions as previously mentioned.

SAB
10-22-2009, 06:44 AM
Well its working fine now on caboose server,just need to get that php fixed on godaddy now.Not sure why the css wouldnt work I had it linked correct,it was in a folder named css.Once I moved it into same folder as Untitled_1.htm (http://cabooseracin.net/Untitled_1.htm) it worked fine.I moved some of my yosemite pics in folder for you.
My gift for your help in making this work for me.
Pics are very high quality so they may take some time to load.
Thanks again for your help.