Foros del Web » Programación para mayores de 30 ;) » Programación General » Visual Basic clásico »

php a vb6? plss!

Estas en el tema de php a vb6? plss! en el foro de Visual Basic clásico en Foros del Web. holas como andan? espero q bn xD bueno soy medio nobato en esto pero quiero pasar un scrip php a vb6 me podrian dar una ...
  #1 (permalink)  
Antiguo 22/02/2011, 13:59
 
Fecha de Ingreso: febrero-2011
Mensajes: 1
Antigüedad: 13 años, 2 meses
Puntos: 0
php a vb6? plss!

holas como andan? espero q bn xD
bueno soy medio nobato en esto pero quiero pasar un scrip php a vb6 me podrian dar una mano? si pueden se los agradesco.
ak se los dejo...


Cita:
<?php
////////////////////////////////////////////////////////////////////////////
// PHP Script to Send a public message inside the game from the website. //
// It will appear just like the Golden Invasion text //
// Made by: Sandbird //
////////////////////////////////////////////////////////////////////////////

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 int_int_divide($x, $y) {
//Returns the integer division of $x/$y.
if ($x == 0) return 0;
if ($y == 0) return FALSE;
return ($x % $y >= $y / 2) ?
(($x - ($x % $y)) / $y) + 1 : ($x - ($x % $y)) / $y;
}

function send_msg($host, $port, $msg)
{
$header = "C144A10024000000"; // Starting header of the message
$msglength = strlen($msg); // Length of message

if ($msglength < 34 && $msglength != 0){ // Starting calculations to divide the message box so the message looks centerd
$divisor = (34 - $msglength);
$start_space = int_int_divide($divisor , 2);

for ($i=0;$i<=$start_space;$i++){
$header .= "20";
}
$header .= ascii2hex($msg); // Insert the message in the packet

for ($j=0;$j<=($divisor-$start_space);$j++){
$header .= "20";
}
}else{ // If the message is longer that 64 chars no need for spaces
$header .= ascii2hex($msg); // Insert the message in the packet if msg > 34
}

$header .= "00BED3410000F8BBB90400000000FCBBB904A4FF1A06F 8F04 100FFFFFFFF"; // Remainding header
$packet = hex2ascii($header); // 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 "No access to the Joinserver or Server is down.";
}
else
{
socket_write($socket, $packet , strlen($packet)); // Send the packet to the Joinserver
socket_close($socket); // Close connection (i dont know if this is needed or not).
}

}
// If you want to post the message from another page then remove the // from the line below
// and add them on the other line. If you dont know how to do that then if your page is
// located for example at http://website.com/shout.php
// just write this at the header: http://website.com/shout.php?msg=And put your msg here.

// send_msg("127.0.0.1", "55970", $msg);
send_msg("127.0.0.1", "55970", "ESCRIBA SU MENSAJE AQUI");
php?>

desde ya muchas gracias y salu2

Etiquetas: php, vb
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 14:30.