|
-
Jun 17th, 2011, 10:51 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] Check Text File For Latest Version ?
Im looking for what I thought was a simple function, a script to define a number, lets say 100
I then want it to check a text file, if the text file has 100 in it , it displays "You have latest version" , If the textfile has 101 in it, it displays "Update available"
Hope you guys understand. Looking forward in seeing your ideas on this one. Cheers
-
Jun 17th, 2011, 11:03 AM
#2
Re: Check Text File For Latest Version ?
this?
PHP Code:
<?php $latestVersion = 100; $installedVersion = file_get_contents("version.txt"); if($latestVersion <= (int) $installedVersion ){ echo "You have the latest version"; }else{ echo "There is an update available"; } ?>
-
Jun 17th, 2011, 11:16 AM
#3
Thread Starter
Fanatic Member
Re: Check Text File For Latest Version ?
Ive tried that, but it only displays "You have the latest version" regardless of the contents of the textfile ?
-
Jun 17th, 2011, 11:37 AM
#4
Re: Check Text File For Latest Version ?
I understood your post as saying that the latest version is the number in the text file; if that's correct, then you just need to swap kows' variables:
PHP Code:
<?php $installedVersion = 100; $latestVersion = file_get_contents("version.txt"); if((int) $latestVersion <= $installedVersion){ echo "You have the latest version"; }else{ echo "There is an update available"; } ?>
-
Jun 17th, 2011, 11:57 AM
#5
Thread Starter
Fanatic Member
Re: Check Text File For Latest Version ?
Fantastic, thats what im looking for. Thanks guys
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|