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

Any Sample Code?

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

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

$today = getdate();
if($today['mday']== 1){
echo 'checking for updates..';
$current_version=file_get_contents( '');
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 */

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.