GIDForums  

Go Back   GIDForums > Computer Programming Forums > MySQL / PHP Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 03-Dec-2003, 20:05
BobbyDouglas's Avatar
BobbyDouglas BobbyDouglas is offline
Regular Member
 
Join Date: Aug 2003
Posts: 789
BobbyDouglas has a spectacular aura aboutBobbyDouglas has a spectacular aura about

Changing font while using getstr


This might be a complicated process, but try to stay with me on this.

Background: I am trying to display the statistics for my Web Server from Alerta.com to display the stats on my website's Server Uptime page.

As you will notice, the font color is black.

Problem: The font color is black, and does not look good on my page. How would I change it to become white?

Code: [server_uptime.php]
PHP Code:

<table width=400px>
    <tr>
        <td align=center>
        <?php

        $servername = "servename";
                        
        // $headercolor can be the HTML hex color of your choice.
        $headercolor = "#88A4C8";
                        
        include("include_stats.php");
        ?>
        </td>
    </tr>
</table> 



Code: [include_stats.php]
PHP Code:

<?php

$servernames = array
(
    "servernameo" => "servernumbero",
    "servernamet" => "servernumbert"
);

// variables that should be set beforehand..
if(!isset($servername))
    die('<b>Error!</b> Please set the variable "$servername" in your script.');

if(!isset($headercolor))
    die('<b>Error!</b> Please set the variable "$headercolor" in your script.');

if(!array_key_exists($servername, $servernames))
{
    $diestr = '<b>Error!</b> Invalid server name. Please ensure that "$servername" is one of the following:<br><br>';
    foreach($servernames as $servername => $id)
        $diestr .= ": $servername :";
    die($diestr);
}



$fp = fsockopen("uptime.alertra.com", 80, $errno, $errstr, 30);
if(!$fp)
    die("<b>Error!</b> Unable to connect to uptime server. Please try again later.");
else
{
    $getstr = "GET /uptime2?id2=1111&id1={$servernames[$servername]} HTTP/1.0\r\nHost: uptime.alertra.com\r\n\r\n";
    fputs($fp, $getstr);
    $str='';
    while(!feof($fp))
        $str .= fgets($fp,128);
    fclose($fp);
}

$start_delim =
'</b></font></td></tr>
</table>
';

$end_delim =
'<tr>
    <td colspan=5 height=3 bgcolor=#00777F><img src="http://uptime.alertra.com/img/space1" alt="" height="1" width="1" border="0" /></td>
  </tr>';

// grab the main uptime tables
preg_match("/" . preg_quote($start_delim, '/') . "(.*)" . preg_quote($end_delim, '/') . "/s", $str, $matches);


// get rid of the spacer row and replace it with our own
$table = str_replace('<tr><td colspan=2 height=8><img src="http://uptime.alertra.com/img/space1" alt="" height="1" width="1" border="0" /></td></tr>', '<tr><td>&nbsp;</td></tr>', $matches[1]);


// maintain anonymity in case something goes wrong
$table = str_replace('myserver', '', $table);

// had to lop off this last tag in the regex
$table .= "</table>";

if(isset($headercolor))
    $table = str_replace("#00777F", $headercolor, $table);

print $table;

?>

__________________
Mr. Bob's Web Design - Tirelessly looking for ways to enhance the customer base of your business.
  #2  
Old 03-Dec-2003, 22:08
BobbyDouglas's Avatar
BobbyDouglas BobbyDouglas is offline
Regular Member
 
Join Date: Aug 2003
Posts: 789
BobbyDouglas has a spectacular aura aboutBobbyDouglas has a spectacular aura about
To make it work I added:
PHP Code:

$table = str_replace('000000', 'FFFFFF', $table); 


__________________
Mr. Bob's Web Design - Tirelessly looking for ways to enhance the customer base of your business.
 
 

Recent GIDBlogFlickr uploads of IA pictures by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing monitors on a Linux machine JdS Computer Software Forum - Linux 10 23-Dec-2004 09:49
changing default webpage info mkyb14 Apache Web Server Forum 2 12-Nov-2003 03:12

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 15:50.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.