HabboxWiki needs you!
Are you a Habbo buff? Or maybe a rare trader with a bunch of LTDs? Get involved with HabboxWiki to share your knowledge!
Join our team!
Whether you're raving for rares, excited for events or happy helping, there's something for you! Click here to apply
Need a helping hand?
Check out our guides for all things to help you make friends, make rooms, and make money!


Results 1 to 7 of 7

Thread: PHP Arrays..

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

    Latest Awards:

    Exclamation PHP Arrays..

    Hey,

    I know this sounds daft but I've just started using PHP Arrays & Im not familiar with them.
    Ive looked on the PHP website & got abit of help & got my script to work.

    Basically, I've made a script for work so that when one of our customer's servers is down, it will email us, it all works perfect apart from the array's are outputted twice which means it will send me 2 emails rather than 1...

    Here's what I got..

    PHP Code:
    $siteToMonitor = array("mail.**.co.uk""mail.**.co.uk"); // Accessable mail. url's
    $siteToMonitorNames = array("** Server""** Server"); // Name of the server's
    $count count($siteToMonitor);
    $count2 count($siteToMonitorNames);
    for(
    $a 0$a $count$a++){
        for(
    $b 0$b $count2$b++){
            if (
    isDomainAvailible("http://" $siteToMonitor[$a])){
                echo 
    "<strong>" $siteToMonitorNames[$b] . "<span style=\"color: green\">Active</span> - <a href=\"http://" $siteToMonitor[$a] . "\" target=\"_blank\">http://" $siteToMonitor[$a] . "</a></strong><br />";
            }else{
                
    //echo "<strong><span style=\"color: red\">Inaccessible</span> - <a href=\"http://{$value}\" target=\"_blank\">http://{$value}</a></strong><br />";
            
    }
        }

    Can someone help me and point me in the right direction?

    +REP, Lew.
    Im not here to be loved, I love to be hated :-}


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

    Latest Awards:

    Default

    Have you tried changing:
    Code:
    $siteToMonitor = array("mail.**.co.uk", "mail.**.co.uk"); // Accessable mail. url's 
    $siteToMonitorNames = array("** Server", "** Server"); // Name of the server's 
    To:
    Code:
    $siteToMonitor = array("mail.**.co.uk"); // Accessable mail. url's 
    $siteToMonitorNames = array("** Server"); // Name of the server's 
    Seems like that could be your issue, but not sure what you've tried!

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

    Latest Awards:

    Default

    Yeah, the extra ones are additional ones.

    Lew.
    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

    Alright, what about this one:

    Code:
    for($a = 0; $a < $count; $a++){ 
        for($b = 0; $b < $count2; $b++){ 
    to:

    Code:
    for($a = 0; $a < $count; $a+){ 
        for($b = 0; $b < $count2; $b+){ 
    Sorry, wouldn't know a lot about php but trying my best.
    Might be a double up somewhere!

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

    Latest Awards:

    Default

    Quote Originally Posted by Fiendly View Post
    Alright, what about this one:

    Code:
    for($a = 0; $a < $count; $a++){ 
        for($b = 0; $b < $count2; $b++){ 
    to:

    Code:
    for($a = 0; $a < $count; $a+){ 
        for($b = 0; $b < $count2; $b+){ 
    Sorry, wouldn't know a lot about php but trying my best.
    Might be a double up somewhere!
    Somehow I doubt that would work. I sorted it in the end by using mysql database

    Lew.
    Im not here to be loved, I love to be hated :-}


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

    Latest Awards:

    Default

    Haha, least it's all working.

    Sorry I much of a help

  7. #7
    Join Date
    Mar 2008
    Posts
    5,107
    Tokens
    2,809

    Latest Awards:

    Default

    Either way... this should've worked...

    PHP Code:
    <?php
    $sites 
    = array();
    $sites[0]["domain"] = "mail.**.co.uk";
    $sites[0]["name"] = "** Server";

    $sites[1]["domain"] = "mainl.**.co.uk";
    $sites[1]["name"] = "** Server";

    $count count($sites);

    for(
    $i 0$i $count$i++) {
        if(
    isDomainAvailible("http://" $sites[$i]["domain"])) {
            
    // site is availible...
            
    echo "<strong>{$sites[$i]["name"]}<span style=\"color: green\">Active</span> - <a href=\"http://{$sites[$i]["domain"]}\" target=\"_blank\">http://{$sites[$i]["domain"]}</a></strong><br />";
        } else {
            echo 
    "not active";
        }
    }

Posting Permissions

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