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!

PhP based pwAdmin

Initiate Mage
Joined
Nov 29, 2015
Messages
28
Reaction score
0
I'm not a good java programmer, because i'm a noob xd. Charakter edit working fine i'm add: Gold/Donations /account create etc, Chars , how many Bans etc ( working a little bit buggy, but im work on it), Permissions like GM, Vote log/ donations logs, how many Accounts Online and their account ID and DB ID. Mail Item, Log check of all quest. World chat checker. Ill try to add more like pwadmins plugins :p But it's run more stable then this old jakarta and tomcats :eek:
 
Joined
Jul 17, 2007
Messages
665
Reaction score
103
For what purpose doing shell_exec? Php shell_exec as user account is ok but with nobody? Yes that is a joke. Running pw engine uses many resources and fastest way is using root account but as what i said before that you don't have to be root to run root's command you can do that with sudo.

i would be glad if you tell how to work around this only from php (so able to use or sudo commands in php or different user than nobody with php)

downloadable web


and video


Working:
- easy web setup wizard
- account stuff like registration/login
- user panel where can edit your user data, user search (ex. after username, truename, email, ip, gm rank,online etc)
- shouting in game chat via web
- user panel for admin (delete incative users by 1 click), adding gold who was online in last x day or atm online, change users data etc
- vote system (optional Web point or direct ingame gold), web point exchangeable and rate is what you setting up, example 100 point 1 gold, vote system configurable (vote interval, reward etc) not abuseable from a single account (checking user last vote dates before add gold or point)


