Jump to content

barrytone

Active Members
  • Posts

    191
  • Joined

  • Last visited

Posts posted by barrytone

  1. So, if you were to use this on a message board, you'd put that link in the spot for your avatar, correct?

    Correct :)

    Most forums check the file extension of the avatar you're linking to though. So you'll have to make sure the server you're running the script on has a handler set to parse the file as PHP. so in my case I have one set as:

    .php.jpg       application/x-httpd-php

    And then save the script as something like avatar.php.jpg

    A lot of web hosts let you add your own apache handlers. So you don't always need your own server use the script. Just a hosting account with a reasonable amount of features.

  2. Thanks anyedie :)

    Shouldn't you output the content type header? Firefox figures it out because it's in an img element, but if you go directly to the image in your browser it shows it as text. I bet some browsers might get confused and not show the image properly.

    Good idea! I've edited the code a little... Here's version 0.3 :P

    <?php
    
    //Random Avatar 0.3 - SBT 2006
    
    
    
        //Image types to use in CSV list
    
        $imgtypes = "jpg,gif,png";
    
    
    
        //Pull apart image types string
    
        $imgtypes = explode(",", $imgtypes);
    
        
    
        //Start the pattern string
    
        $imgpattern = "(.+.";
    
    
    
        //Put img types into pattern string
    
        $imgpattern .= implode(")|(.+.", $imgtypes);
    
    
    
        //End the pattern string
    
        $imgpattern .= ")";
    
    
    
        //Open the current dir
    
        $thisdir = opendir(".");
    
    
    
        //Create array for image file names
    
        $images = array();
    
    
    
        //Read the contents of the dir 
    
        while($fn = readdir($thisdir)) { 
    
    
    
            //Check for images. Add images to $images array
    
            if (filetype($fn) == "file") { 
    
    
    
                if (eregi($imgpattern, $fn)) {
    
                    
    
                    //Get filename of this script
    
                        $thisfn = explode("/", $_SERVER[SCRIPT_NAME]);
    
                    $thisfn = $thisfn[count($thisfn) - 1];
    
    
    
                    //Check img is not this file
    
                    if($fn != $thisfn) {
    
                        $images[] = $fn;
    
                    }
    
                } 
    
            }
    
        }
    
    
    
        //Get amount of images in dir, minus 1.
    
        $nimages = count($images);
    
        $nimages = $nimages - 1;
    
    
    
        //Pick Random image
    
        $rimage = rand(0, $nimages);
    
    
    
        //Get the file type
    
        list($filename, $extension) = split(".", $fn);
    
        
    
        //Form header string
    
        if ($extension = "jpg") {
    
            $extension = "jpeg";
    
        }
    
        
    
        $headstr = "Content-type: image/$extension"; 
    
    
    
        //Send header
    
        header($headstr);
    
    
    
        //Send img
    
        echo file_get_contents($images[$rimage]);
    
    
    
        //Close the dir
    
        closedir($thisdir);
    
    
    
        //Clear the stat cache
    
        clearstatcache();
    
    ?>

    Changes:

    -It now outputs the conent type to the header. Will work with jpg, gif and png

    -It now checks to make sure it's not trying to display itself

    -I've changed the apache extension handler to ".php.jpg application/x-httpd-php"... That way, I can save the file as avatar.php.jpg, it gets parsed as php, I can use .png images as avatars, forums allow me to use it as an avatar, and it doesn't affect the images I use on the rest of my site :)

    It can be used between tags too... Handy if you want a random image in your signature...

    avatar.php.jpg

  3. I've heard you can force some switches to go into a 'hub mode' so to speak, by flooding them with too many mac addresses.

    I'm not sure how common this is, or whether it actually works, mind :)

  4. Right, I was inspired by W4RP3D's thread on dynamic signatures to do something a little more simple... A random avatar generator.

    So I wrote a little bit of PHP to pick an image at random from the folder the file is in and display it. Like so:

    <?php
    
    //Random Avatar 0.1 - SBT 2006
    
    
    
        //Image types to use in CSV list
    
        $imgtypes = "jpg,gif";
    
    
    
        //Pull apart image types string
    
        $imgtypes = explode(",", $imgtypes);
    
        
    
        //Start the pattern string
    
        $imgpattern = "(.+.";
    
    
    
        //Put img types into pattern string
    
        $imgpattern .= implode(")|(.+.", $imgtypes);
    
    
    
        //End the pattern string
    
        $imgpattern .= ")";
    
    
    
        //Open the current dir
    
        $thisdir = opendir(".");
    
    
    
        //Create array for image file names
    
        $images = array();
    
    
    
        //Read the contents of the dir 
    
        while($fn = readdir($thisdir)) { 
    
    
    
            //Check for images. Add images to $images array
    
            if (filetype($fn) == "file") { 
    
                if (eregi($imgpattern, $fn)) {
    
                    $images[] = $fn;
    
                } 
    
            }
    
        }
    
    
    
        //Get amount of images in dir
    
        $nimages = count($images);
    
    
    
        //Pick Random image
    
        $rimage = rand(0, $nimages);
    
    
    
        //Display it
    
        echo file_get_contents($images[$rimage]);    
    
    
    
        //Close the dir
    
        closedir($thisdir);
    
    
    
        //Clear the stat cache
    
        clearstatcache();
    
    ?>

    It works fine for the most part. But every now and again it outputs absolutely nothing. I'm at a loss as to why it would do this... So if anyone can see something wrong with the code (I've tried to comment it the best I can) then please let me know :)

    Oh... Incase anyone wonders: To allow me to use the url of the file on forums, I've set my server to parse .png files as php. I don't use any png files on my site, so it seemed convenient :P

    **EDIT**

    Dammit! I knew if I posted it I'd figure it out soon after :roll:

    I wasn't counting from zero. I should have my wrist slapped :P

    //Get amount of images in dir
    
    $nimages = count($images);

    Should read:

        
    
    //Get amount of images in dir, AND MINUS ONE
    
    $nimages = count($images);
    
    $nimages = $nimages - 1;

    Feel free to use it... Refesh the page to see it in action :P

    If anyone has any suggestions, please let me know :)

  5. This is my setup in my room a few months ago... It's changed rather a lot since... But it's not worth taking a picture of at the moment :P

    room.jpg

    Notable additions are dual monitors and a big old full tower server case. Oh, and a monitor next to my bed + 15 foot vga cable :lol:

  6. I got an e-mail today that made me laugh :)

    Subject: New Driving Penalties

    Due to the nature of the quality of driving in England the Department of

    Transport has now devised a new scheme in order to identify poor drivers

    and give good drivers the opportunity to recognise them whilst driving.

    For this reason as from the middle of May 2006 those drivers who are

    found to be driving badly which includes:

    -overtaking in dangerous places

    -hovering within one inch of the car in front

    -stopping sharply

    -speeding in residential areas

    -pulling out without indication

    -performing U turns inappropriately in busy high streets

    -undertaking on motorways

    -taking up more than one lane in multi lane roads

    These drivers will be issued with flags, white with a red cross,

    signifying their inability to drive properly. These flags must be

    clipped to a door of the car and be visible to all other drivers and

    pedestrians. Those drivers who have shown particularly poor driving

    skills will have to display a flag on each side of the car to indicate

    their greater lack of skill and general lower intelligence mindset to

    the general public.

    Please circulate this to as many other motorists as you can so that

    drivers and pedestrians will be aware of the meaning of these flags.

    Department of Transport

  7. I don't really know what program it is. All my friend said is that is was something for the start tool bar.

    And why would you pay for it if you can get it for free?

    Come on! This is hak5. A place for what? Wait a sec... um...

    HACKERS!

    I'm not sure that's the philosophy of a hacker.

    A cracker maybe...

    I think a hacker would buy a piece of software if they thought it was good, and not extortionately priced.

    For example: I paid for EditPad. I use it pretty much every day. It's an awsome editor without being too cluttered. There are tons of warez copies of it about on the net, and even a free 'lite' version... But I want them to be able to afford to keep making their software... Otherwise I'll end up changing text editors.

    I think a hacker would quite likely look for a free alternative too.

  8. This might sound wierd... But check out the charity shops.

    I found a 4 port KVM for £8 in a charity shop the other month. And they had a boxed copy of windows 98 for £4 in a different charity shop across the road.

    Also: sign up for freeclycle in your area if there is one... (google for it).

    There are usually a ton of generous people on there that might be able to help you out :)

  9. I see what you're saying :)

    I don't think I would buy a dell as a single desktop machine. I'm pretty picky about the components I use in my desktop machines usualy. A Dell laptop maybe, though.

    But as I said before: for computers in a business or school environment, I just can't find a better supplier :roll:

    I guess I'm just not an AMD nut. I love AMD processors, but I'm not one of these people who will only buy AMD.

  10. By Dell buying Alienware you now know that Alienware is never going to go bust because Dell will unfortunatly never go bust and there will always be money around.

    I don't know why everyone dislikes Dell. They used to suck, but their servers and low cost desktop systems are actually really good now. As far as buying large volumes of computers for businesses and schools goes: Dell is the way forward if you ask me :)

  11. I'm in to lots of things... Mainly rock and metal.

    My original favourite band when I was a kid was AC/DC, I then started getting into Van Halen, and eventually into a band called Racer X (Members include Paul Gilbert of Mr Big, Scott Travis of Judas Priest, Juan Alderete of the Mars Volta, and Jeff Martin). I've had the honour being the tech on their website for a couple of years now. Great guys :)

    From the sounds of things, Cooper: you should really check out Racer X!

    I really like a lot of classical too. Paganini, Bach (JS and JC), Chopin, Rachmaninov and Beethoven are among my favorites.

    I like a lot of blues and country type rock too. Stevie Ray Vaughn, Chet Atkins and the Hellecasters I like a lot.

    I also like NoFX quite a lot :)

  12. Alienware: http://www.alienware.com/product_pages/not...ll_default.aspx

    They have a new laptop out with SLI and 17" screen which starts at $2000, so you might not want to go for it unless you can raise some more money as there is always extras that you want to get.

    but i dont know how long it'll stay that way cos they've been bought over by Dell .....

    IMO: Being bought out by Dell will only make them better if anything. Think about it: It's unlikely Dell will re-brand the Alienware laptops and fire all the staff. All it really probably means for alienware is better funding, R&D and maybe a small price drop :)

  13. I worked for an ISP that offered an filter system and did some side work for schools that used them. Some of our customers did report some school students finding a way around it. What the students did was goto http://babelfish.altavista.com/ and do a website translation for http://whatpagetheywanted.com they set it up to translate from German to English thus not performing any translation. Most filtering software does not have these translation sites blocked be default. Once the school admins found out they called us and we set that up to be blocked. It will get you access until you get caught doing it. As it has be stated before just wait to you get home to surf because you will get caught someone will see you on a site that you should not be you will end up telling the the work around so they do not report you. Soon a dozen or so students will be on myspace.com and the staff will be aware. They will want to know how the students that they know are not smart enough to figure a work around like that out and they will pressure them into telling them who told them how to do it. It will get back to you and they will use your punishment as an example to the rest of the school.

    Translation websites were always a common way for people to get round things at my old highschool. I make sure they're blocked at the schools I administer :)

  14. I hear the RSA SecurID system is relitavely secure. I know it's used by some banks at least.

    The basic idea (as far as I understand it... I've not looked into it much) is as follows...

    The client has a little card a bit like this:

    image002.gif

    The number on the screen changes every minute. It's synced up with an appliance on the server end so that the keys change to the same thing at the same time. This is (I assume) done with a matching algorithm and synced system clocks... Let's just hope the battery doesn't die!

    When the user logs into the server remotly (most likely through a VPN or something similar) they input their password, followed by the number on the SecurID card. This is then sent to the server over SSL to the server for authentification.

    The idea being, if someone sniffs the password: they've got all of a minute at absolute maximum to log into the system.

  15. I've just built up a Smoothwall machine this afternoon.

    I gathered together enough bits for a p3 500mhx, 128mb ram, 20gb hdd and 2 x 3com 905s. Works fine to me.

    Schools are a great place for computers. Most of mine are decommissioned school machines :)

  16. Ahhhhhh.... Nettiquite, I remember the good 'ole days when ppl actually followed this advice. IMHO this should be part of your ISP user manual and contract.

    I think that's a great idea!

    An aptitude test before you can get an account with an ISP or gain access to an internet cafe would be ideal! :wink:

  17. Hmm... When you said p2/p3 I was thinking 500mhz, 256mb ram and 20gb.

    Your specs are a little high for me to cope with :(

    why do you need those kind of specs for a firewall machine? How big is the network you're gonna be using it on?

×
×
  • Create New...