Jump to content

Customized Server Status


arteryplanet

Recommended Posts

Hi guys,

 

The server status in whmcs wasnt working for me as i wish show the server status only when the client is logged in and also i wanted show only the servers if the client have any Active hosted domain in that server and also show which of the clients domain is hosted in which server.

 

So just replace the serverstatus.tpl with the code below.

 

Enjoy!!

 

{if $loggedin}
<table class="clientareatable" align="center" cellspacing="1">
<tr class="clientareatableheading">
<td>{$LANG.servername}</td>
<td>HTTP</td>
<td>FTP</td>
<td>POP3</td>
<td>SMTP</td>
</tr>
<tr>
{php}
$query = "SELECT * FROM tblhosting WHERE userid='".$_SESSION["uid"]."' AND domainstatus='Active'";
$result = mysql_query($query);
while ($row = mysql_fetch_array($result)) {

$activeserver = $row['server'];
$hosteddomain = $row['domain'];

$query2 = "SELECT * FROM tblservers WHERE id='".$activeserver."'";
$result2 = mysql_query($query2);
$row2 = mysql_fetch_array($result2);

$servername = $row2['name'];


//HTTP
$site = $servername;
$port = 80;

$fp = fsockopen($site,$port,$errno,$errstr,10);
if(!$fp)
{
echo "<tr class=\"clientareatableactive\">";
echo "<td>( " .$hosteddomain. " ) - " .$servername."</td>";
echo "<td><strong><font color=\"#FF0000\">Not OK</font></strong></td>";
}

else{
echo "<tr class=\"clientareatableactive\">";
echo "<td>( " .$hosteddomain. " ) - " .$servername."</td>";
echo "<td><strong>OK</strong></td>";
fclose($fp);
}

//FTP

$port = 21;

$fp = fsockopen($site,$port,$errno,$errstr,10);
if(!$fp)
{
echo "<td><strong><font color=\"#FF0000\">Not OK</font></strong></td>";


}

else{
echo "<td><strong>OK</strong></td>";

fclose($fp);
}

//POP3

$port = 110;

$fp = fsockopen($site,$port,$errno,$errstr,10);
if(!$fp)
{
echo "<td><strong><font color=\"#FF0000\">Not OK</font></strong></td>";


}

else{
echo "<td><strong>OK</strong></td>";

fclose($fp);
}

//SMTP

$port = 25;

$fp = fsockopen($site,$port,$errno,$errstr,10);
if(!$fp)
{
echo "<td><strong><font color=\"#FF0000\">Not OK</font></strong></td>";


}

else{
echo "<td><strong>OK</strong></td>";

fclose($fp);
}

}


{/php}
</tr>
</table>

{else}
<p>{$LANG.loginintrotext}</p>

<form action="dologin.php?goto=serverstatus" method="post">

<table align="center">
<tr><td align="right">{$LANG.loginemail}:</td><td><input type="text" name="username" size="40" value="{$username}"></td></tr>
<tr><td align="right">{$LANG.loginpassword}:</td><td><input type="password" name="password" size="25" value="{$password}"></td></tr>
</table>

<p align="center"><input type="submit" value="{$LANG.loginbutton}"><br><input type="checkbox" name="rememberme"{$rememberme}> {$LANG.loginrememberme}</p>
</form>
<p><b>{$LANG.loginforgotten}</B> <a href="passwordreminder.php">{$LANG.loginforgotteninstructions}</a>.</p>
{/if}

Link to comment
Share on other sites

  • 2 weeks later...
  • Replies 61
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

  • 1 month later...

Ok i have a fix for you guys who are having problems with the "NOT OK" ok the script he wrote reads from the server name from within whmcs most likely you dont have the server name to the actually host name for example

 

you might have it set as "Server 1"

to make the script work you have to make the name of the server config in whmcs the quailified domain name for instance:

"server1.domain.net"

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated