Dalexhd icon

checkupdate.php

Dalexhd | PRO | 10/25/17 08:25:20 AM UTC | 0 ⭐ | 392 👁️ | Never ⏰ | []
PHP |

1.51 KB

|

None

|

0 👍

/

0 👎

<?php
include_once 'include/config.php';
include_once 'include/ts3admin.class.php';
 
function checkupdate()
{
    global $query;
    global $config;
 
    $fp = fopen('cache/checkupdate.txt', "r");
    $tekst = fread($fp, 4);
    $installedversion = (int)$tekst;
    fclose($fp);
 
    $strona = getStatus("http://inferno24.eu/update/checkupdate.txt");
    $gitversion = (int)$strona;
 
    if($installedversion != $gitversion)
    {
        $msg = '\n
                [COLOR=#990000][B]
                =================================[ UWAGA ]=================================\n
                                                            Serwer korzysta z przestażałej wersji bota! Zaleca się jego aktualizacja.\n
                                                                                    Najnowszą wersję pobierzesz z [URL=http://inferno24.eu]inferno24.eu[/URL]\n
                =========================================================================
                [/B][/COLOR]';
        $query->sendMessage(3, 1, $msg);
    }
 
    unset($strona);
    unset($query);
    unset($config);
}
 
function getStatus($url) 
{
    if(in_array('curl', get_loaded_extensions())) 
    {
        $curl = curl_init($url) ;
        curl_setopt( $curl, CURLOPT_URL , $url );
        curl_setopt( $curl, CURLOPT_RETURNTRANSFER, true );
        $source = curl_exec( $curl );
        curl_close( $curl );
    } 
    else 
    {
        $source = file_get_contents($url);
    }
    return $source;     
}
 
?>

Comments

  •  icon
    01/01/70 12:00:00 AM UTC
    Plain Text |

    0 B

    |

    👍

    /

    👎