Post Pacific

Post Pacific (https://postpacific.loc-online.com/index.php)
-   Темы без сохранившегося раздела (https://postpacific.loc-online.com/forumdisplay.php?f=10001)
-   -   [SHARE] For beginners. Register new L2-account (https://postpacific.loc-online.com/showthread.php?t=3206)

RumanticK 01.02.2006 10:41

[SHARE] For beginners. Register new L2-account
 
Here is some functions, can be uset to register a new user on your L2-server
Code:

<?
function s2b($s) {
for ($i=0; $i<strlen($s); $i++) $key[$i]=ord(substr($s,$i,1));
return $key;
}

function b2i($key, $i) {
return $key[$i] + $key[$i+1]*256 + $key[$i+2]*65536 + $key[$i+3]*16777216;
}

function msplit($w, &$a, &$b, &$c, &$d)
{
    $d = (int) ($w / hexdec(1000000));
    $c = (int) (($w - $d * hexdec(1000000)) / hexdec(10000));
    $b = (int) (($w - $d * hexdec(1000000) - $c * hexdec(10000)) / hexdec(100));
    $a = (int) ($w - $d * hexdec(1000000) - $c * hexdec(10000) - $b * hexdec(100));
}


function l2encode($pass)
{
$key=s2b($pass);
$dstbytes=s2b($pass);
        $one= b2i($key, 0) * 213119 + 2529077;
        $two = b2i($key, 4) * 213247 + 2529089;
        $three = b2i($key, 8) * 213203 + 2529589;
        $four = b2i($key, 12) * 213821 + 2529997;
        $one = $one - ((int) ($one / 4294967296))*4294967296;
        $two = $two - ((int) ($two / 4294967296))*4294967296;
        $three = $three - ((int) ($three / 4294967296))*4294967296;
        $four = $four - ((int) ($four / 4294967296))*4294967296;
msplit($one, $key[0], $key[1], $key[2], $key[3]);
msplit($two, $key[4], $key[5], $key[6], $key[7]);
msplit($three, $key[8], $key[9], $key[10], $key[11]);
msplit($four, $key[12], $key[13], $key[14], $key[15]);
        $dstbytes[0] = $dstbytes[0] ^ $key[0];

        for ($i=1; $i<=15; $i++) $dstbytes[$i] = $dstbytes[$i] ^ $dstbytes[$i-1] ^ $key[$i & 15];
        for ($i=0; $i<=15; $i++) if ($dstbytes[$i] == 0) $dstbytes[$i] = 0x66;

        $encrypt = "0x";
        for ($i=0; $i<=15; $i++)        if ($dstbytes[$i] < 0x10) {
                        $encrypt .= "0" . dechex($dstbytes[$i]);
                } else {
                        $encrypt .= dechex($dstbytes[$i]);
                }

        return $encrypt;
}

function createssn() {
$s=rand(1,9);
for ($i=1; $i<=12; $i++) $s.=rand(0,9);
return $s;
}
function regaccount($account,$password,$email,$qst1,$qst2,$asw1,$asw2) {
        $account=addslashes($account);
        $password=addslashes($password);
        $email=addslashes($email);
        $qst1=addslashes($qst1);
        $qst2=addslashes($qst2);
        $asw1=addslashes($asw1);
        $asw2=addslashes($asw2);
        $ssn = createssn();
                mscdb();
        $lin2db = "lin2db";
        $lin2world = "lin2world";
        @mssql_select_db($lin2db);

        $query = "select * from user_auth WHERE account='$account'";
        $result = mssql_query($query) or return 1;
        if ($row=mssql_fetch_row($result))
                        {
                        return 1;
                        }        else {
                $query = "INSERT INTO [ssn](ssn,name,email,job,phone,zip,addr_main,addr_etc,account_num) VALUES('".$ssn."','".$account."','".$email."',0,'telphone','123456','','',1)";
                $result = @mssql_query($query) or return 1;

                $query = "INSERT INTO [user_account](account,pay_stat) VALUES('".$account."',1)";
                $result = @mssql_query($query) or return 1;

                $query = "INSERT INTO [user_info](account,ssn,kind) VALUES('".$account."','".$ssn."',99)";
                $result = @mssql_query($query) or return 1;

                $query = "INSERT INTO [user_auth](account,password,quiz1,quiz2,answer1,answer2) VALUES('".$account."',".l2encode($password).",'".$qst1."','".$qst2."',".l2encode($asw1).",".l2encode($asw2).")";
                $result = @mssql_query($query) or return 1;
        }
return 0;
}

 ?>


RumanticK 02.02.2006 07:48

Top-clans
 
Get clan-rating
Code:

mscdb();
$lin2db = "lin2db";
$lin2world = "lin2world";
mssql_select_db($lin2world);
$nns="GMs,DEVs,Admins";
$dns=explode(",",$nns);

$query="SELECT pledge.pledge_id as clanid, user_data.char_name as ruler, user_data.Lev as rulerlvl, pledge.name as clanname, pledge.skill_level as clanlvl FROM pledge INNER JOIN user_data ON pledge.ruler_id=user_data.char_id ORDER BY clanlvl DESC";
$result = mssql_query($query) or die;
$rc=0;
$mb.="<table border=1 cellspacing=0 cellpadding=3 align=center>\n";
$mb.="<tr><th>#</th><th>Clan name</th><th>Clan
level</th><th>Clan leader
(level)</th><th>Num
members</th><th>AVG level
</th></tr>";

while (($row = mssql_fetch_array($result)) && ($rc<100)) {
 $puttotop=1;
 if (in_array($row['clanname'],$dns)) $puttotop=0;
 if ($puttotop==1) {
 $query="SELECT char_id, Lev FROM user_data WHERE pledge_id=".$row['clanid'];
 $plres = mssql_query($query) or exit;
 $plcount=0;
 $pllev=0;
 while ($plrow = mssql_fetch_array($plres)) {
 $plcount++;
 $pllev+=$plrow[Lev];
 }
 $pllev=$pllev/$plcount;
 $pledge['ruler'][$row['clanid']]=$row['ruler'];
 $pledge['rulerlvl'][$row['clanid']]=$row['rulerlvl'];
 $pledge['clanname'][$row['clanid']]=$row['clanname'];
 $pledge['avglvl'][$row['clanid']]=$pllev;
 $pledge['count'][$row['clanid']]=$plcount;
 $pledge['clanlvl'][$row['clanid']]=$row['clanlvl'];
 $pledge['rating'][$row['clanid']]=$pledge['clanlvl'][$row['clanid']]*1000000+((int) ($pledge['avglvl'][$row['clanid']]*10000))+$pledge['count'][$row['clanid']];
 }
}
 arsort($pledge['rating']);
 reset($pledge['rating']);
 while (list($plid, $ratingclan)=each($pledge['rating'])) {
 $rc++;
 $mb.="<tr><td align=center>".$rc."</td><td align=center>".($pledge['clanname'][$plid])."</td><td align=center>".($pledge['clanlvl'][$plid])."</td><td align=center>".($pledge['ruler'][$plid])."(".($pledge['rulerlvl'][$plid]).")</td>";
 $mb.="<td align=center>".($pledge['count'][$plid])."</td><td align=center>".(((int) ($pledge['avglvl'][$plid]*100))/100)."</td></tr>";
}
$mb.="</table>";
echo $mb;


darkstaown 26.04.2006 01:18

nice share =)

:P

Zeran 26.04.2006 09:11

very nice
10x for shr

angelicmercer 27.04.2006 02:43

Nice share =)

Zeran 28.04.2006 12:30

So how about GM acc?How to do GM acc from normal acc...???

Zeran 28.04.2006 12:30

So how about GM acc?How to do GM acc from normal acc...???


All times are GMT. The time now is 15:26.