i need php code

Results 1 to 2 of 2
  1. #1
    Valued Member nemeth is offline
    MemberRank
    Jan 2016 Join Date
    111Posts

    i need php code

    Hello i need php code Mu Core 1.0.8

    remake unstuck character module.

    it can not be done only on the offline characters, but also on the online characters, so that 5sec and disconnected from the server to the client.
    This is important because those who would warp (main) Server when it is thrown off the game, but the user of the status of the database connection remains active.

    OR:
    QUERY
    UPDATE MEMB_STAT Set ConnectStat = 0 where memb___id ='ACCOUNT' <--- need php script


    Sry bad lang
    THX

    - - - Updated - - -

    HELLO!
    I Find script and not work
    the script runs without errors, but does not change the ConnectStat, Why?



    <?php

    $host = "127.0.0.1";
    $dbuuu = "sa"; // DB Login
    $dbppp = "PASS"; // DB Pass
    $datab = "MuOnline"; // DB Name
    //
    if (isset($_POST['dc_start'])){
    $user=$_POST['acc'];
    $pw=$_POST['pw'];


    if (empty($user)){die("Please Enter Account");
    }


    if (empty($pw)){die("Please Enter Password");
    }


    $conn = mssql_connect($host,$dbuuu,$dbppp)
    or die ("<h1>Cannot connect to database</h1>");
    $selected=mssql_select_db($datab, $conn);
    $sql_pw_check = mssql_query("SELECT memb__pwd FROM MEMB_INFO WHERE memb__pwd='$pw' and memb___id='$user' ");
    $pw_check = mssql_num_rows($sql_pw_check);
    mssql_close($conn);
    if ($pw_check <= 0){ Die("incorrect password");
    }




    ///////////////////////////////////////////////////////////////////////////
    // Script to Disconnect a User from the Joinserver and //
    ///////////////////////////////////////////////////////////////////////////


    function ascii2hex($ascii) {
    $hex = '';
    for ($i = 0; $i < strlen($ascii); $i++) {
    $byte = strtoupper(dechex(ord($ascii{$i})));
    $byte = str_repeat('0', 2 - strlen($byte)).$byte;
    $hex.=$byte." ";
    }
    $hex=str_replace(" ", "", $hex);
    return $hex;
    }


    function hex2ascii($hex){
    $ascii='';
    $hex=str_replace(" ", "", $hex);
    for($i=0; $i<strlen($hex); $i=$i+2) {
    $ascii.=chr(hexdec(substr($hex, $i, 2)));
    }
    return($ascii);
    }


    function dc_user($host, $port, $user)
    {


    $mystring = "C11405"; // Header packet. I used a packet sniffer to get this packet.It could be different for every gameserver.
    $mystring .= ascii2hex($user); // Insert into the packet the username after you convert it to hex first.
    $zeros = strlen($mystring);
    for ($i;$i<=39-$zeros;$i++){
    $mystring .="0"; // The packets must be 40 bits long so we fill the rest of the packet with zeros.
    }
    $packet = hex2ascii($mystring); // Convert the whole string to ascii
    $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);


    if (!$x = @socket_connect($socket, $host, $port)) // attempt to connect
    {
    echo "Can't connect to server.Maybe server is offline";
    }
    else
    {
    socket_write($socket, $packet, strlen($packet)); // Send the dc packet
    socket_close($socket); // Close connection
    print"<h1>Disconnect request sent</h1>";
    }


    /////////////////////////////////////////////////////////
    // This will also delete the entry from the database //
    /////////////////////////////////////////////////////////
    $conn = mssql_connect($host,$dbuuu,$dbppp)
    or die ("<h1>Cannot connect to database</h1>");
    $selected=mssql_select_db($datab, $conn);
    $sql = mssql_query("UPDATE MEMB_STAT Set ConnectStat = 0 where memb___id ='$user'");
    mssql_close($conn);
    /////////////////////////////////////////////////////////
    }


    dc_user("127.0.0.1", "55970", $user); // Run the function: Connect to port 55970 (Joinserver port) and dc the user. Where $user=username

    }
    else{ echo "
    <table width="125" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>To Disconnect Your account from game please enter here your Account And Password
    <td width="125" height="24"><form action="" method="post" name="form1" id="form1">
    <label>
    <INPUT maxLength=10 name=acc value="login">
    </label>
    </td>
    </tr>
    <tr>
    <td><INPUT class=txt-simple type=password maxLength=10 name=pw value="pass"></td>
    </tr>
    <tr>
    <td align="right">
    <label>
    <INPUT
    type=hidden value=1 name=dc_start>
    <input name="Submit" type="submit" id="Submit" value="Login" />
    </label>
    </form></td>
    </tr>
    </table>
    ";
    }
    ?>
    Last edited by nemeth; 23-02-16 at 05:25 AM.


  2. #2
    if(!caffeine) continue; leorond is offline
    MemberRank
    Jul 2012 Join Date
    Czech RepublicLocation
    491Posts

    Re: [help]i need php code

    Hey, what writes error?

    - - - Updated - - -

    You can not use a script that only changes the database!
    When disconnecting it is necessary that you disconnected it from the server, so connect via port 55970 (JoinServer)



Advertisement