Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

L2J PHP essential sites for l2j based servers

Newbie Spellweaver
Joined
Jun 10, 2007
Messages
64
Reaction score
0
Hi,
i have been browsing this forum quite a long time now and I figured out that a LOT of people asking for help for PHP scripts. All are like a simple account creator or password changer to include in their website.

So I have quickly written a package containing these functions:

Account creator (createacc.php)
Password changer (changepw.php)
Onlinelist with level and charname (onlinelist.php)

There also is a config.php.

For all those who don't know how to configure it well here is a little explanation:

Open config.php with an editor.
PHP:
<?php
$L2J_config["mysql_host"]="localhost";        //your host    
$L2J_config["mysql_db"]="l2jdb";        //your database
$L2J_config["mysql_login"]="root";         //your user
$L2J_config["mysql_password"]="root";        //your pw
?>

write your host, database, user and password between the ".
For example your database name is L2JDatabase
change this line
PHP:
$L2J_config["mysql_db"]="l2jdb";        //your database
to
PHP:
$L2J_config["mysql_db"]="L2JDatbase";        //your database

do so for all other configs aswell.

host is your database host most time it is "localhost"!
database: standard name of l2j is "l2jdb"
user: your database user !!!THIS NEEDN'T TO BE ROOT IF YOU WANT TO RUN IT ON A OPEN SERVER!!!
pw/password: enter the password of your above entered user

Thats it... Have Fun :rolleyes:

Manus

PS: I'm currently working on a Dropcalculator for l2j based server... Hope to release it soon. until then...

EDIT:
Online Checker (simple)
PHP:
<?php
$serverLip="127.0.0.1";
$serverLport="2106";
$serverGip="127.0.0.1";
$serverGPort="7777";

$flogin = @fsockopen ($serverLip,$serverLport, $errno, $errstr, 1);

$fgame = @fsockopen ($serverGip,$serverGPort, $errno, $errstr, 1);


if ($flogin) 
{
 echo "Loginserver: <status style='color:#90bf00'>Online</status> |  ";
} 
else 

{
echo "<status style='color:red'>Loginserver: Offline | </status> ";

}

if ($fgame) 
{
 echo "Gameserver: <status style='color:#90bf00'>Online </status>| ";

} 

else 

{
echo "<status style='color:red'>Gameserver: Offline </status>| ";

}?>

Thanks to gosoft for the e107 plugin:
permalink : http://forum.ragezone.com/f323/php-essential-sites-for-l2j-based-servers-509171/#post4524584
 

Attachments

You must be registered for see attachments list
Last edited:
Newbie Spellweaver
Joined
May 20, 2008
Messages
24
Reaction score
0
Re: [SHARE] PHP essential sites for l2j based servers

Hi,
i have been browsing this forum quite a long time now and I figured out that a LOT of people asking for help for PHP scripts. All are like a simple account creator or password changer to include in their website.

So I have quickly written a package containing these functions:

Account creator (createacc.php)
Password changer (changepw.php)
Onlinelist with level and charname (onlinelist.php)

There also is a config.php.

For all those who don't know how to configure it well here is a little explanation:

Open config.php with an editor.
PHP:
<?php
$L2J_config["mysql_host"]="localhost";        //your host    
$L2J_config["mysql_db"]="l2jdb";        //your database
$L2J_config["mysql_login"]="root";         //your user
$L2J_config["mysql_password"]="root";        //your pw
?>

write your host, database, user and password between the ".
For example your database name is L2JDatabase
change this line
PHP:
$L2J_config["mysql_db"]="l2jdb";        //your database
to
PHP:
$L2J_config["mysql_db"]="L2JDatbase";        //your database

do so for all other configs aswell.

host is your database host most time it is "localhost"!
database: standard name of l2j is "l2jdb"
user: your database user !!!THIS NEEDN'T TO BE ROOT IF YOU WANT TO RUN IT ON A OPEN SERVER!!!
pw/password: enter the password of your above entered user

Thats it... Have Fun :rolleyes:

Manus

PS: I'm currently working on a Dropcalculator for l2j based server... Hope to release it soon. until then...

i need help plsss.. :?:

Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client in C:\AppServ\www\changepw.php on line 32
Couldn't connect to MySQL
 
Newbie Spellweaver
Joined
Jun 10, 2007
Messages
64
Reaction score
0
Re: [SHARE] PHP essential sites for l2j based servers

Why you use AppServer? Install Apache and lib-apache-php and mysql and there you go. Sorry i don't have any suggestion for this. Script works perfect

