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 2 12 LastLast
Results 1 to 10 of 17
  1. #1
    Join Date
    May 2006
    Location
    Hull
    Posts
    7,701
    Tokens
    2,430
    Habbo
    Moh

    Latest Awards:

    Default Get background images from a css and add to a database?

    Does any one know how you can make a script which goes through a .css file, and it will insert all the background image URL's into a database?

  2. #2
    Join Date
    Feb 2008
    Location
    Plymouth
    Posts
    1,073
    Tokens
    0

    Latest Awards:

    Default

    Not too sure but wouldn't you make it so your database is able to grab all the files?

  3. #3
    Join Date
    May 2006
    Location
    Hull
    Posts
    7,701
    Tokens
    2,430
    Habbo
    Moh

    Latest Awards:

    Default

    The database dosn't get the files, its the script which does it.
    The database is just a place to store data

    I have a feeling the scritp will use file_get_contents

  4. #4
    Join Date
    Feb 2008
    Location
    Plymouth
    Posts
    1,073
    Tokens
    0

    Latest Awards:

    Default

    Quote Originally Posted by Jack120 View Post
    The database dosn't get the files, its the script which does it.
    The database is just a place to store data

    I have a feeling the scritp will use file_get_contents
    Yeah but it will only return the files in a string by using file_get_contents.

    Try this

    PHP Code:
    string file_get_contents     string $filename    [, int $flags    [, resource $context    [, int $offset    [, int $maxlen   ]]]] ) 

  5. #5
    Join Date
    Jul 2005
    Posts
    1,653
    Tokens
    50

    Latest Awards:

    Default

    Yep, you'd use file_get_contents and preg_match_all, although the problem is people can lay out their backgrounds differently ... and therefore it's going to be near impossible to get all of them.

  6. #6
    Join Date
    Feb 2008
    Location
    Plymouth
    Posts
    1,073
    Tokens
    0

    Latest Awards:

    Default

    I'm not sure if this is correct or not to don't bash me but couldn't he just store them in a file CHMOD'd t 777 and use
    PHP Code:
    ($con fsockopen(filewhateverhere); 
    to fetch them?
    Last edited by Bojangles; 04-04-2008 at 11:28 AM.

  7. #7
    Join Date
    May 2006
    Location
    Hull
    Posts
    7,701
    Tokens
    2,430
    Habbo
    Moh

    Latest Awards:

    Default

    Humm, iv never been good with these functions

    All I have is:
    PHP Code:
    <?php
    $url 
    "http://www.habbo.co.uk/myhabbo/styles/assets.css";
    $page file_get_contents("$url");

    $start explode("background-image: url("$page2);
    $end explode(");"$start[1], 2);
    $sticker trim($end[0]);

    echo (
    "$sticker");
    ?>
    Which gets the first one

    Quote Originally Posted by RYANNNNN View Post
    Yep, you'd use file_get_contents and preg_match_all, although the problem is people can lay out their backgrounds differently ... and therefore it's going to be near impossible to get all of them.
    because there backgrounds are added from a panel, the set out is all the same
    Last edited by Moh; 04-04-2008 at 11:39 AM.

  8. #8
    Join Date
    Jul 2005
    Posts
    1,653
    Tokens
    50

    Latest Awards:

    Default

    Quote Originally Posted by Jack120 View Post
    Humm, iv never been good with these functions

    All I have is:
    PHP Code:
    <?php
    $url 
    "http://www.habbo.co.uk/myhabbo/styles/assets.css";
    $page file_get_contents("$url");

    $start explode("background-image: url("$page2);
    $end explode(");"$start[1], 2);
    $sticker trim($end[0]);

    echo (
    "$sticker");
    ?>
    Which gets the first one


    because there backgrounds are added from a panel, the set out is all the same
    Okay, probably best to use preg_match_all and then since they're all the same you can use regex to find them ... although I'm not great with regex so I can't help you from now

  9. #9
    Join Date
    May 2006
    Location
    Hull
    Posts
    7,701
    Tokens
    2,430
    Habbo
    Moh

    Latest Awards:

    Default

    Quote Originally Posted by RYANNNNN View Post
    Okay, probably best to use preg_match_all and then since they're all the same you can use regex to find them ... although I'm not great with regex so I can't help you from now
    I have never used preg_match_all, looks like ill have to do some research

  10. #10
    Join Date
    Feb 2008
    Location
    Plymouth
    Posts
    1,073
    Tokens
    0

    Latest Awards:

    Default

    Research is key

Page 1 of 2 12 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
  •