Hiho...
Iam looking for a online player script for our shard but i cant find anyone.
i hope anybody can help me ;)
beast
Printable View
Hiho...
Iam looking for a online player script for our shard but i cant find anyone.
i hope anybody can help me ;)
beast
Yeah I would like one also to tie with my forums or main site.
I have a Prob with the following script..
Error:Warning: mysql_connect(): Access denied for user 'IUSR_ANONYMOUS'@'localhost' (using password: NO) in D:\inetpub\wwwroot\status2.php on line 9
The server is down.
Anyone have a clue ?
<?php
//CONFIG - START!
$serverip="xxx"; /* Enter here you'r server IP ADDRESS for example mine is 10.1.24.7 */
$sql_hostname = "localhost"; /* MySQL host */
$l2j_database = "l2jdb"; /* L2J database */
$sql_username = "root"; /* Your MySQL username */
$sql_password = "xxx"; /* Your MySQL password */
$db_connect = mysql_connect($sql_hostname, $sql_username, $sql_password) or die ('The server is down.');
//CONFIG - END!
//I use config.php
//Just write include('config.php'); down and config info include into config.php
//Get server status (1.)
$ip = $serverip;
if($fp = @fsockopen($ip, 7777,$un,$sinn,2)) {
//If socket connected write msg - ONLINE (2.)
echo("Server Status: <font color=green>Online</font>");
fclose($fp);
** else {
//If can't connect write msg - OFFLINE (3.)
echo("Server Status: <font color=red>Offline</font>");
**
//Get online counter (4.)
ob_start();
system("netstat -n");
$result=ob_get_contents();
ob_end_clean();
//TCP 217.21.36.15:7777 213.184.244.191:1178 ESTABLISHED
preg_match_all("/TCP.*:7777.*ESTABLISHED/mi",$result,$match);
$online=count($match[0]);
//Connect to L2J db and count how many users are created (5.)
mysql_select_db($l2j_database, $db_connect) or die ("The server is down.");
$q = mysql_query("SELECT * FROM accounts");
$totalusers = mysql_num_rows($q);
print("<br>Users Online: <b>".$online."</b> user(s) are online of <b>".$totalusers."</b>");
mysql_close($db_connect);
?>
neeeeeed help plz ;)
why you just dont use a GreenHopes Server Files There You Have Alerby Workinh status Script...
I am a noob in PHP but i use this script and all is ok ;D
<?php
$max = 0;
$i = 0;
$online ;
$online2 = 0;
$query = "SELECT online FROM characters";
$result = mysql_query($query,$link);
$max = (mysql_num_rows($result));
for ($i = 0; $i < $max; $i++)
{//start for
$online = mysql_result($result, $i, "online");
if ($online == 1)
{//start if
$online2++;
**//end if
**//end of for
echo $online2; //this print number of online user
?>
Quote:
Originally Posted by r-o-m-a-x
I have try this too but become an error:
MySQL meldet:
#1045 - Access denied for user 'IUSR_ANONYMOUS'@'localhost' (using password: NO)
wtf :)
Just make sure that all configuration files are all setup to read information from your database.
Config files are located in the following areas:
www\main\inc\config.php
www\acm\configuration.php
www\forums\config.php
www\mobfinder\cfg.php
Just make sure that the information for mysql sections matches what you have for your database.
Such as :
- Host
- DB Name
- User
- Password
Hope this helps you out some. :)
I have adjusted these things, and everything runs fine.
is done
script
Code:
<html>
<head>
<title>Server Status L2Dragons</title>
<body bgcolor="#C0C0C0">
</head>
</html>
<?php
$connection ='xx.xxx.xxx.xx';
$user = 'xxx';
$pass = 'xxx';
echo("<DIV style=\"font-weight:bold; text-decoration: underline\">Serverstatus L2Dragons</DIV><br><br>");
$login = fsockopen($connection,2106, $errno, $errstr, 1);
if (!$login) {
echo ("Login Server: <DIV style=\"color:red;font-weight:bold\">Offline</DIV>");
**
else
{
echo ("Login Server: <DIV style=\"color:green;font-weight:bold\">Online</DIV>");
**
echo "<br>";
$game = fsockopen($connection,7777, $errno, $errstr, 1);
if (!$game) {
echo ("Game Server: <DIV style=\"color:red;font-weight:bold\">Offline</DIV>");
**
else
{
echo ("Game Server: <DIV style=\"color:green;font-weight:bold\">Online</DIV>");
$conn = mysql_connect($connection, $user, $pass);
if (!$conn) {
echo "unable to connect to DB: ". mysql_error();
**
if (!mysql_select_db('l2jdb')) {
echo "Unable to select the DB: " . mysql_error();
**
$sql_gm = "SELECT * FROM `characters` WHERE `accesslevel` > '99' AND `online` = '1' ORDER BY `level` DESC, `char_name` ASC";
$sql_np = "SELECT * FROM `characters` WHERE `accesslevel` < '100' AND `online` = '1' ORDER BY `level` DESC, `char_name` ASC";
$sql_ba = "SELECT * FROM `accounts` WHERE `access_level` < '0'";
$sql_ac = "SELECT * FROM `accounts` WHERE `access_level` > '-1'";
$result_gm = mysql_query($sql_gm);
$result_np = mysql_query($sql_np);
$result_ba = mysql_query($sql_ba);
$result_ac = mysql_query($sql_ac);
$nr_gm = mysql_num_rows($result_gm);
$nr_np = mysql_num_rows($result_np);
$nr_ba = mysql_num_rows($result_ba);
$nr_ac = mysql_num_rows($result_ac);
$nr_tot = $nr_gm + $nr_np;
echo "<br><br><DIV style=\"font-weight:bold; text-decoration: underline\">Accountstatus</DIV> " . "gebannte Accounts: " . $nr_ba . "<br>erstellte Accounts: " . $nr_ac;
echo"<br><br>";
**
$query = "select count(char_name) from characters";
$link = mysql_query($query);
$all = mysql_fetch_row($link);
$query = "select char_name from characters where online=1";
$link = mysql_query($query);
$num = mysql_num_rows($link);
$FORM .= "<tr><td><hr><B><span style=\"font-size:14px;font-family:verdana;color:#36648B\"><center>Connected Players/Total Characters: $num/$all[0]</span></td></tr><tr><td align=justify><hr><B><span style=\"font-size:16px;font-family:Trebuchet;color:#36648B\">";
while ( $char = mysql_fetch_row($link) )
{
$FORM .= " $char[0], ";
**
$FORM .= "</span></td></tr></table><hr><center>";
echo $FORM;
?>