PDA

View Full Version : [Share]L2 admin on php


hel
31.10.2006, 13:44
L2 Admin 0.4.1 - Lineage2 administration tool, writen on php by hel.

---------------------------Changelog---------------------------
fixed:
-- DeleteItem (not fully tested)
-- A lot of optimizing in code, since last version (tested)
-- Tested and fixed some modules
added:
-- see specifications list from 10 to 14, and 16.
-- Basic ip-security.

---------------------------Specifications list---------------------------
1. Check user, online or not (tested)
2. Change user nickname (tested)
3. Kicking user (tested)
4. Add item with enchant (tested)
5. Delete item from user (not tested ingame, but theoreticaly working)
6. Modify user face, hairs, race, class, etc (tested)
7. Punish user (tested)
8. Move user to another account (tested)
9. Change clan owner to selected user (not working)
10. Increasing user sp, exp, karma, pk, pvp (tested)
11. Setting user sp, exp, karma, pk, pvp (tested)
12. Show announce (tested)
13. Set user sociality (be care with it, it's crashing cached!)
14. Set GM rights to user (not tested ingame, but theoreticaly working)
15. Getting char id by char name, directly from db. (tested)
16. Showing char invertory and warehouse by char id, directly from db. (tested)

---------------------------Tips---------------------------
"not tested ingame, but theoreticaly working" - it's mean, that's cached return OK (1). But not tested ingame.

---------------------------Other---------------------------
*. Basic ip security. For change - open functions.php via notepad and edit:
-- $list_allow=array("127.0.0.1","1xx.xx8.0.1");

---------------------------How to install---------------------------
You must have Apache newer than 1.3.32 version and PHP newer than 4.0.1 version, with uncommented module php_mssql.dll.
1. Extract archive L2_Admin_0.4.rar in any folder on web-server.
2. Edit white list of IPs, for allow view L2Admin page, in functions.php (see --other-- section in readme).
3. Edit file "config.php".
4. Now you can use this script, for do it you can go on http://www.myhost.ru/path_to_script/index.php.


---------------------------Thanks---------------------------
Thanks to all contributors and helpers.
Especially to Barabashka, Astrid, ZeonDi, Kenjiro and others, actively helping...

Any bug reports and solutions will be very nice...

Вложения из исходного сообщения (сами файлы в копии отсутствуют):
L2_Admin_0.4.1.zip — 69906 байт

Majesty
31.10.2006, 13:59
You also expecting problems with "delete item from user" packet?
Which packet are you used? I'm used 54 DelItem2Packet("ddS"), and didn't get any results. Cached returns "01", item not deleted.

hel
31.10.2006, 14:07
Majesty:
Same problem as your...
But I'm using DelItemPacket [13]...
But if player online, and I'm using that packet - it returns me 1, but don't delete item. 8(

Majesty
31.10.2006, 14:23
Majesty:
Same problem as your...
But I'm using DelItemPacket [13]...
But if player online, and I'm using that packet - it returns me 1, but don't delete item. 8(

"1" or "01" ?
For really working, tested functions return are "1". (kick_char, etc)

hel
31.10.2006, 14:42
"1" or "01" ?
For really working, tested functions return are "1". (kick_char, etc)
If char offline, script returns 01 and don't delete item.
But if char online, script returns 1 and don't delete item.

Majesty
31.10.2006, 14:51
If char offline, script returns 01 and don't delete item.
But if char online, script returns 1 and don't delete item.

IMHO, char must be offline.
Two packets, two functions - and same errors...

Ameron
31.10.2006, 15:39
Well, I use 54 DelItem2Packet also, but sometimes it delete item, sometime not :(
why - dunno.
hel, if you wanna help - contact me.
Have a desire to write normal L2-admin :)

barabashka
31.10.2006, 15:45
13 DeleteItemPacket works fine. but when function return error, just repeat sending packet 1-2 times.

zlopi
31.10.2006, 19:43
4. Add item with enchant (adding item, when user offline) (tested)
5. Delete item from user (deleting item) (bugged?)
not work :-(

return 01

Majesty
31.10.2006, 20:05
2 hel:


function delete_item($id,$item_warehouse,$item_id,$item_amo unt,$char_name){

kick_char($id,$char_name);


$buf = pack("c", 13); //
$buf .= pack("i", $id); //char_id
$buf .= pack("i", $item_warehouse);
$buf .= pack("i", $item_id);
$buf .= pack("i", $item_amount);
$buf .= tounicode ( "GM" );

$answ=cached_new($buf);

if($answ==="x1")return "Item was successfully deleted.";
else return "<font color=red>Error:</font><font class=log_text>$answ</font> deleting item.";
}
Don't know, why my function didn't work 4 hours ago. Now, working fine.

paul
31.10.2006, 21:14
Intresting program =D

I'm having problems with the add item code though. It just wont do it. Cached shows a connection then throws out error 997 everytime i try.

astrid
01.11.2006, 00:44
hel, you use item id (item type 57 for adena f.e.) or item uid (unique identity from user_item table) in del item packet?

it should be item uid from database and user must be offline in time of use this packet.

poltomb
01.11.2006, 04:02
7. Punish user (founded only one punish type - stopsay... worked, when user online) (tested)


There is a command (don't know function name) //char_stop. If you can fid a function for this command then you can stop the user from moving (only can chat) for a period of time.

paul
01.11.2006, 10:09
nevermind my post i got it workin (i'm an idiot and didn't load itemcache hehe)

hel
01.11.2006, 10:11
poltomb:
It's not StopCharPacket?

astrid:
O_O
Wasn't know it earlier...
Do you know, how to get unique id, using itemdata id (or item_pch)?
But... Additem uses item_id from itemdata?

Domzelan
01.11.2006, 10:38
Hel can u make kick before send command.
Rus: Можешь сделать чтобы перед каждой командой кикало принудительно и банило на 1-2 минуты? И когда используешь модифицировать перса выбераешь ID чара - далее вылетает окно которое щас вылетает и там сразу показывается имя чара его тип волос его класс далее меняешь что надо и далее жмешь применить и всё меняется? или если я оставляю поле пустым оно не меняется? допустим мне надо сменить только класс перса вбиваю только class остальное пустое оставляю - поменяется только класс?

zlopi
01.11.2006, 10:42
2 hel:
$buf .= tounicode ( "GM" );

GM must be in online

hel
01.11.2006, 11:10
Hel can u make kick before send command.
Rus: Можешь сделать чтобы перед каждой командой кикало принудительно и банило на 1-2 минуты? И когда используешь модифицировать перса выбераешь ID чара - далее вылетает окно которое щас вылетает и там сразу показывается имя чара его тип волос его класс далее меняешь что надо и далее жмешь применить и всё меняется? или если я оставляю поле пустым оно не меняется? допустим мне надо сменить только класс перса вбиваю только class остальное пустое оставляю - поменяется только класс?
Of course, not so hard...
Посмотрю... Но только после того, как отдохну после написания этого скрипта.

Majesty
01.11.2006, 11:30
GM must be in online

hmm... Then GM is offline, all functions is working too.

astrid
02.11.2006, 00:26
astrid:
O_O
Wasn't know it earlier...
Do you know, how to get unique id, using itemdata id (or item_pch)?
But... Additem uses item_id from itemdata?

make simple query to user_item table.

something like:

SELECT user_item.item_id as uid FROM user_item INNER JOIN user_data ON user_item.char_id = user_data.char_id WHERE (user_item.item_type = "+itemid+") AND (user_data.char_id = "+charid+") and user_item.warehouse="+warehouse

i suggest you to make stored procedure in db if you use it often.

//rus
с моим английским хрен что поймешь наверно :) короче просто нужно сделать запрос что я привел выше (синтаксис не пхпшный но я думаю понятна суть). если используешь часто заведи сторед процедуру в БД.
additem2 использует просто итемид (тип предмета) 57 для адена например.

top-gear
02.11.2006, 03:20
it would be better if we could ad a user/pass field with ip verification so none can exploit the scripts

hel
02.11.2006, 05:28
make simple query to user_item table.

something like:

SELECT user_item.item_id as uid FROM user_item INNER JOIN user_data ON user_item.char_id = user_data.char_id WHERE (user_item.item_type = "+itemid+") AND (user_data.char_id = "+charid+") and user_item.warehouse="+warehouse

i suggest you to make stored procedure in db if you use it often.

//rus
с моим английским хрен что поймешь наверно :) короче просто нужно сделать запрос что я привел выше (синтаксис не пхпшный но я думаю понятна суть). если используешь часто заведи сторед процедуру в БД.
additem2 использует просто итемид (тип предмета) 57 для адена например.

Will be in next build. Thanks!

Kenjiro
02.11.2006, 07:14
Working delete2 function:


function l2_delitem2 ( $item_id, $amount ) {
// 54 - DelItem2, item_id, amount
$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 );
}


Variable $item_id is from user_item table.

hel
02.11.2006, 08:03
Working delete2 function:


function l2_delitem2 ( $item_id, $amount ) {
// 54 - DelItem2, item_id, amount
$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 );
}


Variable $item_id is from user_item table.
Thanks!
Will add this function in the next build!
PS: Got it from L2z? ;)

