Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Page 1 of 3 123 LastLast
Results 1 to 10 of 22
  1. #1
    Join Date
    May 2008
    Posts
    605
    Tokens
    0

    Default Little image uploader.

    Okay I know you people are/was going wild for image uploaders so I've built a simple one for you. I've put comments in so you can understand what to do etc. Remember to CHMOD your images folder to 0777(777) so the uploader can put your upload into that folder.

    Yes, I know that it you can upload other file types which is a massive security risk so I only recommend this for little sites.

    PHP Code:
    <?php
    echo "<center>"//We center the page.
    $sitename "sitename.com"//Put your site url here.
        
    switch ($_GET[page]) //We use the switch function to get the page.
        
    {
            default: 
    //Self explanatory
                
    echo "<form action='?page=upload' enctype='multipart/form-data' method='POST'>
                Upload:
                <input type='file' size='7' name='image' id='image'><br>
                <input type='submit' name='submit' value='Upload'></form>"
    ;
                break; 
    //Break upload
            
    case 'upload'//The upload case
                
    $filename $_FILES["img"]["name"];
                
    $tmp_name $_FILES["img"]["tmp_name"];
                
    $img "images/$filename"//You can edit the images piece to where your images will be displayed
                
    if (move_uploaded_file($tmp_name"images/".$filename)) { //And here - we also move the file
                    
    echo "Image upload complete!<br><img src='$img'><br>
                                    Forum ******?<br>
                                    <input type='text' name='image' size='30' value='[IMG]www."
    .$sitename.".com/files/upload/".$img."[/IMG]'>"// We display that their file has been uploaded, show then the url and show them a picture of their upload
                
    } else { //Lol the upload failed
                    
    die ("Don't bother uploading ever again.. seriously."); //True comment
                
    }
                            
                break; 
    //Break page
        
    }
    ?>
    Have fun, or whatever.
    Last edited by Excellent1; 28-07-2008 at 03:11 PM.

  2. #2
    Join Date
    Nov 2005
    Posts
    4,486
    Tokens
    921

    Latest Awards:

    Default

    Their could be many sercurity holes in this.
    I am unfortunatley not going to use it, but it's helpful, +REP.
    "RETIRED" FROM HABBO(X)

    :¬:

    TOMSPIT / COWLY05


  3. #3
    Join Date
    May 2008
    Posts
    605
    Tokens
    0

    Default

    Quote Originally Posted by TomSpit View Post
    Their could be many sercurity holes in this.
    I am unfortunatley not going to use it, but it's helpful, +REP.
    Yeah, I urge people to lock the folder so 'hackers' can't upload files. It's just a little file uploader for websites who don't want to go ramming through cPanel all the time (the ability to upload other file types comes in handy)

  4. #4
    Join Date
    Jul 2008
    Location
    London
    Posts
    25
    Tokens
    0

    Default

    +rep for giveing to the forum

  5. #5
    Join Date
    Mar 2008
    Location
    Swindon, UK
    Posts
    1,274
    Tokens
    187
    Habbo
    :Ltd

    Latest Awards:

    Default

    Quote Originally Posted by Excellent1 View Post
    Okay I know you people are/was going wild for image uploaders so I've built a simple one for you. I've put comments in so you can understand what to do etc. Remember to CHMOD your images folder to 0777(777) so the uploader can put your upload into that folder.

    Yes, I know that it you can upload other file types which is a massive security risk so I only recommend this for little sites.

    PHP Code:
    <?php
    echo "<center>"//We center the page.
    $sitename "sitename.com"//Put your site url here.
        
    switch ($_GET[page]) //We use the switch function to get the page.
        
    {
            default: 
    //Self explanatory
                
    echo "<form action='?page=upload' enctype='multipart/form-data' method='POST'>
                Upload:
                <input type='file' size='7' name='image' id='image'><br>
                <input type='submit' name='submit' value='Upload'></form>"
    ;
                break; 
    //Break upload
            
    case 'upload'//The upload case
                
    $filename $_FILES["img"]["name"];
                
    $tmp_name $_FILES["img"]["tmp_name"];
                
    $img "images/$filename"//You can edit the images piece to where your images will be displayed
                
    if (move_uploaded_file($tmp_name"images/".$filename)) { //And here - we also move the file
                    
    echo "Image upload complete!<br><img src='$img'><br>
                                    Forum ******?<br>
                                    <input type='text' name='image' size='30' value='[IMG]www."
    .$sitename.".com/files/upload/".$img."[/IMG]'>"// We display that their file has been uploaded, show then the url and show them a picture of their upload
                
    } else { //Lol the upload failed
                    
    die ("Don't bother uploading ever again.. seriously."); //True comment
                
    }
                            
                break; 
    //Break page
        
    }
    ?>
    Have fun, or whatever.
    and... you called my coding messy - LOL
    Hi, names James. I am a web developer.

  6. #6
    Join Date
    May 2008
    Posts
    605
    Tokens
    0

    Default

    Quote Originally Posted by Protege View Post
    and... you called my coding messy - LOL
    Problem is your code is dirty 99.9% of the time, all mine needs doing is cleaning up:
    PHP Code:
    <?php
    echo "<center>"//We center the page.

    $sitename "sitename.com"//Put your site url here.

    switch ($_GET[page]) //We use the switch function to get the page.
    {

        default: 
    //Self explanatory

            
    echo "<form action='?page=upload' enctype='multipart/form-data' method='POST'>
                Upload:
                <input type='file' size='7' name='image' id='image'><br>
                <input type='submit' name='submit' value='Upload'></form>"
    ;
            break; 
    //Break upload

        
    case 'upload'//The upload case

            
    $filename $_FILES["img"]["name"];
            
    $tmp_name $_FILES["img"]["tmp_name"];
            
    $img "images/$filename"//You can edit the images piece to where your images will be displayed
            
    if (move_uploaded_file($tmp_name"images/".$filename)) 
            { 
    //And here - we also move the file

                
    echo "Image upload complete!<br><img src='$img'><br>
                Forum ******?<br>
                <input type='text' name='image' size='30' value='[IMG]www."
    .$sitename.".com/files/upload/".$img."[/IMG]'>"// We display that their file has been uploaded, show then the url and show them a picture of their upload
            

            else 
            { 
    //Lol the upload failed
                
    die ("Don't bother uploading ever again.. seriously."); //True comment
            
    }
            break; 
    //Break page
    }
    ?>

  7. #7
    Join Date
    Mar 2008
    Location
    Swindon, UK
    Posts
    1,274
    Tokens
    187
    Habbo
    :Ltd

    Latest Awards:

    Default

    though you have yet to prove that my coding is messy and your coding is still messy...

    You really have no factual evidence, you see there is one code on Habbox that I would consider messy - but thats it.

    Seriously how many times do I have to say this, stick to your high IQ **** and go write some poems about how crap you are at any computing language you attempt.

    Heres some PHP i did today - messy - suck my ****

    PHP Code:
    function updateCode $id$code )
    {
        if ( ( 
    $id == '' ) || ( $code == '' ) )
        {
            echo ( 
    'blank' );
        }
        elseif ( ( 
    $id != '' ) || ( $code != '' ) )
        {
            if ( 
    is_numeric$code ) )
            {
                
    $mysqlQuery mysql_query 'UPDATE `negair_stock`.`goods` SET `goods-productcode` = "' cleanString $code ) . '" WHERE `goods`.`id` = "' cleanString $id ) . '" LIMIT 1 ;' );
                if ( 
    $mysqlQuery )
                {
                    echo ( 
    'true' );
                }
                else
                {
                    echo ( 
    'false' );
                }
            }
        }

    Code shouldnt need to be "cleaned" up, should be typed clean when your coding it. All your doing is wasting more time noob.

    Thats PHP, heres some javascript:

    PHP Code:
    function changeProductcode idoldcode )
    {
        var 
    code prompt'Please enter the new product code below!''' );
        if ( 
    code == '' )
        {
            
    alert 'Please enter a value for this field - No blank inputs allowed!' );
        }
        else if ( 
    code != '' )
        {
            if ( 
    checkIntcode ) )
            {
                var 
    answer confirm 'Are you sure you want to update the product code from ' oldcode ' to ' code );
                if ( 
    answer )
                {
                    if ( 
    window.XMLHttpRequest )
                    {
                       
    httpRequest = new XMLHttpRequest();
                    }
                    else if ( 
    window.ActiveXObject )
                    {
                        
    httpRequest = new ActiveXObject 'Microsoft.XMLHTTP' );
                    }

                    
    httpRequest.onreadystatechange checkReturn;
                    
    httpRequest.open 'GET''updatepcode.php?pcode=' code '&id=' idtrue );
                    
    httpRequest.sendnull );
                }
            }
            else
            {
                
    alert 'Sorry, that value you placed in wasn\'t an integer, please only enter integer values for this field!' );
            }
        }

    Last edited by Protege; 28-07-2008 at 05:44 PM.
    Hi, names James. I am a web developer.

  8. #8
    Join Date
    May 2008
    Posts
    605
    Tokens
    0

    Default

    Well done on posting some semi clean code you probably went through and tidied up:eusa_clap

    I really think you're a homosexual due to you always repeated the same boring phrase over and over again that people used to use in year 7, "suck my ****".

    If you're going to be a selfish son of a ***** I urge you to use that mop on top of your head as a toilet plunger and do something decent with your life.. Perhaps get one? This thread is for people who want to upload images, not silly cry babies with issues.

    Edited by ,Jess, (Forum Super Moderator): Please do not be rude towards other forum members.
    Last edited by ,Jess,; 01-08-2008 at 02:09 PM.

  9. #9
    Join Date
    Mar 2008
    Location
    Swindon, UK
    Posts
    1,274
    Tokens
    187
    Habbo
    :Ltd

    Latest Awards:

    Default

    "Semi-clean", you make me laugh... I don't need to go through my code and clean it up I type it clean so If I have to go debug something in it, I can easily do that unlike you that would spend sitting there for hours figuring why an error is occurring.

    Im obviously homosexual to your standards, and like some 7 year old? Ahahaha make me laugh even more man - That **** I say I mean, you can kiss my *** - thats a better one for you to flame about. I swear your the guy who goes "imbecile" all the time, that gets boring too.

    My mop on my head, that was a picture from last year, I show that cause I love the fact how people like you take the piss out of it, I know I look like a sexy emo in it thats why I'm showing you - be jealous LOL but seriously I have a high self-esteem I dont get put down by people like you.

    I show that picture to everyone, think I care if you posted everywhere? its on deviantart for **** sake, i'm art bro and why the **** are you talking about my hair? Is that the only thing you can insult me on, I thought you where much more intelligent.

    Anyway, your script sucks, everything you do sucks - you fail in this forum sector, just get out.

    Edited by Invent (Forum Moderator): Please don't be rude.
    Last edited by Invent; 30-07-2008 at 01:56 PM.
    Hi, names James. I am a web developer.

  10. #10
    Join Date
    May 2008
    Posts
    605
    Tokens
    0

    Default

    Quote Originally Posted by Protege View Post
    "Semi-clean", you make me laugh... I don't need to go through my code and clean it up I type it clean so If I have to go debug something in it, I can easily do that unlike you that would spend sitting there for hours figuring why an error is occurring.

    Im obviously homosexual to your standards, and like some 7 year old? Ahahaha make me laugh even more man - That **** I say I mean, you can kiss my *** - thats a better one for you to flame about. I swear your the guy who goes "imbecile" all the time, that gets boring too.

    My mop on my head, that was a picture from last year, I show that cause I love the fact how people like you take the piss out of it, I know I look like a sexy emo in it thats why I'm showing you - be jealous LOL but seriously I have a high self-esteem I dont get put down by people like you.

    I show that picture to everyone, think I care if you posted everywhere? its on deviantart for **** sake, i'm art bro and why the **** are you talking about my hair? Is that the only thing you can insult me on, I thought you where much more intelligent.

    Anyway, your script sucks, everything you do sucks - you fail in this forum sector, just get out.
    So basically you wasted around 5 minutes of time trying to get me to react to that stupid bunch of text? I'll reply when you learn how to construct a decent insult

Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •