Jump to content

Recommended Posts

Hi guys,

I am working for a client who has given me a job to update his website. The code is in Delphi but I have no experience in Delphi. Can someone please advice what is happening here and how can I adapt this for PHP. Any help is greatly appreciated:

 

//Module to create and send the handshake request

//***********************************************************************

procedure getHandShake();

var

    buf_pchar : PChar;

    atoz : array [0..35] of String;

    i : Integer;

    msg,str : String;

    ch : Char;

begin

    //Generate a random 4 digit alpha-numeric packet id

    i := 0;

    for ch:='A' to 'Z' do

    begin

        atoz := ch;

        Inc(i);

    end;

 

    for ch:='0' to '9' do

    begin

        atoz := ch;

        Inc(i);

    end;

 

    Randomize;

    str := '';

    for i:=0 to 3 do

    begin

        str := str + RandomFrom(atoz);

    end;

 

    msg := '{vrq}{1}eBScheduler{2}'+str+'{3}1!' + #03; //Build the handshake

request

    mainFrm.sndMsg := msg;

    buf_pchar := PChar(msg);

    mainFrm.client.Socket.SendText(buf_pchar); //Send the handshake packet

    mainFrm.status.Panels[1].Text := 'Request Hanshake ....';

end;

 

//Module to create and send get data request

//***********************************************************************

procedure getData(cname : String);

var

    buf_pchar : PChar;

    atoz : array [0..35] of String;

    i : Integer;

    msg,str : String;

    ch : Char;

begin

    mainFrm.msgType := 'MOVE';

    //Generate a random 4 digit alpha-numeric packet id

    i := 0;

    for ch:='A' to 'Z' do

    begin

        atoz := ch;

        Inc(i);

    end;

 

    for ch:='0' to '9' do

    begin

        atoz := ch;

        Inc(i);

    end;

 

    Randomize;

    str := '';

    for i:=0 to 3 do

    begin

        str := str + RandomFrom(atoz);

    end;

 

    msg := '{vrq}{1}'+cname+'{2}'+str+'{3}2{8}32!{1}2!' + #03; //Build the get data request

    mainFrm.sndMsg := msg;

    buf_pchar := PChar(msg);

    if mainFrm.client.Socket.Connected then

        mainFrm.client.Socket.SendText(buf_pchar); //Send the get data packet

    mainFrm.status.Panels[1].Text := 'Request Hanshake ....';

    mainFrm.Trace('log','log',msg);

end;

Link to comment
https://forums.phpfreaks.com/topic/70678-what-is-happening-here-delphi-issue/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.