Tutorial: Creating Dynamic Signature using php

Discussion in 'Web Programming' started by Rshopper, Feb 27, 2007.

Tutorial: Creating Dynamic Signature using php
  1. Unread #1 - Feb 27, 2007 at 4:57 PM
  2. Rshopper
    Joined:
    Jan 21, 2007
    Posts:
    685
    Referrals:
    0
    Sythe Gold:
    0

    Rshopper Apprentice
    Banned

    Tutorial: Creating Dynamic Signature using php

    First, know that you will need a webserver supporting php. Other than that, you need: a [working] brain and a small amount of php knowlege.

    Lets begin.

    Code:
    <?php
     
    ?>
    If you don't know what this does then you need to go brush up on php.

    Code:
    $image = imagecreate(150, 50);
    Create a blank 60x30 image in the server's memory.

    Code:
    $bgColor = imagecolorallocate ($image, 0, 0, 0); 
    Give the image a black (RGB-0,0,0) background.

    Code:
    $textColor = imagecolorallocate ($image, 225, 255, 255); 
    Give the image a cyan foreground color.

    Code:
    $rand = rand(1, 5);
    Generate a random number from 1 to 5. This will be used to select a random message in a second.

    Code:
    switch ($rand) {
    case 1:
       $message = "Another Response #1";
       break;
    case 2:
       $message = "Another Response #2";
       break;
    case 3:
       $message = "Another Response #3";
       break;
    case 4:
       $message = "Another Response #4";
       break;
    case 5:
       $message = "Another Response #5";
       break;
    }
    Generate a message from the random number and place it inside $message.

    Code:
    imagestring ($image, 5, 5, 8, $mesage, $textColor); 
    Write the message to the image using the text color specified earlier.

    Code:
    header("Expires: Mon, 5 Jun 1999 05:00:00 GMT"); 
    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); 
    header("Cache-Control: no-store, no-cache, must-revalidate"); 
    header("Cache-Control: post-check=0, pre-check=0", false); 
    header("Pragma: no-cache"); 
    header('Content-type: image/jpeg');
    Send the appropriate headers to the client.

    Code:
    imagejpeg($image);
    imagedestroy($image);
    Send the image data to the client and then delete it to free up memory on the server.

    This is just the beggining. And your sigs will look pretty crappy with just this code. It is up to you to add bells and whistles to it. Have fun.
     
  3. Unread #2 - Feb 28, 2007 at 12:05 AM
  4. maxisking
    Joined:
    Feb 9, 2007
    Posts:
    109
    Referrals:
    0
    Sythe Gold:
    0

    maxisking Active Member
    Banned

    Tutorial: Creating Dynamic Signature using php

    kool :)
     
  5. Unread #3 - Mar 2, 2007 at 10:49 PM
  6. cp
    Joined:
    Jan 30, 2007
    Posts:
    3,278
    Referrals:
    6
    Sythe Gold:
    0

    cp an cat
    Banned

    Tutorial: Creating Dynamic Signature using php

    Not really that unique. Just do a google for 'php dynamic sig' and you'll get tons of nearly the same thing you're doing. Try something more, unique, kind of, like a matrix kind of thing, or an image verification system, those aren't really done as much as what you did.
     
  7. Unread #4 - Mar 4, 2007 at 9:15 PM
  8. Rshopper
    Joined:
    Jan 21, 2007
    Posts:
    685
    Referrals:
    0
    Sythe Gold:
    0

    Rshopper Apprentice
    Banned

    Tutorial: Creating Dynamic Signature using php

    I was thinking of doing image verification... but that was too common place.
     
  9. Unread #5 - Mar 5, 2007 at 5:02 PM
  10. cp
    Joined:
    Jan 30, 2007
    Posts:
    3,278
    Referrals:
    6
    Sythe Gold:
    0

    cp an cat
    Banned

    Tutorial: Creating Dynamic Signature using php

    how about something that displays the date time, browser info, ip, resolution, color depth; something to that extent, I think most, if not all can be done in php.
     
  11. Unread #6 - Mar 5, 2007 at 9:16 PM
  12. Rshopper
    Joined:
    Jan 21, 2007
    Posts:
    685
    Referrals:
    0
    Sythe Gold:
    0

    Rshopper Apprentice
    Banned

    Tutorial: Creating Dynamic Signature using php

  13. Unread #7 - Mar 8, 2007 at 12:03 AM
  14. dbzalltheway
    Referrals:
    0

    dbzalltheway Guest

    Tutorial: Creating Dynamic Signature using php

    Not exactly what I was expecting... I think I'll post how to get your stats off RS just for the hell of it.
     
  15. Unread #8 - Mar 8, 2007 at 6:36 PM
  16. cp
    Joined:
    Jan 30, 2007
    Posts:
    3,278
    Referrals:
    6
    Sythe Gold:
    0

    cp an cat
    Banned

    Tutorial: Creating Dynamic Signature using php

    Is it possible? Does runescape have some developers kit or something?

    Or is it done through third party apps or something?
     
  17. Unread #9 - Mar 8, 2007 at 6:40 PM
  18. Rshopper
    Joined:
    Jan 21, 2007
    Posts:
    685
    Referrals:
    0
    Sythe Gold:
    0

    Rshopper Apprentice
    Banned

    Tutorial: Creating Dynamic Signature using php

    It's possible. You can leech the stats off the highscores and then parse then into variables with a little regex.

    RuneScape = DK? Dream on lol. Jagex wants to STOP Third party development for their game.
     
< A cool way to freak out your parents!!! | Tester topic [Had problems before do not come here] >

Users viewing this thread
1 guest


 
 
Adblock breaks this site