Quote:
|
Originally Posted by rodier
Hmm is there something like L2admin but for PHP?
Or its any chance to get ASP working with Apache?
|
I got my kick/ban page done with php (All credits to friend of mine Leibniz - Luvya F@G to made that)
U need to open socket on port 2009 (cached) and write commands to that port.
Here is sample for open socket on mentioned port:
[php:1:1717e27cbf]}
function SendCommand($str)
{
global $CONFIG;
$fp = fsockopen($CONFIG['dbaddress'], 2009, $errno, $errstr);
if(!$fp)
{
echoLn("Error: $errstr ($errno)");
return(0);
}
fwrite($fp, $str);
stream_set_timeout($fp, 2);
$ret = fgets($fp,8);
fclose($fp);
return($ret);
}[/php:1:1717e27cbf]
Kick code:
[php:1:1717e27cbf]}
if(strstr($szAction,"<kick>"))
{
$szCmd = ("5" . "\t" . $charName . "\t" . "\r\n");
if(SendCommand($szCmd)==1)
{
$str = "CHAR KICKED: UID = $userAccId; CHAR NAME: $charName";
echoLn($str);
//writeLog($str);
}
else
{
echoLn("Kick Error? =[");
}[/php:1:1717e27cbf]
Ban code:
[php:1:1717e27cbf]
if(strstr($szAction,"<ban>"))
{
$dbconnect = mssql_connect ($CONFIG['dbaddress'], $CONFIG['dbuser'], $CONFIG['dbpass']);
mssql_select_db ($CONFIG['dbdbname'], $dbconnect) or die(print("error"));
$query = "UPDATE User_Account SET block_flag=1, block_flag2=1 WHERE uid=".$userAccId;
$result = mssql_query($query);
if($result)
{
$str = "ACC BANNED: UID = $userAccId; CHAR NAME = $charName;";
echoLn($str);
writeLog($str);
}
else echoLn("ACC (UID = $userAccId) NOT BANNED!!");
}[/php:1:1717e27cbf]