954,561 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

"Chech for new Version" like in paid scripts feature

Can someone help me on making a function that can check for new version of my script!

Any Sample Code?

smartness
Junior Poster
103 posts since Aug 2007
Reputation Points: 7
Solved Threads: 14
 

if the script is on your server, its the new version as soon as you upload it.

for a script used by somebody else[INDENT]code the version number into the script as a variable[/INDENT] $version=2.01; [INDENT]make a folder on your site accessible to outside scripts [/INDENT]example version [INDENT]put a file in it[/INDENT]example current_version.txt [INDENT]contents only the current version number [/INDENT]example 3.01 [INDENT]in your script
do something like[/INDENT]

$version=2.01;
$today = getdate();
if($today['mday']== 1){
echo 'checking for updates..';
$current_version=file_get_contents( 'http://www.mysite.com/version/current_version.txt');
If($current_version > $version) {
echo 'There is a newer version of this script available, please update at'; /* whatever */
}
elseif($current_version < $version) {
echo ' You are running a beta script, are you sure? Restore the latest stable version at'; /* whatever */
}
else {
echo 'You are running the current version';
}
}


/* all sorts of script code,
this code scrap can be in your admin page,
attached to a button,
you can have your install script code the mday of the installation into the script so it checks on the montly anniversary,
stagger out your server loads so as not to tie up the first of the month so much, whatever */

almostbob
Posting Sensei
3,149 posts since Jan 2009
Reputation Points: 571
Solved Threads: 376
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You