*Need info*
- how can i make a proper start up, if i can figure out i can do .sh or direct start up
- how to get the 1st roleid on account (normally 32 is role 1024-(1024+15) but what happen if we talk about a new user 288 and we deleted before out 2 highest user id 288 and 304 so here the the theory not work about roleid = (user id - 16 + 1024)
*if i can figure out this then can make work the xml editing plugin by ColdShot
 
Last edited:
Junior Spellweaver
Joined
Oct 16, 2012
Messages
136
Reaction score
46
*Need info*
- how to get the 1st roleid on account (normally 32 is role 1024-(1024+15) but what happen if we talk about a new user 288 and we deleted before out 2 highest user id 288 and 304 so here the the theory not work about roleid = (user id - 16 + 1024)
*if i can figure out this then can make work the xml editing plugin by ColdShot

You don't calculate it. You send a RPC request to GameDB (rpc being: [GetUserRoles], see the config.xml in iweb for its structure)
Basically: you send a request with an account id and it returns a ArrayList with role Octets (SimpleRoleBean)

From there you just take the first item out of the array and there is your character on a user account.
I believe it was something like this

Code:
[COLOR="#0000FF"]<form [/COLOR][COLOR="#FF8C00"]name[/COLOR]=[COLOR="#4B0082"]"changechar"[/COLOR] [COLOR="#FF8C00"]method[/COLOR]=[COLOR="#4B0082"]"post"[/COLOR] [COLOR="#FF8C00"]action[/COLOR]=[COLOR="#4B0082"]"index.jsp?page=role&show=details&type=id"[/COLOR][COLOR="#0000FF"]>[/COLOR]
  [COLOR="#0000FF"]<select[/COLOR] [COLOR="#FF8C00"]name[/COLOR]=[COLOR="#4B0082"]"ident"[/COLOR] [COLOR="#FF8C00"]onchange[/COLOR]=[COLOR="#4B0082"]"document['changechar'].submit();"[/COLOR][COLOR="#0000FF"]>[/COLOR]
    <[COLOR="#FFFF00"]%[/COLOR]
     [COLOR="#006400"] // where account id is ofc the id you want it to be, for this example: 1024[/COLOR]
      [COLOR="#0000CD"]int [/COLOR]account = 1024;
      [COLOR="#006400"]// get rolevector from GameDB[/COLOR]
      [COLOR="#008000"]DataVector[/COLOR] dv = [COLOR="#008000"]GameDB[/COLOR].getRolelist(uid);
      [COLOR="#006400"]// if dv is NULL, account has no characters[/COLOR]
      [COLOR="#0000CD"]if[/COLOR](dv != [COLOR="#0000CD"]null[/COLOR])
      {
        [COLOR="#008000"]Iterator [/COLOR]itr = dv.iterator();
        [COLOR="#0000CD"]while[/COLOR](itr.hasNext())
        {
          [COLOR="#008000"]IntOctets[/COLOR] ios = ([COLOR="#008000"]IntOctets[/COLOR])itr.next();
          [COLOR="#0000CD"]int [/COLOR]roleid = ios.m_int;
          [COLOR="#0000CD"]String [/COLOR]rolename = ios.m_octets.getString();
          [COLOR="#FFFF00"]%[/COLOR]>
            [COLOR="#0000FF"]<option[/COLOR] [COLOR="#FF8C00"]value[/COLOR]=[COLOR="#4B0082"]"[/COLOR]<[COLOR="#FFFF00"]%[/COLOR]=roleid[COLOR="#FFFF00"]%[/COLOR]>[COLOR="#4B0082"]"[/COLOR][COLOR="#0000FF"]>[/COLOR]<[COLOR="#FFFF00"]%[/COLOR]=rolename[COLOR="#FFFF00"]%[/COLOR]>[COLOR="#0000FF"]</option>[/COLOR]
          <[COLOR="#FFFF00"]%[/COLOR]
        }  
      }
    [COLOR="#FFFF00"]%[/COLOR]>
  [COLOR="#0000FF"]</select>[/COLOR]
[COLOR="#0000FF"]</form>[/COLOR]

Thats how it worked in iWeb anyway. pretty simple principle

Edit: note, this was to populate the dropdown on the role editor.
 
Elite Diviner
Joined
Mar 12, 2009
Messages
472
Reaction score
59
You don't calculate it. You send a RPC request to GameDB (rpc being: [GetUserRoles], see the config.xml in iweb for its structure)
Basically: you send a request with an account id and it returns a ArrayList with role Octets (SimpleRoleBean)

From there you just take the first item out of the array and there is your character on a user account.
I believe it was something like this

Code:
[COLOR="#0000FF"]<form [/COLOR][COLOR="#FF8C00"]name[/COLOR]=[COLOR="#4B0082"]"changechar"[/COLOR] [COLOR="#FF8C00"]method[/COLOR]=[COLOR="#4B0082"]"post"[/COLOR] [COLOR="#FF8C00"]action[/COLOR]=[COLOR="#4B0082"]"index.jsp?page=role&show=details&type=id"[/COLOR][COLOR="#0000FF"]>[/COLOR]
  [COLOR="#0000FF"]<select[/COLOR] [COLOR="#FF8C00"]name[/COLOR]=[COLOR="#4B0082"]"ident"[/COLOR] [COLOR="#FF8C00"]onchange[/COLOR]=[COLOR="#4B0082"]"document['changechar'].submit();"[/COLOR][COLOR="#0000FF"]>[/COLOR]
    <[COLOR="#FFFF00"]%[/COLOR]
     [COLOR="#006400"] // where account id is ofc the id you want it to be, for this example: 1024[/COLOR]
      [COLOR="#0000CD"]int [/COLOR]account = 1024;
      [COLOR="#006400"]// get rolevector from GameDB[/COLOR]
      [COLOR="#008000"]DataVector[/COLOR] dv = [COLOR="#008000"]GameDB[/COLOR].getRolelist(uid);
      [COLOR="#006400"]// if dv is NULL, account has no characters[/COLOR]
      [COLOR="#0000CD"]if[/COLOR](dv != [COLOR="#0000CD"]null[/COLOR])
      {
        [COLOR="#008000"]Iterator [/COLOR]itr = dv.iterator();
        [COLOR="#0000CD"]while[/COLOR](itr.hasNext())
        {
          [COLOR="#008000"]IntOctets[/COLOR] ios = ([COLOR="#008000"]IntOctets[/COLOR])itr.next();
          [COLOR="#0000CD"]int [/COLOR]roleid = ios.m_int;
          [COLOR="#0000CD"]String [/COLOR]rolename = ios.m_octets.getString();
          [COLOR="#FFFF00"]%[/COLOR]>
            [COLOR="#0000FF"]<option[/COLOR] [COLOR="#FF8C00"]value[/COLOR]=[COLOR="#4B0082"]"[/COLOR]<[COLOR="#FFFF00"]%[/COLOR]=roleid[COLOR="#FFFF00"]%[/COLOR]>[COLOR="#4B0082"]"[/COLOR][COLOR="#0000FF"]>[/COLOR]<[COLOR="#FFFF00"]%[/COLOR]=rolename[COLOR="#FFFF00"]%[/COLOR]>[COLOR="#0000FF"]</option>[/COLOR]
          <[COLOR="#FFFF00"]%[/COLOR]
        }  
      }
    [COLOR="#FFFF00"]%[/COLOR]>
  [COLOR="#0000FF"]</select>[/COLOR]
[COLOR="#0000FF"]</form>[/COLOR]

Thats how it worked in iWeb anyway. pretty simple principle

Edit: note, this was to populate the dropdown on the role editor.

well this is HTML + JS/JSP use pw java libs, have you ever throw result from JS into PhP variable? Look this thread uses PhP.

My PhP Class:
Code:
/* 
* Gunse's Code 2006-2017
* shared with GPL v3 License
*/
class user_data {
	var $u_id;
	public function __construct ($uid) {
		return $this->u_id = $uid;
	}
	protected function roleid2data($rid) {
		$SendEngine = "10.11.17.1"; // ip of iweb service
		$SendPort = "8091"; // port of iweb serbvice
		$temp_dir = "/opt/www/pwweb2/wp-content/temp/"; // wordpress access folder with www-data privileges i'm using nginx web service
		$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
		if(!$sock) {
			die(socket_strerror(socket_last_error()));
		}
		if(@socket_connect($sock, $SendEngine, $SendPort)) {
			/* sending request data to java */
			$ch = curl_init(); // this is curl function from php-curl 
			$fp = @fopen($temp_dir."rid2data-".$rid,"w");
			$request_user_data = "http://10.11.17.1:8091/iweb/sendmail/roleparam.jsp?roleid=$rid"; // this is url path of iweb function the sendmail folder and its jsp are my custom made but actually they built based on common iweb function itself
			curl_setopt($ch, CURLOPT_URL, $request_user_data);
			curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
			curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
			curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
			curl_setopt($ch, CURLOPT_HEADER, 0);
			curl_setopt($ch, CURLOPT_VERBOSE, 1);
			@curl_setopt($ch, CURLOPT_FILE, $fp);
			curl_exec($ch);
			curl_close($ch);
			@fclose($fp);
			include $temp_dir."rid2data-".$rid;
			$data = array($race,$rep,$zone,$cash);
		}
		unlink($temp_dir."rid2data-".$rid);
		return $data;
	}

	public function data_gen () {
		$SendEngine = "10.11.17.1";
		$SendPort = "8091";
		$temp_dir = "/opt/www/web/wp-content/temp/";
		$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
		if(!$sock) {
			die(socket_strerror(socket_last_error()));
		}
		if(@socket_connect($sock, $SendEngine, $SendPort)) {
			$ch = curl_init();
			$fp = @fopen($temp_dir."uid2rid-".$this->u_id,"w");
			$request_userid_data = "http://10.11.17.1:8091/iweb/sendmail/rolelist.jsp?biao=1&userid=$this->u_id";
			curl_setopt($ch, CURLOPT_URL, $request_userid_data);
			curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
			curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
			curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
			curl_setopt($ch, CURLOPT_HEADER, 0);
			curl_setopt($ch, CURLOPT_VERBOSE, 1);
			@curl_setopt($ch, CURLOPT_FILE, $fp);
			@curl_setopt($ch, CURLOPT_FILE, $fp);
			curl_exec($ch);
			curl_close($ch);
			@fclose($fp);
			include $temp_dir."uid2rid-".$this->u_id;
			if ($rolelist > 0) {
				$i=0;
				while ($i < $rolelist) {
					$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
					if(!$sock) {
						die(socket_strerror(socket_last_error()));
					}
					if(@socket_connect($sock, $SendEngine, $SendPort)) {
						$rid = ${'roleid'.$i};
						$ch = curl_init();
						$fp = @fopen($temp_dir."rolelogstatus-".$rid,"w");
						$request_roleid_data = "http://10.11.17.1:8091/iweb/sendmail/rolelogstatus.jsp?roleid=$rid";
						curl_setopt($ch, CURLOPT_URL, $request_roleid_data);
						curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
						curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
						curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
						curl_setopt($ch, CURLOPT_HEADER, 0);
						curl_setopt($ch, CURLOPT_VERBOSE, 1);
						@curl_setopt($ch, CURLOPT_FILE, $fp);
						curl_exec($ch);
						curl_close($ch);
						@fclose($fp);
						include $temp_dir."rolelogstatus-".$rid;
						if ($role_status == 5) { // --- 0 = offline, 5 = online --- //
							$online_roleid = ${'roleid'.$i};
							$online_rolename = ${'rolename'.$i};
							$online_rolelevel = ${'level'.$i};
							$charname = $online_rolename;
							$charlevel = $online_rolelevel;
							$charrole = $online_roleid;
							$rolerace = $this->roleid2data($charrole);
							$rolerace = $rolerace[0];
							$rolerep = $this->roleid2data($charrole);
							$rolerep = $rolerep[1];
							$rolezone = $this->roleid2data($charrole);
							$id_data = $this->roleid2data($charrole);
							$res = array($charname, $charlevel, $charrole, $rolerace, $rolerep, $rolezone, $id_data);
							return $res;
						}
						unlink($temp_dir."rolelogstatus-".$rid);
					}
					$i++;
				}
			}
			unlink($temp_dir."uid2rid-".$this->u_id);
		}
	}
};

$winner_uid = new user_data ($uid);  // result is array of [$charname, $charlevel, $charrole, $rolerace, $rolerep, $rolezone, $id_data]
$charrole = $winner_uid->data_gen()[2];
$charname = $winner_uid->data_gen()[0];

custom code inside roleparam.jsp
Code:
<?php
$time_created=<%=role.base.create_time%>;
$cash=<%=role.user.cash_add%>;
$red_time=<%=role.status.invader_time%>;
$pink_time=<%=role.status.pariah_time%>;
$red_status=<%=role.status.invader_state%>;
$race=<%=role.base.cls%>;
$rep=<%=role.status.reputation%>;
$lvl=<%=role.status.level%>;
$exp=<%=role.status.exp%>;
$sp=<%=role.status.sp%>;
$coin=<%=role.pocket.money%>;
$zone=<%=role.status.worldtag%>;
$posx=<%=(int)role.status.posx%>;
$posy=<%=(int)role.status.posy%>;
$posz=<%=(int)role.status.posz%>;
?>

custom code inside rolelogstatus.jsp
Code:
<?php
$role_id=<%=roleid%>;
$role_status=<%=flag%>;
?>

i hope this is much more clear how to interact between other/different php application and iweb/pwadmin.



i would be glad if you tell how to work around this only from php (so able to use or sudo commands in php or different user than nobody with php)

downloadable web


and video


Working:
- easy web setup wizard
- account stuff like registration/login
- user panel where can edit your user data, user search (ex. after username, truename, email, ip, gm rank,online etc)
- shouting in game chat via web
- user panel for admin (delete incative users by 1 click), adding gold who was online in last x day or atm online, change users data etc
- vote system (optional Web point or direct ingame gold), web point exchangeable and rate is what you setting up, example 100 point 1 gold, vote system configurable (vote interval, reward etc) not abuseable from a single account (checking user last vote dates before add gold or point)


*Need info*
- how can i make a proper start up, if i can figure out i can do .sh or direct start up
- how to get the 1st roleid on account (normally 32 is role 1024-(1024+15) but what happen if we talk about a new user 288 and we deleted before out 2 highest user id 288 and 304 so here the the theory not work about roleid = (user id - 16 + 1024)
*if i can figure out this then can make work the xml editing plugin by ColdShot


i gave you example from my code for php and jsp thing.

for web service workaround, i didn't use such LAMP or XAMP or similar, i'm used to use nginx + php-fpm and its user account is www-data, what kind linux distribution you use? i'm (preferred) using ubuntu or debian.

note: iweb access service uses nginx+php-fpm reverse proxy configuration.

anyway see this reference


i guess everything will work now right?
 
Last edited:
Junior Spellweaver
Joined
Oct 16, 2012
Messages
136
Reaction score
46
gunse GiantAxe meant that you can rewrite entire iweb from Java to PHP basing on same principles (RPC and config.xml file). It's actually way nicer way than wgetting Java scripts with PHP.
http://forum.ragezone.com/f752/pxweb-986763/

That's what i ment yes.
Or, option B is to decompile iweb to java source files and just fix up the java iweb.
(Which really isn't that difficult tbh)
 
Elite Diviner
Joined
Mar 12, 2009
Messages
472
Reaction score
59
Elite Diviner
Joined
Mar 12, 2009
Messages
472
Reaction score
59
That's what i ment yes.
Or, option B is to decompile iweb to java source files and just fix up the java iweb.
(Which really isn't that difficult tbh)
This is what i mean i don't have to bother "rewrite" that already exist, it is not difficult for you... Others? We don't know... I wrote small class and add small thing and well done ;)

 
Junior Spellweaver
Joined
Oct 16, 2012
Messages
136
Reaction score
46
BTW, is there anyone rewrite iweb/pwadmin with :)

I take it thats to parse a role.xml?

If so, you will have to create classes for all the partial models that the xml is made out of.
GRoleInventory, GRoleBase, GRoleStatus, etc. to properly parse it.

Which again...involves decompiling the Java Iweb to get all the classes for it.
Actually, you can get the structures from the iweb config.xml.

We can't force you to do anything you don't want to. But really you should look into creating a PHP Socket Client and just call the rpc's yourself.
(If you were to do that you could do way more more stuff)


Although that said... there is a 3rd option you could try.
namely this (Thanks Google)

Add that to Iweb (nothing more then adding the .jar file in the lib folder)
Create a new jsp page and make that page call the GameDB.get() function. this gives you a Java RoleBean
Then use the GSon plugin to convert the rolebean to JSON and make PHP call for the JSON page instead.
(JSON is far easier to parse then XML for instance)
see my example:

That's just my 2 cents though.
 
Elite Diviner
Joined
Mar 12, 2009
Messages
472
Reaction score
59
I take it thats to parse a role.xml?

If so, you will have to create classes for all the partial models that the xml is made out of.
GRoleInventory, GRoleBase, GRoleStatus, etc. to properly parse it.

Which again...involves decompiling the Java Iweb to get all the classes for it.
Actually, you can get the structures from the iweb config.xml.

We can't force you to do anything you don't want to. But really you should look into creating a PHP Socket Client and just call the rpc's yourself.
(If you were to do that you could do way more more stuff)


Although that said... there is a 3rd option you could try.
namely this (Thanks Google)

Add that to Iweb (nothing more then adding the .jar file in the lib folder)
Create a new jsp page and make that page call the GameDB.get() function. this gives you a Java RoleBean
Then use the GSon plugin to convert the rolebean to JSON and make PHP call for the JSON page instead.
(JSON is far easier to parse then XML for instance)
see my example:

That's just my 2 cents though.
Well, that's a ton thing todo ;)

 
Joined
Jul 17, 2007
Messages
665
Reaction score
103
Noob question but If I have tomcat and separate appache the gamedb.js must be in tomcat folder if I want call it ,?
(Simple if I put both(PHP n JSP) in same www directory not worked

(XML RPC new to me, never used it, sound Interesting but maybe my knowledge too low for it,)

About nginx If I cannot make appache work then will try nginx, I hope it's easily portable like xampp
 
Elite Diviner
Joined
Mar 12, 2009
Messages
472
Reaction score
59
Noob question but If I have tomcat and separate appache the gamedb.js must be in tomcat folder if I want call it ,?
(Simple if I put both(PHP n JSP) in same www directory not worked


About nginx If I cannot make appache work then will try nginx, I hope it's easily portable like xampp
Your apache have to be reverse proxy for php to be run, and your jsp have to be run by your tomcat.. You can meet them on approach that i already gave as an example.

 
Elite Diviner
Joined
Mar 12, 2009
Messages
472
Reaction score
59
When you use apps from os distribution it is easy to update or upgrade but losing portability as you said. Otherwise you'll be in trouble if your xampp stuff is not complete as what you need or you have to add something on that xampp package...

 
Initiate Mage
Joined
Nov 29, 2015
Messages
28
Reaction score
0
Its not trickable with disconnect disconnect from ISP and reconnect and automatically you have new IP?


This is the reason why normal "IP v4" ban is not possible. Teemo how u made the ban script lmao ( only ip4) ?
 
Back
Top