JLHC Posted May 11, 2013 Share Posted May 11, 2013 Hello guys, I am looking for a way to modify the Network Status page (serverstatus.tpl), specifically the Server Status section. I would like to only show the status of servers where the clients are hosted on. As such, if a client has an account in Server A, it will only the server status for Server A. If a client has an account in Server A and Server B, it will show the server status for Server A and Server B only. This is to prevent confusion especially when you have a lot of servers as the client may not even know which server they are hosted on. I have been using a custom code in version 4.x of WHMCS but it doesn't seem to work on version 5.x:- <table width="100%" border="0" align="center" cellpadding="10" cellspacing="0" class="data"> <tr> <th>{$LANG.servername}</th> <th>Hosting Account</th> <th>HTTP</th> <th>cPanel</th> <th>FTP</th> <th>POP3</th> <th>SMTP</th> </tr> <tr> {php} $query1 = "SELECT * FROM tblservers ORDER BY name"; $result1 = mysql_query($query1); while ($row1 = mysql_fetch_array($result1)) { $serverid = $row1['id']; $servername = $row1['name']; $host = $row1['ipaddress']; $hosteddomains=""; $query2 = "SELECT * FROM tblhosting WHERE userid='".$_SESSION["uid"]."' AND domainstatus='Active' AND server='".$serverid."'"; $result2 = mysql_query($query2); while ($row2 = mysql_fetch_array($result2)) { $hosteddomain = $row2['domain']; $hosteddomains.=$hosteddomain."<br>"; } if ($hosteddomains) { $hosteddomains=substr($hosteddomains,0,-4); if ($host) { //HTTP $port = 80; $fp = fsockopen($host,$port,$errno,$errstr,10); if(!$fp) { echo "<tr class=\"clientareatableactive\">"; echo "<td><b>".$servername."</b> </td>"; echo "<td>" .$hosteddomains."</td>"; echo "<td><img src=\"images/statusfailed.gif\"></td>"; } else{ echo "<tr class=\"clientareatableactive\">"; echo "<td>".$servername." </td>"; echo "<td>" .$hosteddomains."</td>"; echo "<td><img src=\"images/statusok.gif\"></td>"; fclose($fp); } //cPanel $port = 2082; $fp = fsockopen($host,$port,$errno,$errstr,10); if(!$fp) { echo "<td><img src=\"images/statusfailed.gif\"></td>"; }else{ echo "<td><img src=\"images/statusok.gif\"></td>"; fclose($fp); } //FTP $port = 21; $fp = fsockopen($host,$port,$errno,$errstr,10); if(!$fp) { echo "<td><img src=\"images/statusfailed.gif\"></td>"; }else{ echo "<td><img src=\"images/statusok.gif\"></td>"; fclose($fp); } //POP3 $port = 110; $fp = fsockopen($host,$port,$errno,$errstr,10); if(!$fp) { echo "<td><img src=\"images/statusfailed.gif\"></td>"; }else{ echo "<td><img src=\"images/statusok.gif\"></td>"; fclose($fp); } //SMTP $port = 25; $fp = fsockopen($host,$port,$errno,$errstr,10); if(!$fp) { echo "<td><img src=\"images/statusfailed.gif\"></td>"; }else{ echo "<td><img src=\"images/statusok.gif\"></td>"; fclose($fp); } $this->assign('serverid',$serverid); $this->assign('servername',$servername); {/php} {php} echo "</td></tr>"; } else { echo "<tr class=\"clientareatableactive\">"; echo "<td>".$servername."</td>"; echo "<td>" .$hosteddomains."</td>"; echo "<td colspan=\"5\"><strong><font color=\"#AAAAAA\">Not Monitored Here</font></strong></td>"; }}} {/php} </table> Any input from you guys will be greatly appreciated. Thank you. 0 Quote Link to comment Share on other sites More sharing options...
wrighty Posted May 11, 2013 Share Posted May 11, 2013 try this http://forum.whmcs.com/showthread.php?14002-Server-Status-display-wizardry hope that's what u looking for. 0 Quote Link to comment Share on other sites More sharing options...
JLHC Posted May 13, 2013 Author Share Posted May 13, 2013 try this http://forum.whmcs.com/showthread.php?14002-Server-Status-display-wizardry hope that's what u looking for. Unfortunately that is what I tried and it didn't work. 0 Quote Link to comment Share on other sites More sharing options...
wrighty Posted May 13, 2013 Share Posted May 13, 2013 do u meen like this? 0 Quote Link to comment Share on other sites More sharing options...
JLHC Posted May 13, 2013 Author Share Posted May 13, 2013 do u meen like this? Yes that looks alright. Are you running WHMCS 5.2.x? 0 Quote Link to comment Share on other sites More sharing options...
wrighty Posted May 13, 2013 Share Posted May 13, 2013 Ye running latest mate 0 Quote Link to comment Share on other sites More sharing options...
wrighty Posted May 13, 2013 Share Posted May 13, 2013 This the code im useing hope it works for u mate let me know Copy all the code and pase it in serverstatus.tpl {if $loggedin} <td height="29"> <div align="center"><font color="red"><strong>Live Uptime Status as of Today:</font> {$todaysdate}{$time} </strong> </div></td> <hr /> <br /> <table width="100%" class="clientareatable" align="center" cellspacing="1"> <tr class="clientareatableheading"> <td>{$LANG.servername}</td> <td>Hosting</td> <td>HTTP</td> <td>WHM</td> <td>CPanel</td> <td>FTP</td> <td>POP3</td> <td>SMTP</td> </tr> <tr> {php} $query1 = "SELECT * FROM tblservers ORDER BY name"; $result1 = mysql_query($query1); while ($row1 = mysql_fetch_array($result1)) { $serverid = $row1['id']; $servername = $row1['name']; $host = $row1['ipaddress']; $hosteddomains=""; $query2 = "SELECT * FROM tblhosting WHERE userid='".$_SESSION["uid"]."' AND domainstatus='Active' AND server='".$serverid."'"; $result2 = mysql_query($query2); while ($row2 = mysql_fetch_array($result2)) { $hosteddomain = $row2['domain']; $hosteddomains.=$hosteddomain."<br>"; } if ($hosteddomains) { $hosteddomains=substr($hosteddomains,0,-4); if ($host) { //HTTP $port = 80; $fp = fsockopen($host,$port,$errno,$errstr,10); if(!$fp) { echo "<tr class=\"clientareatableactive\">"; echo "<td><b>".$servername."</b> </td>"; echo "<td>" .$hosteddomains."</td>"; echo "<td rowspan=\"2\"><img src=\"images/statusfailed.gif\"></td>"; } else{ echo "<tr class=\"clientareatableactive\">"; echo "<td>".$servername." </td>"; echo "<td>" .$hosteddomains."</td>"; echo "<td><img src=\"images/statusok.gif\"></td>"; fclose($fp); } //CPanel $port = 2082; $fp = fsockopen($host,$port,$errno,$errstr,10); if(!$fp) { echo "<td rowspan=\"2\"><img src=\"images/statusfailed.gif\"></td>"; }else{ echo "<td><img src=\"images/statusok.gif\"></td>"; fclose($fp); } //WHM $port = 2086; $fp = fsockopen($host,$port,$errno,$errstr,10); if(!$fp) { echo "<td rowspan=\"2\"><img src=\"images/statusfailed.gif\"></td>"; }else{ echo "<td><img src=\"images/statusok.gif\"></td>"; fclose($fp); } //FTP $port = 21; $fp = fsockopen($host,$port,$errno,$errstr,10); if(!$fp) { echo "<td rowspan=\"2\"><img src=\"images/statusfailed.gif\"></td>"; }else{ echo "<td><img src=\"images/statusok.gif\"></td>"; fclose($fp); } //POP3 $port = 110; $fp = fsockopen($host,$port,$errno,$errstr,10); if(!$fp) { echo "<td rowspan=\"2\"><img src=\"images/statusfailed.gif\"></td>"; }else{ echo "<td><img src=\"images/statusok.gif\"></td>"; fclose($fp); } //SMTP $port = 25; $fp = fsockopen($host,$port,$errno,$errstr,10); if(!$fp) { echo "<td rowspan=\"2\"><img src=\"imagesfailed.gif\"></td>"; }else{ echo "<td><img src=\"images/statusok.gif\"></td>"; fclose($fp); } $this->assign('serverid',$serverid); $this->assign('servername',$servername); {/php} {php} echo "</td></tr>"; } else { echo "<tr class=\"clientareatableactive\">"; echo "<td>".$servername."</td>"; echo "<td>" .$hosteddomains."</td>"; echo "<td colspan=\"5\"><strong><font color=\"#AAAAAA\">Not Monitored Here</font></strong></td>"; }}} {/php} </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} 0 Quote Link to comment Share on other sites More sharing options...
JLHC Posted May 14, 2013 Author Share Posted May 14, 2013 This the code im useing hope it works for u mate let me know Copy all the code and pase it in serverstatus.tpl Redacted Your codes seem similar to mine. Anyway I made some changes to the code and it seem to work now. Thanks! 0 Quote Link to comment Share on other sites More sharing options...
mandar Posted May 16, 2014 Share Posted May 16, 2014 Hello, How can I add Server load and status as it shows in the original status file? 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.