Dalexhd

checkupdate.php

Oct 25th, 2017
418
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.51 KB | None | 0 0
  1. <?php
  2. include_once 'include/config.php';
  3. include_once 'include/ts3admin.class.php';
  4.  
  5. function checkupdate()
  6. {
  7.     global $query;
  8.     global $config;
  9.  
  10.     $fp = fopen('cache/checkupdate.txt', "r");
  11.     $tekst = fread($fp, 4);
  12.     $installedversion = (int)$tekst;
  13.     fclose($fp);
  14.  
  15.     $strona = getStatus("http://inferno24.eu/update/checkupdate.txt");
  16.     $gitversion = (int)$strona;
  17.  
  18.     if($installedversion != $gitversion)
  19.     {
  20.         $msg = '\n
  21.                [COLOR=#990000][B]
  22.                =================================[ UWAGA ]=================================\n
  23.                                                            Serwer korzysta z przestażałej wersji bota! Zaleca się jego aktualizacja.\n
  24.                                                                                    Najnowszą wersję pobierzesz z [URL=http://inferno24.eu]inferno24.eu[/URL]\n
  25.                =========================================================================
  26.                [/B][/COLOR]';
  27.         $query->sendMessage(3, 1, $msg);
  28.     }
  29.  
  30.     unset($strona);
  31.     unset($query);
  32.     unset($config);
  33. }
  34.  
  35. function getStatus($url)
  36. {
  37.     if(in_array('curl', get_loaded_extensions()))
  38.     {
  39.         $curl = curl_init($url) ;
  40.         curl_setopt( $curl, CURLOPT_URL , $url );
  41.         curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true );
  42.         $source = curl_exec( $curl );
  43.         curl_close( $curl );
  44.     }
  45.     else
  46.     {
  47.         $source = file_get_contents($url);
  48.     }
  49.     return $source;    
  50. }
  51.  
  52. ?>
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment