Skip to forum content

You are not logged in. Please login or register.


forums.pvpgn.pro → 3d Party Tools → help telnet cmd php

Pages 1

You must login or register to post a reply

RSS topic feed

Posts: 2

1

Topic: help telnet cmd php

Здравствуйте, я пытаюсь отправить из деревни в telnet, но сообщение отправляется только при входе в систему, но не, а затем я прошу небольшой помощи, если вы можете, идея состоит в том, чтобы отправлять сообщения после того, как я уже вошел в систему без необходимости входа в систему и войдите снова, не перезагружая скрипт, буду вам очень благодарен, если вы мне поможете


Hello, I try to send from the village to telnet but the message is sent only by login but not and then I ask for a little help if you can the idea is to send messages after I have already logged in without having to log in and log in again without reloading the script will thank you very much if you help me

sql:

CREATE TABLE `message` (
`message` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
`user` text COLLATE utf8mb4_unicode_ci NOT NULL,
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

<php
$dbhost = "";
$dbusername = "";
$dbpassword ="";
$dbname = "";
$TABLE_NAME='';
$conn = new mysqli($dbhost, $dbusername, $dbpassword, $dbname);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$sql = "SELECT * FROM $TABLE_NAME ORDER BY message DESC LIMIT 1";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$u=$row['user'];
$m=$row['message'];
$msg="<'$u'>$m";
}
}
$conn->close();
$server   = '';
$port   = '';
$username   = '';
$password   = '';
$socket = fsockopen($server, $port) or die('Could not connect to: '.$server);
if($socket)
{
    sendcmd("\r",$socket);
    $status = "open"; // set status open
       
    while($status=="open") //while we are connected to the server
      {   
             $line = @fgets($socket, 1024) ;
              /////////////login////////////////   
            if (strstr($line, "there is no guest account"))
              {
                 sendcmd($username."\r\n",$socket);
                 sendcmd($password."\r\n",$socket);
              }   
            //////////////send command ////////////////////
            if (strstr($line,"Your unique name: ".$username))
              {  sendcmd("/join CHAT"."\r\n",$socket);
              {  sendcmd($msg."\r\n",$socket);
              }
              }
           
            if (strstr($line,"ERROR: Invalid user.")) // if respone server write "ERROR: Invalid user."
              {
               
                 fclose($socket);
                 $status="close";
                 $error ="Invalid User";    // error message
              }
           
            ////////////login failed //////////////////////////           
            if (strstr($line, "Login failed")) // if respone server write "Login failed"
              {
                 $error = "Login Failed";    // error message
                 fclose($socket);
                 $status="close";
              }
           
            flush(); // close
     
      }
         
}
function sendcmd($cmd,$socket) // send command function
{
  fputs($socket, $cmd, strlen($cmd));
}
?>

2

Re: help telnet cmd php

systems wrote:

Hello, I try to send from the village to telnet but the message is sent only by login but not and then I ask for a little help if you can the idea is to send messages after I have already logged in without having to log in and log in again without reloading the script will thank you very much if you help me

It's hard to run your code for me right now, but, are you following this? https://github.com/pvpgn/phputils/tree/ … ot-php-lib
This one works
and another thing to you look up: https://github.com/reillychase/pvpgn-html5-chat-client

Diablo II Evolution
The first with a truly connected auction house

Posts: 2

Pages 1

You must login or register to post a reply

Who now at forum

Currently view post: 0 guests, 0 registered users

forums.pvpgn.pro → 3d Party Tools → help telnet cmd php