There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
access audio avg avg 8 bios blue screen boot bsod computer connection cpu crash css dell desktop dma driver drivers dvd email error excel explorer firefox firefox 3 freeze gimp graphics hard drive hardware hijackthis hjt install internet internet explorer itunes keyboard laptop macro malware monitor motherboard network networking outlook outlook 2003 outlook 2007 outlook express pio problem problems router seo server slow sound sp3 spyware trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless
Web Design & Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
Files on an external server


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
Big-K's Avatar
Distinguished Member with 6,883 posts.
 
Join Date: Nov 2003
Location: Kansas
Experience: Advanced
22-Nov-2006, 10:16 PM #1
Files on an external server
My current attempt is to create a script that searches for updates for the webapp it works with(php). The method I thought up is to have a 'version' field in the database, and a text file with the number of the latest version on my own server(the app will be on a different server), and to compare the two. If the two aren't the same then it shows a link to update. As of now, this is what I have.

Code:
$get_updates = mysql_query("SELECT * FROM modules WHERE flag='1' ORDER BY id ASC");
while($row2 = mysql_fetch_array($get_updates))
{
$loc = ****;
if(is_link($loc))
{
$string = fopen($loc, 'r');
$data = fread($string,10);
if($data != $row2['version'])
echo "<a href=\"update.php?s=".$row2['location']."\">Update Available For ".$row2['name']."</a><br />";
}
}
I've tried this with file_exists, i've tried it with is_link, I don't know what else to try. $loc is the correct filepath, and the file reading works fine with that path. For some reason its only the part asking if it actually exists thats causing problems. This part honestly isn't extremely important, but it will be a good failsafe if i can get it working.
brendandonhu's Avatar
Distinguished Member with 15,988 posts.
 
Join Date: Jul 2002
Location: Ann Arbor, MI
Experience: Advanced
23-Nov-2006, 02:58 AM #2
is_link() tests whether the file is a symbolic link and file_exists() checks if a local file exists.

If you're trying to check if a remote file exists, just test whether fopen() returns true or false.

You could make this code a bit shorter with file_get_contents() by the way.
Big-K's Avatar
Distinguished Member with 6,883 posts.
 
Join Date: Nov 2003
Location: Kansas
Experience: Advanced
23-Nov-2006, 12:14 PM #3
ah, i got it now. thanks man
brendandonhu's Avatar
Distinguished Member with 15,988 posts.
 
Join Date: Jul 2002
Location: Ann Arbor, MI
Experience: Advanced
23-Nov-2006, 12:20 PM #4
yourewelcome
Reply


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

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
Trackbacks are On
Pingbacks are Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 02:29 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.