PHP Framework

Know of something that might be useful to the DC community? Post it here! (Still, no advertising)

Moderator: Moderators

Locked
daniele_dll
Posts: 3
Joined: 2003-05-08 15:01
Location: Italy
Contact:

PHP Framework

Post by daniele_dll » 2003-05-08 15:17

Hi to all,

i'm working on a PHP Framework to manage from PHP a connection with an HUB and with a CLIENT...
can be very usefull to write external BOTS.
I've added many things! I must complete it, i'm working on a callback system. The next thingh is enable this framework to connect to NMDC Hub (there is the LOCK) and connect to clients like DC++, DC and others, i want for example to analyze share lists, check share (incomplete files, vob, tmp and others), i want to reknow faked client and others!

i've tried to convert a function, from ragnarock, called Lock2Key.

there is my PHP code:

Code: Select all

<?php
$lock = "szGNU\cjqxELSZahovCJQX_fmtAHOV]dkryFMT[bipwDK";
$key =lock2key($lock);
$key2 = "â€â€

[RO]VeNoM
Posts: 11
Joined: 2003-05-04 14:36

Post by [RO]VeNoM » 2003-05-13 09:46

Afret I modified a bit your code I get the same thing with my code :

Code: Select all

//------------
// Decode Lock
//------------


function decode ($lock) {
      $key = array ();

      $lockLength = strlen ($lock);

      $a1 = $lock[0];
      $a2 = $lock[$lockLength - 1];
      $a3 = $lock[$lockLength - 2];

      $char1 = ord($a1) ^ ord($a2) ^ ord($a3) ^5;
      $char2 = $char1;

      $key[0]= $char2;

      for ($i = 1; $i < $lockLength; $i++) {

	    $a5 = $lock[$i];
	    $a6 = $lock[$i-1];		
        $char3 = ord($a5) ^ ord($a6);
	
	    $char4 = $char3;

	    $key[$i] = $char4;
      }

      return $key;
}


function escapeChars($key) {
      $encoded = '';

      for ($i = 0; $i  < count($key); $i++)
      {

	$a = $key[$i];
	
	if ($a == '126' or // '~'
	    $a == '124' or // '|'
	    $a == '96' or  // '`'
	    $a == '36' or  // '$'
	    $a == '5' or   // '^E'
	    $a == '0')     // NUL
	{
	  $encoded .= "/%DCN";

	  if ($a < 100)
	    $encoded .="0";
	  if ($a < 10)
	    $encoded .="0";
      $encoded .= $a; // As a string integer
	  $encoded .= "%/";	
	} else {
	  $encoded .= pack("c",$a);;  // No transformation.
	}
      }

      return $encoded;
}



$lock = "-RM4dQR,CUj&(H5EFDhpOSdZX()PxL=V%e9=gj[l/1pSA;IaSi`V(A5+o`Tkx0@cE";

$Key = "à÷ñâ€â€

daniele_dll
Posts: 3
Joined: 2003-05-08 15:01
Location: Italy
Contact:

Post by daniele_dll » 2003-05-13 11:18

tnx ^^

i must complete some callback systems and after i'll post my code :D

after this i must start to code the client system side ^^

argh :D

the decode function is too important in client<->client comunication :D

tnx :)

Locked