1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Show your forum signature....

Discussion in 'Offtopic' started by _Lordicon, Dec 24, 2018.

  1. _Lordicon

    _Lordicon MyM Real OG

    Messages:
    752
    Likes Received:
    335
    Local Time:
    6:58 PM
    So I got bored and decided to create a signature unlike most peoples. Some people use images some people use plain text. I got creative and decided to go with some php for a signature. My signature is interactive, this means that the areas on the signature that show the Players Online and Online status of the minecraft/mojang servers change based on whats going on. If MyM has 100 people online it will show this and reflect it. If the minecraft login servers are down or having issues it will show one of three things, Green: Online, Yellow Issues, or Red: Offline. You can refresh your browser too see any changes as people login or out of the servers. I also put my Minecraft character on the right side just for a space fill. Almost forgot, the background image used changes as well between 5 different images.

    [​IMG]
    I figure I will go ahead and post the code that I created in order to get everything to display the way it does as well. It is a bit sloppy but it will give you an idea on what I did to create my signature. Feel free to post your creations as well. Lets see what everyone has, does not matter if it is a .gif, .jpg, .png, plain text, or even code like mine. Display it and show the servers population your creation.

    PHP:
    <?php
    header
    ('Content-type: image/png');

    //Graphics
    $background = array("b1.png","b2.png","b4.png","b4.png","b5.png");
    $rand array_rand($background);
    $image imagecreatefrompng('/home/nighting/public_html/sig.png/'.$background[$rand].'');
    $font1 imagecolorallocate($image2552550); //Yellow
    $font2 imagecolorallocate($image255255255); //White
    $font3 imagecolorallocate($image02550); //Green
    $font4 imagecolorallocate($image25500); //Red

    //Players Online Currently
    $playersonline 'Players';
    imagestring($image33375$playersonline$font1);
    $currentlyonline 'Online';
    imagestring($image33695$currentlyonline$font1);
    $htmlContent file_get_contents("https://mineyourmind.net/analytics/live.php");    
    $DOM = new DOMDocument();
    $DOM->loadHTML($htmlContent);
    $Header $DOM->getElementsByTagName('th');
    $Detail $DOM->getElementsByTagName('td');
    foreach(
    $Header as $NodeHeader)
    {
        
    $aDataTableHeaderHTML[] = trim($NodeHeader->textContent);
    }
    $i 0;
    $j 0;
    foreach(
    $Detail as $sNodeDetail)
    {
        
    $sInner str_replace("<td>"""$sNodeDetail->ownerDocument->saveXML($sNodeDetail));
        
    $sInner str_replace("</td>"""$sInner);
            
        
    $aDataTableDetailHTML[$j][] = trim($sInner);
        
    $i $i 1;
        
    $j $i count($aDataTableHeaderHTML) == $j $j;
    }
    for(
    $i 0$i count($aDataTableDetailHTML); $i++)
    {
        for(
    $j 0$j count($aDataTableHeaderHTML); $j++)
        {
            
    $aTempData[$i][$aDataTableHeaderHTML[$j]] = $aDataTableDetailHTML[$i][$j];
        }
    }
    $aDataTableDetailHTML $aTempData; unset($aTempData);
    $total array_sum(array_column($aDataTableDetailHTML'Players'));
    $players $total.'/512';
    imagestring($image336115$players$font2);

    //Server Status Check, Are the Minecraft servers having issues??
    $json2 file_get_contents('https://status.mojang.com/check');
    $data2 json_decode($json2,true);
    $account $data2[2]['account.mojang.com'];
    $auth $data2[3]['authserver.mojang.com'];
    $session $data2[1]['session.minecraft.net'];
    $mojang $data2[7]['mojang.com'];
    $minecraft $data2[0]['minecraft.net'];
    $accounttext 'Account:';
    $authtext 'Auth:';
    $sessiontext 'Session:';
    $mojangtext 'Mojang.com:';
    $minecrafttext 'Minecraft.net:';
    $online 'Online';
    $issue 'Issues';
    $offline 'Offline';

    //Account Server
    if($account == 'green'){
        
    imagestring($image318554$accounttext$font2);
        
    imagestring($image324554$online$font3);
    }
    if(
    $account == 'yellow'){
        
    imagestring($image318554$accounttext$font2);
        
    imagestring($image324554$issue$font1);
    }
    if(
    $account == 'red'){
        
    imagestring($image318554$accounttext$font2);
        
    imagestring($image324554$offline$font4);
    }
    //Auth Server
    if($auth == 'green'){
        
    imagestring($image318566$authtext$font2);
        
    imagestring($image322366$online$font3);
    }
    if(
    $auth == 'yellow'){
        
    imagestring($image318566$authtext$font2);
        
    imagestring($image322366$issue$font1);
    }
    if(
    $auth == 'red'){
        
    imagestring($image318566$authtext$font2);
        
    imagestring($image322366$offline$font4);
    }
    //Session Server
    if($session == 'green'){
        
    imagestring($image318578$sessiontext$font2);
        
    imagestring($image324578$online$font3);
    }
    if(
    $session == 'yellow'){
        
    imagestring($image318578$sessiontext$font2);
        
    imagestring($image324578$issue$font1);
    }
    if(
    $session == 'red'){
        
    imagestring($image318578$sessiontext$font2);
        
    imagestring($image324578$offline$font4);
    }
    //Mojong.com Website
    if($mojang == 'green'){
        
    imagestring($image318590$mojangtext$font2);
        
    imagestring($image326590$online$font3);
    }
    if(
    $mojang == 'yellow'){
        
    imagestring($image318590$mojangtext$font2);
        
    imagestring($image326590$issue$font1);
    }
    if(
    $mojang == 'red'){
        
    imagestring($image318590$mojangtext$font2);
        
    imagestring($image326590$offline$font4);
    }
    //Minecraft.net Website
    if($minecraft == 'green'){
        
    imagestring($image3185102$minecrafttext$font2);
        
    imagestring($image3286102$online$font3);
    }
    if(
    $minecraft == 'yellow'){
        
    imagestring($image3185102$minecrafttext$font2);
        
    imagestring($image3286102$issue$font1);
    }
    if(
    $minecraft == 'red'){
        
    imagestring($image3185102$minecrafttext$font2);
        
    imagestring($image3286102$offline$font4);
    }

    //Display the final image
    imagepng($image);
    imagedestroy($image);
    ?>
    The way it is all displayed is very simple. I created a subdirectory on my webserver called sig.png inside is the index.php file that holds this code so when I add the signature to the forums it is added using the joshuanightingale.com/sig.png link. So the forums end up reading the php file within it causing the image to display. If you visit joshuanightingale.com/sig.png/index.php you will get the exact same result.
     
    Last edited: Dec 24, 2018
    _Pandoro, coolgi3000 and Aidoneus like this.

Share This Page