Jump to content

Online Players PHP Script + Face PCs


Recommended Posts

Hello Guys Today i share Online Players Scripts + Face Pcs. for example in your servers is 30 players online and you set 20 to php config. script will shows 50 players (30 + 20).

 

First Create config.php

and write

 

<?php
$L2JBS_config["mysql_host"]="localhost";	// MySQL Host 	["localhost"]
$L2JBS_config["mysql_port"]="3306";		// MySQL Port			["3306"]
$L2JBS_config["mysql_db"]="l2jdb";		// MySQL Database	["l2jdb"]
$L2JBS_config["mysql_login"]="root";		// MySQL User			["root"]	
$L2JBS_config["mysql_password"]="master";	// MySQL Password			

["root"]
$facepcs="20";					// Count of Face PCs
include("_config_procs.php");
error_reporting(0);
?>

 

now create _config_procs.php and write

 

<?php
  $link = mysql_connect($L2JBS_config['mysql_host'].":".$L2JBS_config['mysql_port'], $L2JBS_config['mysql_login'], $L2JBS_config['mysql_password']);
  if (!$link)
die("Couldn't connect to MySQL");
  @mysql_select_db($L2JBS_config['mysql_db'], $link);
error_reporting(0);

?>

 

Finaly Create and write <?php 
require("Config.php");
$activity = mysql_query("SELECT count(*) FROM characters WHERE online = 1");
$tmp = $activity + ($facepcs) - 4;

{
print 'Online players: <em>'.$tmp.'<em>';
}
?>

 

Finish.

 

Credits to me

Link to comment
Share on other sites

thank you!

i was searching for something like that!

thank you!

i was searching for something like that!

stop making double post's dude :)


btw the online players php are shared a lot of times :)

Link to comment
Share on other sites

Finaly Create and write <?php 
require("Config.php");
$activity = mysql_query("SELECT count(*) FROM characters WHERE online = 1");
$tmp = $activity + ($facepcs) - 4;

{
print 'Online players: <em>'.$tmp.'<em>';
}
?>

 

Finish.

 

Credits to me

 

How do I call?

 

I tried to put it in _config_procs but error

 

Parse error: syntax error, unexpected '[' in / var/www/test/test2/config.php on line 8

 

Warning: mysql_connect () [function.mysql-connect]: Access denied for user 'www-data' @ 'localhost' (using password: NO) in / var/www/test/test2/_config_procs.php on line 2

Could not connect to MySQL

 

works on gracia epilogue?

Link to comment
Share on other sites

Man write a simple php script.

 

<?php

 

$MySQL_Connection = mysql_connect("localhost", "root", root");

 

if($MySQL_Connection) {

    if(mysql_select_db("l2jdb", $MySQL_Connection)) {

              $MySQL_Action = "SELECT online FROM character WHERE online = 1";

              $MySQL_Query = mysql_query($MySQL_Action, $MySQL_Connection);

              $Number_of_rows = mysql_num_rows($MySQL_Query);

              echo("Online players: $Number_of_rows);

     }

     else {

            echo("Wrong");

     }

}

else {

     echo("Wrong");

}

 

?>

 

 

A very simple online player script!!!!

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.
Note: Your post will require moderator approval before it will be visible.

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.



×
×
  • Create New...