Could anyone explain, how different "V" and "i" in pack() function? :wave:

Domzelan
02.11.2006, 08:56
Ready to test new build :)

mastery
02.11.2006, 12:34
doesnt work for me... on change user parameters when i push go nothings happend.. on check char online and get nabe by id it gets me blank screen...

hel
03.11.2006, 01:53
mastery:
What php and apache you're using?
I heard that error appearing on easyphp.
I was tested on standart builds of php (4.3.8, 5.0.1) and apache (1.33 and 2.0.52), which I'm using, it working perfectly...

Kenjiro
03.11.2006, 08:10
Thanks!
Will add this function in the next build!
PS: Got it from L2z? ;)

Nope, try&errors method ;)

Could anyone explain, how different "V" and "i" in pack() function? :wave:
From php manual:
i signed integer (machine dependent size and byte order)
V unsigned long (always 32 bit, little endian byte order)

Option 'i' could give 64bit output, if php has been compiled in 64bit mode (i have 32bit php/apache/mysql binaries, thus it gives the same as 'V'). Option 'V' (in my opinion) is safer than 'i' (for future releases).

zlopi
04.11.2006, 00:43
Works DelItemPacket("ddddS")

$msql="SELECT amount FROM user_item WHERE item_id=$item_id";
$item=mssql_fetch_array(mssql_query($msql));
$command=pack("ciiii",13,$char_id,0,$item_id,$item[amount]);

