Post Pacific

Post Pacific (https://postpacific.mmorpg-game.online/index.php)
-   Lineage 2 Server Modifications ONLY! (https://postpacific.mmorpg-game.online/forumdisplay.php?f=28)
-   -   [Share]L2 admin on php (https://postpacific.mmorpg-game.online/showthread.php?t=6121)

twzenit 14.11.2006 10:20

when I chose 16, it asked my the same option of 15. Strange...and when I input charname it shows a empty page... any idea what wrong with it?

twzenit 14.11.2006 10:23

also beside 2012 what other port it use? I don't see any other port should be open for it. You tested on single machine or 2 machines(cached is in a seperate machine)

Dmytro 15.11.2006 21:33

Quote:

Originally Posted by twzenit (Post 72282)
when I chose 16, it asked my the same option of 15. Strange...and when I input charname it shows a empty page... any idea what wrong with it?

... in (16) you may put not char name - char ID !!!!
id = 123 for example

Charis 17.11.2006 15:47

I can not make DelItem function work (13).
It returns 01 all the time.

Does anybody succeded in using it?

I'm using a little different code, but an original doesn't seems to work too.

Code:

function ansi2unicode($string) {
    $rs = ""; for($i = 0; $i < strlen($string); $i++) $rs .= $string[$i].chr(0);
    return($rs.chr(0).chr(0));
}

function l2_cached_push($buf){
$cached_ip = "127.0.0.1";
$cached_port = "2012";
$fp = fsockopen($cached_ip, $cached_port, $errno, $errstr, 5); $rs = "";
if(!$fp)return 0;
else{
    fwrite($fp, pack("s", (strlen($buf)+2)).$buf);
    $len = unpack("v", fread($fp, 2)); $rid = unpack("c", fread($fp, 1));
    for ($i = 0; $i < (($len[1]-4) / 4); $i++) { $read = unpack("i", fread($fp, 4)); $rs .= $read[1]; }
    stream_set_timeout($fp, 2);
    $answ=$rs;
    fclose($fp);
    return "$answ";
  }
 }

function l2_delItem ( $webadmin, $char_id, $warehouse, $item_id, $amount) {
    $cached_op = pack("c", 13);
    $cached_op .= pack("i", $char_id);
    $cached_op .= pack("i", $warehouse);
    $cached_op .= pack("i", $item_id);
    $cached_op .= pack("i", $amount);
    $cached_op .= ansi2unicode ( $webadmin );
  $rs = l2_cached_push ($cached_op);
  return ( $rs );
}

$adena_id is an item id for Adena in char inventory, not the item_type.
$changeacccost - some value like 10000.
Code:

$answ = l2_delItem ( $_COOKIE['login'], $char_id, 0, $adena_id, $changeacccost);
$answ is always "01" :(

Function like Kick and MoveChar is working... But DeleteItem - does not :(

Kenjiro 18.11.2006 16:50

I use DelItem2:
Code:

function l2_delitem2 ( $item_id, $amount ) {
  // 54 - DelItem2, char_id, item_id
  $cached_op = pack ( "cVVV", 54, $item_id, $amount, 1 );
  $cached_op .= ansi2unicode ( "webadmin" );
  $ret_string = l2_cached_push ( pack ( "s", strlen ( $cached_op ) + 2 ) . $cached_op );
  return ( $ret_string );
}

You must remember that You can not delete more $amount, than You have in one item_id.

Charis 19.11.2006 01:23

Quote:

$cached_op = pack ( "cVVV", 54, $item_id, $amount, 1 );
What for is 1 in the end of the statement? o_O

Kenjiro 20.11.2006 07:11

I do not know, but without this it won't work.

LoVeRSaMa 20.11.2006 09:29

Suggestion: Quick Item Addition, Drop down menu for S grade A grade ect, it will not be to hard.

whwwhw 24.12.2006 22:22

I got this error while trying to edit new item:
I changed Cached to 2006 Port ( As it came from Rz )

Warning: unpack(): Type v: not enough input, need 2, have 0 in c:\appserv\www\functions.php on line 108

Warning: unpack(): Type c: not enough input, need 1, have 0 in c:\appserv\www\functions.php on line 108
Kicked:

Warning: unpack(): Type v: not enough input, need 2, have 0 in c:\appserv\www\functions.php on line 98

Warning: unpack(): Type c: not enough input, need 1, have 0 in c:\appserv\www\functions.php on line 98
Item added:

AsterisKSM 24.12.2006 23:19

me 2!.........

DevilsAssociate 25.12.2006 09:27

Hel
if you make another version this one is kinda useful

displays all the chars from an account by entering the account name

Code:

<option value=203>--Get char name from an account--</option>
Code:

                case 203:
                        $get_account_name=htmlspecialchars($_POST["param1"]);
                        if(strlen($get_account_name)<1){ ?>
                                <form method='post' action='cached.php'><b>Get char on an account: </b>
                                <br>Enter account name:<input type='text' name='param1'><br><input type='hidden' name='funcid' value='203'>
                                <br><input type='button' value='Go' onclick='doSpecialFunc()'></form><?php }
                        else{
                                $con_sql=mssql_connect($mssql_host,$mssql_user,$mssql_pass);
                                mssql_select_db($mssql_base,$con_sql);
                                $result=mssql_query("SELECT char_name FROM user_data WHERE account_name='$get_account_name'");
                                while($row=mssql_fetch_array($result)) { print "$row[0]<br> $row[99]";
                                }
                                mssql_close($con_sql);}
                        break;


rodier 31.12.2006 21:57

Quote:

Originally Posted by twzenit (Post 72277)
15. Getting char id by char name, directly from db. (tested)
16. Showing char invertory and warehouse by char id, directly from db. (tested)

Those 2 when I click go they return with empty page, and it does not send message to cached.exe

Any idea why?

I have same problems.. every other functions work OK, but this two not.
If I chose function 16. it show me text from function 15
and when I chose function 15, I wrote charid 1 (its my character) then Go and nothing..
-----------------
its really broken, look:

Code:

                case 200:
                        $get_char_name=htmlspecialchars($_POST["param1"]);
                        if(strlen($get_char_name)<1){ ?>
                                <form method='post' action='cached.php'><b>Get char id by char name: </b>
                                <br><input type='text' name='param1'><br><input type='hidden' name='funcid' value='200'>
                                <br><input type='button' value='Go' onclick='doSpecialFunc()'></form><?php }
                        else{
                                $con_sql=mssql_connect($mssql_host,$mssql_user,$mssql_pass);
                                mssql_select_db($mssql_base,$con_sql);
                                $result=mssql_query("SELECT char_id FROM user_data WHERE char_name='$get_char_name'");
                                while($row=mssql_fetch_array($result)) echo($row["char_id"]);
                                mssql_close($con_sql);}
                        break;
                case 201:
                        $get_char_id=htmlspecialchars($_POST["param1"]);
                        if(strlen($get_char_id)<1){ ?>
                                <form method='post' action='cached.php'><b>Get char id by char name: </b>
                                <br><input type='text' name='param1'><br><input type='hidden' name='funcid' value='201'>
                                <br><input type='button' value='Go' onclick='doSpecialFunc()'></form><?php }
                        else{
                                $con_sql=mssql_connect($mssql_host,$mssql_user,$mssql_pass);
                                mssql_select_db($mssql_base,$con_sql);
                                $result=mssql_query("SELECT item_id, item_type, amount, warehouse FROM user_item WHERE char_id='$get_char_id'");
                                while($row=mssql_fetch_array($result)){echo(ItemNameByItemId($row["item_type"])."(".$row["amount"].") --> warehouse: ".$row["warehouse"]." --> "."item uid: ".$row["item_id"]."<br>");}
                                mssql_close($con_sql);}
                        break;


rodier 31.12.2006 22:03

I think someone simply dont make it 100% done..
because there is
<br><input type='button' value='Go' onclick='doSpecialFunc()'>

Instead onclick=AnyRealFunction..

rodier 01.01.2007 01:30

hmm I dont know php too much, so I changed it alittle bit..
simply I changed it to normal form where u insert name of player and it will forward to another my php code where it will change to ID ;] (I dont know code too much so I dont know how to merge it :-DD )

Code:

case 200:
                        $get_char_id=htmlspecialchars($_POST["param1"]);
                        if(strlen($get_char_id)<1){ ?>
                                <form method='get' action='charid.php?char='><b>Get char id by char name: </b>
                                <br><input name='char' size='10' value=''>
                                <br><input type='submit' value='odeslat'></form><?php }
                        break;


charid.php

Code:

<?php

include("config.php");

echo "<html><head></head>
<style type=text/css>
A:link {
COLOR: #dd6900;
}
A:visited {
        COLOR: #dd6900;
}
A:hover {
        COLOR: #dd6900;
}
A:active {
        COLOR: #dd6900;
}
    body, html { font-size: 5px; background-color: black; margin: 0px; margin-top: 5px; margin-bottom: 5px; color: #dd6900; }
    td { margin: 0px; padding: 0px; font-size: 14px; font-family: Tahoma, Verdana, Arial; color: #dd6900; }
    .tbl_mainpage { width: 700px; margin: auto; border: 0px #5b5b5b solid; background-color: black; color: #dd6900; }
    .tbl_title { height: 40px; font-size: 20px; text-align: center; vertical-align: middle; }
    .tbl_time { text-align: center; height: 20px; border-bottom: 1px #dd6900 solid; color: ##dd6900; }
    .tbl_head { border-bottom: 1px black solid; }
    .tbl_female { background-color: #660000; clear: both;}
    .tbl_male { background-color: #000000; clear: both; }
    .tbl_charord { width: 30px; text-align: center; border-right: 1px #dd6900 solid; }
    .tbl_charname { width: 300px; text-align: center; border-right: 1px #dd6900 solid; border-left: 1px #dd6900 solid;}
    .tbl_charclass { width: 100px; text-align: center; border-right: 1px #dd6900 solid; }
    .tbl_charlevel { width: 30px; text-align: center; border-right: 1px #dd6900 solid; }
  </style>
  <table class=tbl_mainpage cellspacing=0 cellpadding=0 align=center>
  <tr>
    <td class=tbl_charclass tbl_head><b>Char Name</b></td>
    <td class=tbl_charclass tbl_head><b>Char ID</b></td>
    </tr>";
  mssql_select_db("lin2world");
  $mssql["result"] = mssql_query("declare @char int; set @char = (select char_id from lin2world..user_data where char_name = '$_GET[char]'); select char_id, char_name from user_data where char_id = @char");
  $i = 0;
  while($mssql["entry"] = mssql_fetch_array($mssql["result"])) {
    $i++;

  echo "
      <td class=tbl_charclass>".$mssql[entry][char_name]."</center></td>
      <td class=tbl_charclass>".$mssql[entry][char_id]."</center></td>
    </tr></table></body></html>"; }
?>



config.php

Code:

<?php

  header("Expires: ". gmdate("D, d M Y H:i:s")." GMT");

  $mssql["server"] = "hyperjadro"; 
  $mssql["user"] = "";
  $mssql["password"] = "";
  $mssql["database"] = "lin2db";
  $mssql["die"] = "Error in connection to MS SQL";
  mssql_connect($mssql["server"], $mssql["user"], $mssql["password"]); // or die($mssql["die"])
  mssql_select_db($mssql["database"]);
?>


[DeV/NuLL] 02.01.2007 17:22

My CP
 
Here is my little CP Demo. If you have enough PHP programming skills, possably some C, C++ or C#, you can create a complete and automated system to manage your L2 Server.

For example, the best practice is create one class to connect with the CacheD Server, and use this class to execute any operation on it, of course you will add some logs to those operations, because you are a professional Developer (aren't you?).

If you are not a professional programmer, then you should look for one, learn to code in PHP or some other language or possibly try to buy some code.

Here is the Login form:
http://img405.imageshack.us/img405/7...ogincr8.th.jpg

Main Administrator Control Panel Page (HGM has another interface, same thing for GMs, the system recognizes different types of Builders).
http://img509.imageshack.us/img509/4...dminol6.th.jpg

The Administrator Accounts Manager
http://img458.imageshack.us/img458/2...untsqs6.th.jpg

Add Item to Char (Recognice the characters name instead the Char ID)
http://img175.imageshack.us/img175/1...itemxx7.th.jpg

Continue in next Post

[DeV/NuLL] 02.01.2007 17:23

My CP 2
 
Add Item to Char Step 2
http://img46.imageshack.us/img46/870...tep2pu1.th.jpg

Add Item Results
http://img297.imageshack.us/img297/8...tep3gr0.th.jpg

Delete Item from Character (Char Name again)
http://img360.imageshack.us/img360/2...itemso6.th.jpg

Delete Item results
http://img360.imageshack.us/img360/6...tep2uc9.th.jpg

Our CP allows many more actions, like Look-up all characters connected from the same IP, all accounts with same IP, Pledge Management, Donations management allowing add or del (or both) items to any char with only one click.

Our code is strongly Object Oriented so add plenty of security on sessions and SQL Injection.

You can do all you want if you know how to do it, all the Packets functions work, except some ones that crash the CacheD due a Buffer Overflow on cached Administrative socket.


Greetings.

AsterisKSM 02.01.2007 18:04

Why dont u share your CP :P

[DeV/NuLL] 02.01.2007 18:18

Cause is completely integrated into our Forum-Game-Main Page system, we use external C++ Applications to automate some managament at server so this work was really hard to separate one piece and share it.

Anyway I can give you some explanations about some good PHP coding practices, like use Objects to store RQUEST variables and prevent any type of SQL Injection.

www.php.net/manual/en <--------- Your best friend.

Shraier 10.01.2007 15:40

Quote:

Originally Posted by TheOrder (Post 71682)
:lol: In the folder you have L2Server Folder , L2NPC Folder etc you showld also have a folder named CachedScript in it must be itemcache.txt for C4 PTS Server !

Here is the folder : http://download.yousendit.com/8D156D0746821F66

Enjoy ...

Thanks Hel for the Share !

Can you reshare cachedscripts?
Thanks in advance and thanks hel for the share..

hel 15.01.2007 16:17

Sorry, but my project is closed. I was left community 3 months ago.
Wish to all get full off c5 server and be happy. ;)

khongtuong 29.01.2007 20:11

hmm, i cant download attach file

rodier 05.02.2007 14:24

please what command for l2 cached is for set player to hero?
or it is possible to set hero in game to player via GM commands?

edit:

or is there l2cached command like announcement? if I want announce something via web? and not game?

empathon 05.02.2007 15:52

Quote:

Originally Posted by rodier (Post 77469)
edit:

or is there l2cached command like announcement? if I want announce something via web? and not game?

https://postpacific.mmorpg-game.onli...31&postcount=6

scrap512 25.03.2007 20:51

Thanks alot going to install it now

seraphii 25.03.2007 21:13

Check your php script. you try to send invalid commands.

scrap512 25.03.2007 22:26

Quote:

Originally Posted by seraphii (Post 82263)
Check your php script. you try to send invalid commands.

well its all the commands in this l2 admin even the change name or add item or even kick player. :( any ideas guys ?

scrap512 29.03.2007 18:41

I get this error in CACHED when i try anyhting in this l2 admin.

packet checksum is differnt. protocol[5], len[17], check[-2]


can anyone help ?

scrap512 02.04.2007 12:42

Quote:

Originally Posted by scrap512 (Post 82533)
I get this error in CACHED when i try anyhting in this l2 admin.

packet checksum is differnt. protocol[5], len[17], check[-2]


can anyone help ?

bump , help :-(

rodier 25.04.2007 21:22

hel Im trying your l2admin but its seems very buggy :-( in Seamonkey (mozilla) I can click on choose and select function.. but cliking on "ok" to send function = nothing

in IE 7 on my computer I can't even choose any function on IE 7 on server I can select function, insert data, click on OK..but then white page without nothing and no change in db..... where is problem??

in IE 6 it work OK ..

RetaL 26.04.2007 12:43

Quote:

Originally Posted by rodier (Post 84677)
hel Im trying your l2admin but its seems very buggy :-( in Seamonkey (mozilla) I can click on choose and select function.. but cliking on "ok" to send function = nothing

in IE 7 on my computer I can't even choose any function on IE 7 on server I can select function, insert data, click on OK..but then white page without nothing and no change in db..... where is problem??

in IE 6 it work OK ..

This script didn't work anywhere for me except my IE7.

FidoW 26.04.2007 14:05

Quote:

Originally Posted by rodier (Post 84677)
hel Im trying your l2admin but its seems very buggy :-( in Seamonkey (mozilla) I can click on choose and select function.. but cliking on "ok" to send function = nothing

in IE 7 on my computer I can't even choose any function on IE 7 on server I can select function, insert data, click on OK..but then white page without nothing and no change in db..... where is problem??

in IE 6 it work OK ..

The last time i take a look to this script seens like he want to use ajax but isnt coding it properly... only works with IE6 and not in Firefox

Guaresnay 30.04.2007 17:30

I have a fully working l2admin but i can't share it since I used some of hel's functions and I need his authorization to share them in my script.

http://img122.imageshack.us/img122/395/l2adminae1.png

amberhand 30.04.2007 19:59

Nice to see L2Novus developer here :>

~Marquis~ 30.04.2007 21:41

Quote:

Originally Posted by Guaresnay (Post 85017)
I have a fully working l2admin but i can't share it since I used some of hel's functions and I need his authorization to share them in my script.

http://img122.imageshack.us/img122/395/l2adminae1.png

hel actually stopped deving and drop this project, dunno how you can contact him

Guaresnay 30.04.2007 22:25

yeh i tryed by PM but nothing :(

Sauron 30.04.2007 22:31

Quote:

Originally Posted by Guaresnay (Post 85017)
I have a fully working l2admin but i can't share it since I used some of hel's functions and I need his authorization to share them in my script.

http://img122.imageshack.us/img122/395/l2adminae1.png


que raro vos leecheando del laburo de otros :rolleyes:

[eng] welldone (?)

Guaresnay 30.04.2007 22:33

ah bue, cara dura ¬¬
JAMAS leeche nada en mi vida :)

Sauron 30.04.2007 22:37

noto una contradiccion en tus ultimos 2 post.

[eng] lier

Guaresnay 30.04.2007 22:41

Well i won't discuss with an idiot i was just wondering if hel authorizes me to share some of his functions (2 or 3) with my script, that's all.

hel 04.05.2007 10:55

Quote:

Originally Posted by Guaresnay (Post 85051)
Well i won't discuss with an idiot i was just wondering if hel authorizes me to share some of his functions (2 or 3) with my script, that's all.

You can share it. Those functions aren't my, so every people can use it for non-commercial purposes and sharing for free.


All times are GMT. The time now is 16:22.