Location: PHPKode > projects > PHPFreeNews > phpfn/Inc/VersionCheck.php
<?php

/*	+--------------------------------------------------------------
	| PHPFreeNews - News Headlines on your website                |
	| Developed by Jim Willsher.                                  |
	| http://www.phpfreenews.co.uk                                |
	+-------------------------------------------------------------+
*/

if (! defined('IN_PHPFN'))
	die('Illegal attempt to access script directly!');

CheckAuthority();

if ($OnlineVersionCheck != 1)
	die("Sorry, Online Version Checking is disabled");

// Display the heading
DisplayGroupHeading('Online Version Check');

?>
<table align="center" border="0" width="500">
	<tr>
		<td>
			<br />
		</td>
	</tr>
	<tr>
		<td>
			Your Script is Version: <?= $ScriptVersion?>
		</td>
	</tr>

	<tr>
		<td>
			<?php

			// Find the latest version
			$LatestVersion = GetLatestVersionNumber();

			// If an array was returned then we have the info we need. If a number was returned then we encountered a problem
			if (is_array($LatestVersion))
			{
				$LatestLiveVersion = trim($LatestVersion[0]);
				$LatestBetaVersion = trim($LatestVersion[1]);

				// Is there a later LIVE version available?
				if ($LatestLiveVersion > $ScriptVersion)
				{
					?><br /><b>Version <?=$LatestLiveVersion?> is available. It is recommended that you upgrade.</b><?php
				}

				// Is there a later BETA version available?
				if ($LatestBetaVersion > $ScriptVersion)
				{
					?><br /><b>Beta Version <?=$LatestBetaVersion?> is available. This is a BETA release, and as such it may or may not be stable. Install at your own risk.<?php
				}

				// Using the latest version?
				if ( ($ScriptVersion >= $LatestLiveVersion) && ($ScriptVersion >= $LatestBetaVersion) )
				{
					?><br />You would appear to be running the latest version, no action is necessary.<?php
				}
			}
			elseif ($LatestVersion == -1)
			{
				?><b>Unable to connect to www.phpfreenews.co.uk to check for the latest version.</b><?php
			}
			elseif ($LatestVersion == -2)
			{
				?><b>Your server configuration prevents the use of Sockets to check for the latest version.</b><?php
			}
			else
			{
				?><b>Unknown return-code received!</b><?php
			}
			?>
		</td>
	</tr>

	<tr>
		<td>
			<br /><br /><center>Visit the <a href="http://www.phpfreenews.co.uk/Download.php" target="_blank">PHPFreeNews</a> website.</center>			
		</td>
	</tr>	
</table>
Return current item: PHPFreeNews