+ Reply to Thread
Page 1 of 6 123 ... LastLast
Results 1 to 10 of 60

Thread: How I Made My Signature

  1. #1
    Bryon is offline Administrator Bryon has disabled reputation
    Join Date
    Apr 2005
    Location
    Northfield, NH
    Posts
    7,608

    How I Made My Signature

    A bunch of people have been asking me how I made my sig. Here is the PHP source of it:

    Index.php:

    PHP Code:

    <?php

    include('functionsVariables.inc.php');


    ############################################
    ## Set variables for the Winamp song file ##
    ############################################

       
    $song $_GET['song'];
       
    $filename 'winamp.txt'
       
    $maxchar 50
       
    $mtime filemtime($filename);
       
    $timestamp time();
       
    $timeout $timestamp 480;

    ###################################################
    ## Check if a song hasn't been played in a while ##
    ###################################################

       
    if ($mtime $timeout) {
          if (@
    implode('',@file($filename)) != "Winamp is currently turned off.") {
             
    $handle fopen($filename'w');
             
    fwrite($handle"Winamp is currently off.");
             
    fclose($handle);
          }
       }

    ############################################################################
    ## The Winamp info sender sends the song to:                              ##
    ##   nedren.com/signature/?hiddensongnameinurl=[B]Song Name Here[/B]      ##
    ## This script then records it in a file if that GET['value'] is present. ##
    ############################################################################

       
    if(isset($_GET['hiddensongnameinurl'])) { 

          
    $playsHandle fopen('songPlays.txt'"r");
          
    $songPlays fread($playsHandlefilesize('songPlays.txt'));
          
    fclose($playsHandle);

          
    $songPlays++;

          
    $playsHandle fopen('songPlays.txt'"w");
          
    fwrite($playsHandle$songPlays);
          @
    fclose($playsHande);

          if(
    is_writable($filename)) { 
             if(!
    $handle fopen($filename'w')) { 
                echo 
    '<b>Error:</b> Cannot write to file Winamp text file.'
                die();
             } 
             if(!
    fwrite($handlestripslashes($song))) { 
                echo 
    '<b>Error:</b> Cannot write to file Winamp text file.'
                die();
             } 
             
    fclose($handle); 
          }

    #############################################
    ## Else if song is not being sent/recorded ##
    #############################################
       
    } else {

    ########################################
    ## Get the number of total song plays ##
    ########################################

          
    $playsHandle fopen('songPlays.txt'"r");
          
    $songPlays fread($playsHandlefilesize('songPlays.txt'));
          
    fclose($playsHandle);

    ##############################################
    ## Load the server's uptime and load values ##
    ##############################################

       
    $loadHandle fopen('load.txt'"r");
       
    $serverLoad fread($loadHandlefilesize('load.txt'));
       if (!
    $serverLoad) {
          
    $serverLoad '[Down]';
       } else {
          
    fclose($loadHandle);
       }
       
       
    $uptimeHandle fopen('uptime.txt'"r");
       
    $serverUptime fread($uptimeHandlefilesize('uptime.txt'));
       if (!
    $serverUptime) {
          
    $serverUptime '[Down]';
       } else {
          
    fclose($uptimeHandle);
       }

     
    // Clean up the server's uptime. It's returned in a weird format, so yea.. :-/ 
       
    $serverUptime str_replace(',''-'$serverUptime);
       
    $serverUptime str_replace('  '' '$serverUptime);
       
    $serverUptime str_replace('-'' -'$serverUptime);
       
    // $serverUptime = str_replace('- ', '-', $serverUptime);

    ###########################
    ## Get whatpulse shiet.  ##
    ###########################

          
    $mystats UserStats(119431); // Whatpulse function

    ########################
    ## Make actual image  ##
    ########################

          
    header("Content-type: image/gif");
          
    $image imagecreatetruecolor(425150);
          
    $image2 imagecreatefromgif('imahiddenbgimage.gif');
          
    imagecopy($image$image20000450150);

    ############################
    ## Make colors for image  ##
    ############################

          
    $red imagecolorallocate($image231180180);
          
    $green imagecolorallocate($image180220180);
          
    $white imagecolorallocate($image255255255);

    #############
    ## Borders ##
    #############

    imageline($image114231$white);
    imageline($image1148423148$white);
    imageline($image111149$white);
    imageline($image4231423148$white);

    ##############################################
    ## Create somestrings to be placed on image ##
    ##############################################


          
    $font 'lsans.ttf';
          
    $font2 'lsans.ttf';
          
    $font3 '04B_03B_.TTF';

          
    $mouse number_format($mystats['TotalMouseClicks']);
          
    $keys number_format($mystats['TotalKeyCount']);
          
    $curSong = @implode('',@file($filename));

    #############################
    ## x10Hosting related text ##
    #############################

       
    imagettftext($image706846$white$font"Server Load:");
       
    imagettftext($image7012646$white$font2$serverLoad);

       
    imagettftext($image7016546$white$font"Uptime:");
       
    imagettftext($image7020446$white$font2$serverUptime);

       
    $status serviceStatus(80);
       if (
    $status == 'Online') { $color $green; } else { $color $red; }
       
    imagettftext($image701063$white$font"HTTP Server:");
       
    imagettftext($image707163$color$font2$status);

       
    $status serviceStatus(3306);
       if (
    $status == 'Online') { $color $green; } else { $color $red; }
       
    imagettftext($image701078$white$font"MySQL Server:");
       
    imagettftext($image707578$color$font2$status);

       
    $status serviceStatus(53);
       if (
    $status == 'Online') { $color $green; } else { $color $red; }
       
    imagettftext($image7011063$white$font"DNS Server:");
       
    imagettftext($image7016463$color$font2$status);

       
    $status serviceStatus(110);
       if (
    $status == 'Online') { $color $green; } else { $color $red; }
       
    imagettftext($image7011078$white$font"POP3 Server:");
       
    imagettftext($image7016978$color$font2$status);

       
    $status serviceStatus(22);
       if (
    $status == 'Online') { $color $green; } else { $color $red; }
       
    imagettftext($image7020463$white$font"SSH Server:");
       
    imagettftext($image7025763$color$font2$status);

       
    $status serviceStatus(21);
       if (
    $status == 'Online') { $color $green; } else { $color $red; }
       
    imagettftext($image7020478$white$font"FTP Server:");
       
    imagettftext($image7025778$color$font2$status);

       
    imagettftext($image7030043$white$font3"<= 70.86.136.178");


    ###########################
    ## Personal related text ##
    ###########################

       
    imagettftext($image7055103$white$font"Username:");
       
    imagettftext($image70108103$white$font2"NedreN");

       
    imagettftext($image70155103$white$font"Country:");
       
    imagettftext($image70197103$white$font2"United States");


       
    imagettftext($image7010120$white$font"Key Strokes:");
       
    imagettftext($image7068120$white$font2$keys);

       
    imagettftext($image70129120$white$font"Mouse Clicks:");
       
    imagettftext($image70195120$white$font2$mouse);

       
    imagettftext($image7010136$white$font"Listening To:");
       
    imagettftext($image7071136$white$font2$curSong);

       
    // Random string array comes from included file.
       
    $randSayingKey array_rand($randSayings);
       
    $arrow '<=';
       
    $saying $randSayings[$randSayingKey];
       
    imagettftext($image74529785$white$font3$arrow);

       if (
    $randSayingKey == '0') {
          
    imagettftext($image7030464$white$font3$saying);
       } else {
          
    imagettftext($image7030479$white$font3$saying);
       }

       
    imagettftext($image690420145$white$font3"http://NedreN.com");

    ##############
    ## PHP text ##
    ##############

       // PHP random array comes from included file.
       
    $randKey array_rand($randFunctions);
       
    $phpFunction $randFunctions[$randKey]['Name'];
       
    $phpDescription $randFunctions[$randKey]['Description'];
       
    imagettftext($image60302114$white$font$phpFunction);
       
    imagettftext($image50304122$white$font2$phpDescription);

       
    $php '<= I <3 PHP';
       
    imagettftext($image79040585$white$font3$php);

    #############################
    ## Output image to browser ##
    #############################

          
    imagegif($image);

    ########################################################################################
    ## Destroy image from memory. I don't want to fill up the server's ram, now do I? ;-) ##
    ########################################################################################

          
    imagedestroy($image);
          
    imagedestroy($image2);
       }
    ?>

    [The second half is in the next post.]
    Last edited by Bryon; 01-10-2006 at 02:45 PM.

  2. #2
    Bryon is offline Administrator Bryon has disabled reputation
    Join Date
    Apr 2005
    Location
    Northfield, NH
    Posts
    7,608

    Re: How I Made My Signature

    FunctionsVariables.inc.php:

    PHP Code:

    <?php

    function serviceStatus($port) {
       
    $handle = @fsockopen('70.86.136.178'$port$errno$errstr30);
       if (!
    $handle) {
          
    $string 'Down';
       } else {
          
    $string 'Online';
          @
    fclose($handle);
       }
       return 
    $string;
    }


    function 
    UserStats($userid) {
      
    $WhatPulseStats = array();
      
    $stat_types = array("UserID""AccountName""Country",
          
    "DateJoined""Homepage""LastPulse"
          
    "Pulses""TotalKeyCount""TotalMouseClicks",
          
    "AvKeysPerPulse""AvClicksPerPulse"
          
    "AvKPS""AvCPS""Rank""TeamID"
          
    "TeamName""TeamMembers""TeamKeys"
          
    "TeamClicks""TeamDescription"
          
    "TeamDateFormed""RankInTeam""GeneratedTime");
         
    $data = @implode(""file("http://whatpulse.org/api/users/".$userid.".xml"));
         
    $parser xml_parser_create();
         
    xml_parser_set_option($parserXML_OPTION_CASE_FOLDING0);
         
    xml_parser_set_option($parserXML_OPTION_SKIP_WHITE1);
         
    xml_parse_into_struct($parser$data$values$tags);
         
    xml_parser_free($parser);
         

         foreach (
    $tags as $key => $val
             {
             if (
    $key == "UserStats"
                 {
                 
    $ranges $val;
                 for (
    $i 0$i count($ranges); $i += 2
                 {
            
    $offset $ranges[$i] + 1;
            
    $len $ranges[$i 1] - $offset;
            
    $statsarray array_slice($values$offset$len);
            foreach(
    $statsarray as $key => $value)
          {
          for(
    $i 0$i count($stat_types); $i++)
          {
              if(
    $value['tag'] == $stat_types[$i]) 
          {
            
    $type $stat_types[$i];
            
    $WhatPulseStats[$type] = $value['value'];
          }
          } 
          } 
          } 
          } else {
          continue;
          }
          } 
      
      return 
    $WhatPulseStats;
    }


    // I edited out the random function array and the random string arrays.

    $randFunctions = array('Moo');
    $randSayings = array('Moo');

    ?>
    Well there ya go. I'm not going to explain it all, and it's kinda messy. A bunch of people asked how I made it, so there ya go. I figured I would just post the source in here.

    Also, could you "rate" my sig? (1 through 10, whatever you people usually do in here.)


    :sleep2:

  3. #3
    Alejandro's Avatar
    Alejandro is offline Account Manager Alejandro is an unknown quantity at this point
    Join Date
    Jul 2005
    Location
    Puebla, México
    Posts
    4,719

    Re: How I Made My Signature

    Great, I'm gonna try to understand this. Thanks! BTW, I give your sig a well deserved 10!! ;)
    ╔═══════════════════════════════════╗
    Alejandro
    Account Management and Developement
    ╚═══════════════════════════════════╝




  4. #4
    TarinC is offline x10 Lieutenant TarinC is an unknown quantity at this point
    Join Date
    Sep 2005
    Location
    Toronto, Canada
    Posts
    349

    Re: How I Made My Signature

    wow... thats amazing... 10

  5. #5
    Brandon Guest

    Re: How I Made My Signature

    Can you show us the image?

  6. #6
    mattspec's Avatar
    mattspec is offline x10 Elder mattspec is an unknown quantity at this point
    Join Date
    Aug 2005
    Location
    Kitchener, Ontario, Canada
    Posts
    693

    Re: How I Made My Signature

    thats phenom, is there a way to make a windows media player stat though?




  7. #7
    Bryon is offline Administrator Bryon has disabled reputation
    Join Date
    Apr 2005
    Location
    Northfield, NH
    Posts
    7,608

    Re: How I Made My Signature

    Not sure. I have a winamp plugin that sends the song to the URL every time you play a new song. I don't know abotu windows media player though.

    "Can you show us the image?"

    Find it. ;-)

    I couldn't do everything with PHP though because of the transparacy and crap, which sucks, but whatever. :-/

  8. #8
    SEÑOR's Avatar
    SEÑOR is offline The Guy Everyone Hates SEÑOR is an unknown quantity at this point
    Join Date
    Nov 2005
    Location
    Toronto
    Posts
    2,319

    Re: How I Made My Signature

    10/10 bravo

    Youtube Channel | Website

    // SEÑOR BERNS //

  9. #9
    dharmil's Avatar
    dharmil is offline x10 Elder dharmil is an unknown quantity at this point
    Join Date
    Sep 2005
    Location
    Avenel New Jersey
    Posts
    828

    Re: How I Made My Signature

    NedreN you know 2 much

    how did you learn all this php

  10. #10
    Bryon is offline Administrator Bryon has disabled reputation
    Join Date
    Apr 2005
    Location
    Northfield, NH
    Posts
    7,608

    Re: How I Made My Signature

    I do have much to do in the "winter months". ;-) So yea.. I sit around a lot and work on PHP stuff.

    I started in 2003 with PHP, and here I am nowww.

+ Reply to Thread
Page 1 of 6 123 ... LastLast

Similar Threads

  1. Some Signature
    By Mind-Designers in forum Graphics & Webdesign
    Replies: 4
    Last Post: 10-31-2006, 09:25 PM
  2. [OFF] Rent out Signature Space!
    By ikki() in forum The Marketplace
    Replies: 3
    Last Post: 10-04-2006, 04:18 PM
  3. Custom Signature from GPX Graphix
    By SFLRemy in forum The Marketplace
    Replies: 3
    Last Post: 02-25-2006, 12:21 PM
  4. Custom Signature
    By Nekaid in forum Graphics & Webdesign
    Replies: 2
    Last Post: 08-21-2005, 01:26 AM
  5. Latest signature I made
    By repusmod in forum Graphics & Webdesign
    Replies: 6
    Last Post: 04-20-2005, 01:17 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers