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!


Results 1 to 4 of 4

Thread: PHP

  1. #1
    Join Date
    Feb 2007
    Posts
    2,588
    Tokens
    3,654

    Latest Awards:

    Default PHP

    PHP Code:
    <?php
    function getscdata($server$port) {
        
    $open fsockopen($server$port);
        if(
    $open) {
            
    fputs($open,"GET /7.html HTTP/1.1\nUser-Agent:Mozilla\n\n");
            
    $read fread($open,1000);
            
    $text explode("content-type:text/html",$read);
        }
        return 
    $text[1];
    }
    $count getscdata("SERVER IP HERE""PORT HERE");
    $datacount explode(","$count);
    $count $datacount[4];
    $viewerCount '<font color="black"><center><b>Listeners:</b> <i>'.$count.'</i><br /><b>Song:</b> <i>'.$datacount[6].'</i></center></font>';
    if(
    $_GET['ajaxsync'] == "counter") {
        echo 
    $viewerCount;
        die();
    }
    ?>
    <html>
    <script>
        function createRequestObject() {
            var ro;
            var browser = navigator.appName;
            if (browser == "Microsoft Internet Explorer") {
                ro = new ActiveXObject("Microsoft.XMLHTTP");
            } else {
                ro = new XMLHttpRequest();
            }
            return ro;
        }
        var xmlHttp = createRequestObject();
        var lastapidata = null;
        function runapipull() {
            xmlHttp.open('get', '<?php echo $_SERVER['PHP_SELF'];?>?ajaxsync=counter&ms='+ new Date().getTime());
            xmlHttp.onreadystatechange = readapidata;
            xmlHttp.send(null);
        }
        function readapidata() {
            if (xmlHttp.readyState == 4) {
                if (xmlHttp.responseText != lastapidata) {
                    lastapidata = xmlHttp.responseText;
                    if (document.getElementById("livecount")) {
                        document.getElementById("livecount").innerHTML = xmlHttp.responseText;
                    }
                }
                setTimeout("runapipull()", 15000);
            }
        }
        runapipull();
    </script>
    <link rel="icon" href="images/favicon.ico" type="image/x-icon">
        <title> MY SITE TITLE HERE</title>
            <background="/images/background.png">
    <body>
    <div id="livecount"><?php echo $viewerCount?></div>
    <center><script type="text/javascript" src="http://player.wavestreamer.com/cgi-bin/swf.js?id=EKG9W7S2LFZUEVY3"></script><script type="text/javascript" src="http://player.wavestreaming.com/?id=EKG9W7S2LFZUEVY3"></script></center></div>
        </p></div>
        </body>
    </html>

    Ok, so I have this coding, as I have a background code in there but when i load the page the background doesnt actually show, any help please +REP

  2. #2
    Join Date
    Dec 2008
    Location
    Victoria, Australia
    Posts
    462
    Tokens
    2,114
    Habbo
    Fiendly

    Latest Awards:

    Default

    Change "<background="/images/background.png">" to:
    Code:
    <style type=text/css>
      body {
                  background-image:   src('images/backgroung.png');
    }
    </style>
    Just needed to add a stylesheet property
    Hope I helped, will help if needed.

  3. #3
    Join Date
    Sep 2009
    Location
    Hull
    Posts
    827
    Tokens
    0

    Latest Awards:

    Default

    if its showing just a white page with nothing else then it is "dying"...

    PHP Code:
    <?php
    function getscdata($server$port) {
        
    $open fsockopen($server$port);
        if(
    $open) {
            
    fputs($open,"GET /7.html HTTP/1.1\nUser-Agent:Mozilla\n\n");
            
    $read fread($open,1000);
            
    $text explode("content-type:text/html",$read);
        }
        return 
    $text[1];
    }
    $count getscdata("SERVER IP HERE""PORT HERE");
    $datacount explode(","$count);
    $count $datacount[4];
    $viewerCount '<font color="black"><center><b>Listeners:</b> <i>'.$count.'</i><br /><b>Song:</b> <i>'.$datacount[6].'</i></center></font>';
    if(
    $_GET['ajaxsync'] == "counter") {
        echo 
    $viewerCount;
        die(); 
    // <------------------------  !!!!THIS DIE!!!!
    }
    ?>
    <html>
    <script>
        function createRequestObject() {
            var ro;
            var browser = navigator.appName;
            if (browser == "Microsoft Internet Explorer") {
                ro = new ActiveXObject("Microsoft.XMLHTTP");
            } else {
                ro = new XMLHttpRequest();
            }
            return ro;
        }
        var xmlHttp = createRequestObject();
        var lastapidata = null;
        function runapipull() {
            xmlHttp.open('get', '<?php echo $_SERVER['PHP_SELF'];?>?ajaxsync=counter&ms='+ new Date().getTime());
            xmlHttp.onreadystatechange = readapidata;
            xmlHttp.send(null);
        }
        function readapidata() {
            if (xmlHttp.readyState == 4) {
                if (xmlHttp.responseText != lastapidata) {
                    lastapidata = xmlHttp.responseText;
                    if (document.getElementById("livecount")) {
                        document.getElementById("livecount").innerHTML = xmlHttp.responseText;
                    }
                }
                setTimeout("runapipull()", 15000);
            }
        }
        runapipull();
    </script>
    <link rel="icon" href="images/favicon.ico" type="image/x-icon">
        <title> MY SITE TITLE HERE</title>
            <background="/images/background.png">
    <body>
    <div id="livecount"><?php echo $viewerCount?></div>
    <center><script type="text/javascript" src="http://player.wavestreamer.com/cgi-bin/swf.js?id=EKG9W7S2LFZUEVY3"></script><script type="text/javascript" src="http://player.wavestreaming.com/?id=EKG9W7S2LFZUEVY3"></script></center></div>
        </p></div>
        </body>
    </html>
    If not then try change "<body>" to "<body background="link/to/image.png">"

    Edit: It seems the script maybe told toe die(); before it can output the background command. Remove the die(); and see how it goes

    Lew.
    Last edited by LMS16; 18-01-2011 at 09:02 AM.
    Im not here to be loved, I love to be hated :-}


  4. #4
    Join Date
    Dec 2008
    Location
    Victoria, Australia
    Posts
    462
    Tokens
    2,114
    Habbo
    Fiendly

    Latest Awards:

    Default

    Snipped from your quote.
    Simply just needed the <body background="source">

    Demo is here for you to look : Click here

    Source:
    Code:
    <?php
    function getscdata($server, $port) {
        $open = fsockopen($server, $port);
        if($open) {
            fputs($open,"GET /7.html HTTP/1.1\nUser-Agent:Mozilla\n\n");
            $read = fread($open,1000);
            $text = explode("content-type:text/html",$read);
        }
        return $text[1];
    }
    $count = getscdata("206.217.213.16", "8012");
    $datacount = explode(",", $count);
    $count = $datacount[4];
    $viewerCount = '<font color="black"><center><b>Listeners:</b> <i>'.$count.'</i><br /><b>Song:</b> <i>'.$datacount[6].'</i></center></font>';
    if($_GET['ajaxsync'] == "counter") {
        echo $viewerCount;
        die();
    }
    ?>
    <html>
    <script>
        function createRequestObject() {
            var ro;
            var browser = navigator.appName;
            if (browser == "Microsoft Internet Explorer") {
                ro = new ActiveXObject("Microsoft.XMLHTTP");
            } else {
                ro = new XMLHttpRequest();
            }
            return ro;
        }
        var xmlHttp = createRequestObject();
        var lastapidata = null;
        function runapipull() {
            xmlHttp.open('get', '<?php echo $_SERVER['PHP_SELF'];?>?ajaxsync=counter&ms='+ new Date().getTime());
            xmlHttp.onreadystatechange = readapidata;
            xmlHttp.send(null);
        }
        function readapidata() {
            if (xmlHttp.readyState == 4) {
                if (xmlHttp.responseText != lastapidata) {
                    lastapidata = xmlHttp.responseText;
                    if (document.getElementById("livecount")) {
                        document.getElementById("livecount").innerHTML = xmlHttp.responseText;
                    }
                }
                setTimeout("runapipull()", 15000);
            }
        }
        runapipull();
    </script>
    <link rel="icon" href="images/favicon.ico" type="image/x-icon">
        <title> MY SITE TITLE HERE</title>
     <body background="http://www.durastill.com/images/blue_gradient_background.jpg">
    <div id="livecount"><?php echo $viewerCount; ?></div>
    <center><script type="text/javascript" src="http://player.wavestreamer.com/cgi-bin/swf.js?id=EKG9W7S2LFZUEVY3"></script><script type="text/javascript" src="http://player.wavestreaming.com/?id=EKG9W7S2LFZUEVY3"></script></center></div>
        </p></div>
        </body>
    </html>
    Last edited by Fiendly; 18-01-2011 at 10:14 AM.

Posting Permissions

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