If you want to test out a prefconfigured package of Apache try Xampp

LINK:

Manus
 
Newbie Spellweaver
Joined
May 20, 2008
Messages
24
Reaction score
0
Re: [SHARE] PHP essential sites for l2j based servers

Why you use AppServer? Install Apache and lib-apache-php and mysql and there you go. Sorry i don't have any suggestion for this. Script works perfect

If you want to test out a prefconfigured package of Apache try Xampp

LINK:

Manus



forgiveness but I am noob .. which is what I have to lose all these?:?:
 
Newbie Spellweaver
Joined
Jul 24, 2005
Messages
15
Reaction score
0
Re: [SHARE] PHP essential sites for l2j based servers

Nice work !

if u need some help, or test, tell us!
 
Newbie Spellweaver
Joined
Jun 10, 2007
Messages
64
Reaction score
0
Added simple online check script using fsock
 
Newbie Spellweaver
Joined
Oct 30, 2008
Messages
34
Reaction score
1
What about this error?

Notice: Undefined index: account in C:\wamp\www\createacc.php on line 28

Notice: Undefined index: password in C:\wamp\www\createacc.php on line 29

Notice: Undefined index: password2 in C:\wamp\www\createacc.php on line 30

I've edited config file but, when i connect directly with "createacc.php" file, show me those errors, It is sth with form?
 
Newbie Spellweaver
Joined
Jun 10, 2007
Messages
64
Reaction score
0
in first line of php in createacc.php add
PHP:
error_reporting(E_ALL ^ E_NOTICE);

this is only a error if the post variable is not set. this will happen if you configured your apache alternate than i did mine. the error E_NOTICE is just a warning you can simply ignore it...

if you create a account even with the error it will work and if you created it then the errors would disappear.
 
Newbie Spellweaver
Joined
Oct 30, 2008
Messages
34
Reaction score
1
OK, ty...

I made a e107 plugin using your scripts... I share for ppl who use e107 CMS.

Credits to you and me ;D
 

Attachments

You must be registered for see attachments list
Newbie Spellweaver
Joined
Jun 10, 2007
Messages
64
Reaction score
0
thanks gosoft...
I have edited my first post and added a link to the plugin. :) thanks again
 
Initiate Mage
Joined
Feb 27, 2009
Messages
1
Reaction score
0
OK, ty...

I made a e107 plugin using your scripts... I share for ppl who use e107 CMS.

Credits to you and me ;D


If i am running my website on another machine then my gamserver, where do i have to configure the
username an pass and host and database for the script to be able to connect to my gameservers
database? im using your e107 script, it shows server status pefectly, just the make account function doesnt work atm and also the online characters etc arent shown.

xD awaiting your answer,

sincerely,

inVain
 
Newbie Spellweaver
Joined
Jun 10, 2007
Messages
64
Reaction score
0
sorry for answering that late. take a look inside the config.php ;)
 
Experienced Elementalist
Joined
Feb 20, 2009
Messages
227
Reaction score
0
when i create a account, doesnt do anything. please help?
 
Experienced Elementalist
Joined
Feb 20, 2009
Messages
227
Reaction score
0
I've fixed it, when you gonna to register, doesnt make anything, stays blank.

So

Here's the createacc.php fixed
Code:
<form id="form1" name="form1" method="post" action="">
  <table width="347" height="78" border="1">
    <tr>
      <td width="187"><label>accountname</label></td>
      <td width="144"><input type="text" name="account" id="account" /></td>
    </tr>
    <tr>
      <td><label>password</label></td>
      <td><input type="password" name="password" id="password" /></td>
    </tr>
    <tr>
      <td><span class="style1">retype password</span></td>
      <td><input name="password2" type="password" id="password2" value="" /></td>
    </tr>
  </table>
    <input type="submit" name="bttn" id="bttn" value="Submit" />
  </p>
</form>

<?php
require_once("config.php");
  $link = mysql_connect($L2J_config['mysql_host'], $L2J_config['mysql_login'], $L2J_config['mysql_password']); 
  if (!$link)
    die("Couldn't connect to MySQL");
  @mysql_select_db($L2J_config['mysql_db'], $link)
    or die ('Error '.mysql_errno().': '.mysql_error());

