PDA

View Full Version : [HDI] Set Up My Custom Field to check if the value is proper.


ibeblunt
02-27-2002, 06:45 PM
Recently, I added a tiny hack to my site for the avatars.

Basically, I don't allow people to upload avatars to my site anymore. So I created a custom field and the user has to type the URL of the avatar that he wants to use.

However, there is one problem for about 50% of the users. There are some users who copy their hard drive path and some users who use a path that doesn't work.

I know in php I would use file_exists($userinfo[field8]) to check for the existance of an image but when I tried that it didn't appear to working.

How can I check that $post[field8] contains a working path?

Here is the hack:

admin/functions.php

Inserted around line # 181:

if ($post[field8]) {
$post[field8] = "<img width=\"50\" height=\"50\" src=\"" . $post[field8] . "\" border=\"0\">";
}

Any suggestions?

Admin
02-28-2002, 09:59 AM
file_exists() does not work on remote files, so you can't use that. Try using file() with implode() instead.