hel
04.11.2006, 05:36
New build released, added readme.txt inside archive for russians.

hel
04.11.2006, 07:43
New build 0.4.1 with some tested and fixed functions released.

Ma4o
04.11.2006, 09:28
New build released, added readme.txt inside archive for russians.

Thx, Hel.
rus: спасиб, за русик.

mastery
04.11.2006, 17:19
Warning: Cannot modify header information - headers already sent by (output started at C:\wwwroot\httpd-2.2_x64\htdocs\a\admin\index.php:2) in C:\wwwroot\httpd-2.2_x64\htdocs\a\admin\index.php on line 2
and i got blank page

im using x64 versions of PHP-5.1.5-x64-2006-08-18 and apache 2.2.3_x64... everything else works..

do i require something else to be installed to get this working? im also chech this script on Cherokee webserver, same errors... on same machine...

hel
04.11.2006, 17:57
Try to delete "header(.......);" strings at top from all scripts...
As I understand 5.0.0+ php don't support this format of function...
On 4.3.8 php it's working greatly... :-\

mastery
04.11.2006, 18:23
yes i fix that but anyway it doesnt work on my machine ((( also it doestn work with php 4.3.9

why i got blank page.. can it be becourse ajax u used? is it needet?

Dmytro
04.11.2006, 18:38
Try to delete "header(.......);" strings at top from all scripts...
As I understand 5.0.0+ php don't support this format of function...
On 4.3.8 php it's working greatly... :-\

No, not "header()".
When PHP open page, it see "<!-- ... -->", and construct default header, and after that you try to construct you own header, when it's already exists. =)
Delete "<!-- ... -->" or write after "header()" your comment and all bee good. =)

m4rk
04.11.2006, 18:55
I solved the header error by just putting it that way:

<?php header('Content-type: text/html; charset=windows-1251');
include("functions.php");IpSecurity($_SERVER['REMOTE_ADDR']);$i=1;?>
<title>...</title
<!-- ... -->

mastery
04.11.2006, 20:25
hm.. it works only on internet explorer... i was trying on firefox )...
can u add to function to reset all skills then vhanging class, and checkbox to set_skill_all command, it will be very nice...
one thing, u need to change subjob0_class row then changing class row, or user will crash on login...
anyway, thanx for your work..

zekillers
04.11.2006, 22:15
yeah. Lets not over complicate things. I think we should remove any ajax or over complicated javascript, as it should be working with firefox.

PsychoBR
05.11.2006, 15:08
Hello People, i have one problem:

Kicked: OK.
Item added: Error.


I cant add itens, its all ok, just the add item function isn't working.
Thnx for the help, cya!

EDIT: The CacheD returns error 997.
Thnx for help

zekillers
05.11.2006, 22:34
Im working with someone to add a secure login, remove all ajax, make things easier by selecting a character before being shown the features.
Also working on a design

twzenit
06.11.2006, 04:52
on cached:
admin sever closed (ipX.x.x.X) error 997

what is wrong with this. It seems all command dont work, but I can the index.php page and chose some options there. But when i do change name, it said char not found.
Do I must install Apache?

hel
06.11.2006, 05:50
twzenit: Maybe you're entering incorrect char_id in first textarea.
For taking char_id, by entering char_name - select 15 option (Get char id by char name) enter his char_name, and you will see his right char_id.

hel
06.11.2006, 05:52
Im working with someone to add a secure login, remove all ajax, make things easier by selecting a character before being shown the features.
Also working on a design
Is it for public?

zekillers
06.11.2006, 06:18
Is it for public?

Yes. For everyone. You should pm me your msn address, i'll keep you updated on the progress.

twzenit
06.11.2006, 07:19
twzenit: Maybe you're entering incorrect char_id in first textarea.
For taking char_id, by entering char_name - select 15 option (Get char id by char name) enter his char_name, and you will see his right char_id.

When I select the 15th option for geting char id by giving name, it does not return anything, it also does not show anything in cached.exe, the last two option is not working.

also tried to entered char id, it still show same error on cached part.

twzenit
06.11.2006, 07:28
btw, cached is on a seperate machine... does it make differerance?

hel
06.11.2006, 07:34
No...
I don't think where is your problem...
Maybe $_POST[] not working on your php...

twzenit
06.11.2006, 07:56
$_Post should work since when I do check status at 1st option, it reply red word, the char is not online. but it actually online, the problem is the cached showed a error with 997... and when I try to get char_id by use char_name, the option does go to a white page after I hit go. Then, I look at cached, there is no any message that shows the command is send to cached, or it maynot check it from cached?

hel
06.11.2006, 08:50
the problem is the cached showed a error with 997...

It's normal...

twzenit
06.11.2006, 09:42
and do I must install Apache?

PsychoBR
06.11.2006, 10:50
lol, i can do almost all the things, i just cant add items, i dunno if is the itemcache, i cant do this, if u can help me ill be happy!!

bye

pietra
06.11.2006, 15:32
Hello People, i have one problem:


I cant add itens, its all ok, just the add item function isn't working.
Thnx for the help, cya!

EDIT: The CacheD returns error 997.
Thnx for help

Somebody Can Help me too?
i can´t add itens too
please someone help me

hel
06.11.2006, 18:23
You must enable itemcache. Itemdata must be added in db...

pietra
06.11.2006, 18:42
You must enable itemcache. Itemdata must be added in db...

thanks
i will try it

zlopi
07.11.2006, 11:09
Not work AddItem???
как решить че делать ???

PsychoBR
07.11.2006, 11:34
Omg, hel, i cant do the "itemcache", I've gone to the CacheD in the menu, and he return the msg: "Cachedscript\itemcache not found"

Plz someone help me, I've search for posts with a "FAQ" but all the posts tell: "Add itemdata into DB" ok, but it dont work for me, still without add_item!!


:(


Thns for the help guys!!

TheOrder
07.11.2006, 12:05
: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 !

PsychoBR
07.11.2006, 12:49
: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 !



Thnx TheOrder, I'm noob, omg, look at that: https://postpacific.mmorpg-game.online/forums/showthread.php?p=66585&highlight=itemcache#post66585


Thnx for share, I'm happy now! =D

Namenlos
07.11.2006, 17:02
This L2PHP Admin WORKS ONLY in Internet Explorer. My Opera, Macintosh and mobile phone (GPRS-WAP on Nokia N73) do not support this scripts.
So it is not crossplatform information system :((

hel
07.11.2006, 19:32
This L2PHP Admin WORKS ONLY in Internet Explorer. My Opera, Macintosh and mobile phone (GPRS-WAP on Nokia N73) do not support this scripts.
So it is not crossplatform information system :((

Sure...
I'm waiting zekillers... He is rebuilding engine (deleting ajax and so on) and some design.
Opera 9 working perfectly with this script...

poltomb
07.11.2006, 20:38
AJAX IS THE DEVIL!!!!! (of cross platform support)

mastery
07.11.2006, 21:26
Hell, how about subjob0_class row ? can u fix that? then changing class row you must change also this row (same data) or user crash on login!!

zekillers
07.11.2006, 21:32
Right now we have our design css/xhtml done.
We coded a secure login, account creation, admin panel to manage accounts for the script.
We still need to improve some key areas.. like easy step by step installation and automatic creation of the config file.
We still need to improve the user groups and permissions. (adding and removing certain privileges)
After that we'll be working on functions like adding multiple l2servers so that you only need one script to control all your servers.

hel
08.11.2006, 12:08
zekillers:
PM me, how to contact with you.

blue3722
10.11.2006, 07:25
Warning: Cannot modify header information - headers already sent by (output started at E:\APMServ\APMServ5.1.2\www\htdocs\index.php:2) in E:\APMServ\APMServ5.1.2\www\htdocs\index.php on line 2

Unautorized

Apache 2.0.55 (HTTP服务器)
PHP 5.1.2 (脚本解释引擎)

what is the problem

zekillers
10.11.2006, 08:06
remove the <!--- comments ---> from the top of the php files

Xoleum
11.11.2006, 01:28
Warning: unpack() [function.unpack]: Type v: not enough input, need 2, have 0 in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\l2admin\functions.php on line 82

Warning: unpack() [function.unpack]: Type c: not enough input, need 1, have 0 in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\l2admin\functions.php on line 82
Char in world? :

That's what I am getting.

Pole
11.11.2006, 03:22
Quote:
Warning: unpack() [function.unpack]: Type v: not enough input, need 2, have 0 in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\l2admin\functions.php on line 82

Warning: unpack() [function.unpack]: Type c: not enough input, need 1, have 0 in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\l2admin\functions.php on line 82
Char in world? :



you receive an empty packet, you prolly choosed the wrong port for cacheD, use 2012, not 2006

Xoleum
11.11.2006, 06:06
you receive an empty packet, you prolly choosed the wrong port for cacheD, use 2012, not 2006

If I use 2012 it says it can't connect. O_o

blue3722
11.11.2006, 14:20
i had removed the <!--- comments ---> from the top of the php files

but problem is all the same

may be Php is not suitable??

zekillers
11.11.2006, 14:47
i had removed the <!--- comments ---> from the top of the php files

but problem is all the same

may be Php is not suitable??

your php is fine. make sure there are no extra spaces at the top of the <?php tag

blue3722
11.11.2006, 15:24
your php is fine. make sure there are no extra spaces at the top of the <?php tag

i do it like what u say

then just get this "Unautorized"

Xoleum
11.11.2006, 15:54
i do it like what u say

then just get this "Unautorized"

You must enter your ip in functions.php, it's explained in the installation instructions...

blue3722
12.11.2006, 07:45
You must enter your ip in functions.php, it's explained in the installation instructions...

thx a lot

that is ok now


just
Get char id by char name
Check user invertory

Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: lin2world in E:\APMServ\APMServ5.1.2\www\htdocs\cached.php on line 209

Warning: mssql_select_db(): supplied argument is not a valid MS SQL-Link resource in E:\APMServ\APMServ5.1.2\www\htdocs\cached.php on line 210

Warning: mssql_close(): supplied argument is not a valid MS SQL-Link resource in E:\APMServ\APMServ5.1.2\www\htdocs\cached.php on line 213

If some body get like above may bi the file "ntwdblib.DLL" is not suitable for u windows

u could down it: ntwdblib.DLL (http://club.phpe.net/index.php?act=Attach&type=post&id=56010)

Shawnmb
12.11.2006, 14:37
thx a lot

that is ok now


just
Get char id by char name
Check user invertory

Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: lin2world in E:\APMServ\APMServ5.1.2\www\htdocs\cached.php on line 209

Warning: mssql_select_db(): supplied argument is not a valid MS SQL-Link resource in E:\APMServ\APMServ5.1.2\www\htdocs\cached.php on line 210

Warning: mssql_close(): supplied argument is not a valid MS SQL-Link resource in E:\APMServ\APMServ5.1.2\www\htdocs\cached.php on line 213

Is not normal

Those warning messages should be obvious, bolding added in quote for emphasis.

blue3722
12.11.2006, 15:05
anthder poblem is not support to Chinese

I dont konw anyabout php ....so i cannt modify about it

any how it is very applied


my english is very poor

twzenit
14.11.2006, 07:35
is there a function such as ban user? I tested chatban is ok. but with 0 or 1 in punish option it does not work. also additem and delitem is not working.

twzenit
14.11.2006, 08:14
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?

Dmytro
14.11.2006, 10:07
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?

No, working fine!
15. - Return char_id by char name.
16. - Return items by char_id, that you got by 15.

Maybe different ports ... check your *.ini files

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
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.


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.
$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:
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
$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


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



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,$ms sql_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
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:


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,$ms sql_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,$ms sql_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(ItemNa meByItemId($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 )


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


<?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


<?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
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/7039/cplogincr8.th.jpg (http://img405.imageshack.us/my.php?image=cplogincr8.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/4033/cpindexadminol6.th.jpg (http://img509.imageshack.us/my.php?image=cpindexadminol6.jpg)

The Administrator Accounts Manager
http://img458.imageshack.us/img458/2836/cpindexadminaccountsqs6.th.jpg (http://img458.imageshack.us/my.php?image=cpindexadminaccountsqs6.jpg)

Add Item to Char (Recognice the characters name instead the Char ID)
http://img175.imageshack.us/img175/1084/cpadditemxx7.th.jpg (http://img175.imageshack.us/my.php?image=cpadditemxx7.jpg)

Continue in next Post

[DeV/NuLL]
02.01.2007, 17:23
Add Item to Char Step 2
http://img46.imageshack.us/img46/8702/cpadditemstep2pu1.th.jpg (http://img46.imageshack.us/my.php?image=cpadditemstep2pu1.jpg)

Add Item Results
http://img297.imageshack.us/img297/8265/cpadditemstep3gr0.th.jpg (http://img297.imageshack.us/my.php?image=cpadditemstep3gr0.jpg)

Delete Item from Character (Char Name again)
http://img360.imageshack.us/img360/2797/cpdelitemso6.th.jpg (http://img360.imageshack.us/my.php?image=cpdelitemso6.jpg)

Delete Item results
http://img360.imageshack.us/img360/6775/deletestep2uc9.th.jpg (http://img360.imageshack.us/my.php?image=deletestep2uc9.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
: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
edit:

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

https://postpacific.mmorpg-game.online/forums/showpost.php?p=64631&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
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
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
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
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
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
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
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.