$account = mysql_real_escape_string($_POST['account']);
$password = mysql_real_escape_string($_POST['password']);
$password2 = mysql_real_escape_string($_POST['password2']);
if(ereg("^([a-zA-Z0-9_-])*$", $account) && ereg("^([a-zA-Z0-9_-])*$", $password) && ereg("^([a-zA-Z0-9_-])*$", $password2))
{
	if ($account && strlen($account)<16 && strlen($account)>3 && $password && $password2 && $password==$password2)
	{	
		$check=mysql_query("select * from accounts where login='".$account."'");
		$check1=mysql_num_rows($check);
		if($check1>0)
		{
			echo "error: account already existing!";
		}
		else
		{

	  		mysql_query("INSERT INTO accounts (login, password, [B][COLOR="Red"]accessLevel[/COLOR][/B]) VALUES ('".$account."', '".base64_encode(pack('H*', sha1($password)))."', 0)");
  			mysql_close($link);
	 		print '<p class="error"><b>Successfully created your account</b></p>';
		}
	}
	else
	{
  	print mysql_error();
	}
}
else
{
	echo "internal error, please try again with another accountname!";
}

?>

The red thing you have to reename that, and put this accesslevel

and you will get your createacc.php like this
Code:
<form id="form1" name="form1" method="post" action="">
  <table width="347" height="78" border="1">
    <tr>
      <td width="187"><label>accountname</label></td>
      <td width="144"><input type="text" name="account" id="account" /></td>
    </tr>
    <tr>
      <td><label>password</label></td>
      <td><input type="password" name="password" id="password" /></td>
    </tr>
    <tr>
      <td><span class="style1">retype password</span></td>
      <td><input name="password2" type="password" id="password2" value="" /></td>
    </tr>
  </table>
    <input type="submit" name="bttn" id="bttn" value="Submit" />
  </p>
</form>

<?php
require_once("config.php");
  $link = mysql_connect($L2J_config['mysql_host'], $L2J_config['mysql_login'], $L2J_config['mysql_password']); 
  if (!$link)
    die("Couldn't connect to MySQL");
  @mysql_select_db($L2J_config['mysql_db'], $link)
    or die ('Error '.mysql_errno().': '.mysql_error());

$account = mysql_real_escape_string($_POST['account']);
$password = mysql_real_escape_string($_POST['password']);
$password2 = mysql_real_escape_string($_POST['password2']);
if(ereg("^([a-zA-Z0-9_-])*$", $account) && ereg("^([a-zA-Z0-9_-])*$", $password) && ereg("^([a-zA-Z0-9_-])*$", $password2))
{
	if ($account && strlen($account)<16 && strlen($account)>3 && $password && $password2 && $password==$password2)
	{	
		$check=mysql_query("select * from accounts where login='".$account."'");
		$check1=mysql_num_rows($check);
		if($check1>0)
		{
			echo "error: account already existing!";
		}
		else
		{

	  		mysql_query("INSERT INTO accounts (login, password, [B]accesslevel[/B]) VALUES ('".$account."', '".base64_encode(pack('H*', sha1($password)))."', 0)");
  			mysql_close($link);
	 		print '<p class="error"><b>Successfully created your account</b></p>';
		}
	}
	else
	{
  	print mysql_error();
	}
}
else
{
	echo "internal error, please try again with another accountname!";
}

?>

and that will fix you're register page.:love:
 
Last edited:
Newbie Spellweaver
Joined
Jun 28, 2006
Messages
27
Reaction score
0
Wow, Nice Working!

You could also add in onlinelist.php hours of gameplay? besides the name and level

or give an example of how I could put other

type ... for the time should be "onlinetime 'no? But I do not know how to insert

I tried so it does not work

Code:
if ($ levelsort) (
$ Result = mysql_query ("SELECT char_name, from level characters WHERE online = '1 'ORDER BY level DESC");)
else
(
$ Result = mysql_query ("SELECT char_name, from level characters WHERE online = '1 '");
)
$ Result = mysql_query ("SELECT char_name, from level characters WHERE online = '1 '");
)
echo "<table>;
echo "<tr> <td> Charactername </ td> <td> Level </ td> </ tr>";
while ($ row = mysql_fetch_array ($ result, MYSQL_ASSOC)) (
$ Name = $ row ['char_name'];
$ Level = $ row ['level'];
$ Time = $ row ['onlinetime'];
echo "<tr> <td> $ name </ td> <td> $ level </ td> </ tr> <td> $ onlinetime </ td> </ tr>";

definitely something wrong, but what? pls fix code
 
Initiate Mage
Joined
Nov 30, 2014
Messages
1
Reaction score
0
sorry to resurect this thread but I really need to use the e107 plugin by gosoft. anyone installed it successfully ? or how can I add this script in e107 ?
 
Back
Top