SitePoint Sponsor

User Tag List

Results 1 to 18 of 18
  1. #1
    SitePoint Member
    Join Date
    Aug 2005
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    php script and Frontpage

    Hi. I have a Php script on my website.

    I have a form which has 4 text boxes.

    When I click submit on the form it posts to: http://xxxxxxxxx.com/script.php?text...**&text4=*****

    Basically I want the ***** to reflect what people type in the text boxes. Then the script will work. But I dont know how to do this. I have been using Frontpage for the form. Can you help? Thanks

  2. #2
    Who turned the lights out !! Mandes's Avatar
    Join Date
    May 2005
    Location
    S.W. France
    Posts
    2,496
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    We need to see the html code for the form AND your PHP script
    A Little Knowledge Is A Very Dangerous Thing.......
    That Makes Me A Lethal Weapon !!!!!!!!

    Contract PHP Programming

  3. #3
    SitePoint Zealot zoso's Avatar
    Join Date
    Aug 2005
    Location
    Earth..
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could as well make an intermediate page in php which gets all the get variables text1 etc. and then redirects the page to http://xxxxxxxxx.com/script.php?tex...***&text4=***** .

  4. #4
    SitePoint Member
    Join Date
    Aug 2005
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That would be good. How do I do that? thanks

  5. #5
    Who turned the lights out !! Mandes's Avatar
    Join Date
    May 2005
    Location
    S.W. France
    Posts
    2,496
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by zoso
    You could as well make an intermediate page in php which gets all the get variables text1 etc. and then redirects the page to http://xxxxxxxxx.com/script.php?tex...***&text4=***** .
    Why ??

    All the guy wants is to pass 4 variables to the php script, why employ another php script to do this ?
    A Little Knowledge Is A Very Dangerous Thing.......
    That Makes Me A Lethal Weapon !!!!!!!!

    Contract PHP Programming

  6. #6
    SitePoint Member
    Join Date
    Aug 2005
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yep I want to pass the varibles of the text boxes and put them in the URL. So does anyone know how to do that? Because I am quite inexperienced. Thanks

    This is the basic form: I am not sure what to do about the xxx's in the post bit.



    <html>
    <!--Generated by Angelfire: L00S00-->
    <head>
    <title>My Home Page</title>
    </head>
    <body bgcolor="#ffffff" text="#000000" link="#0000ff" alink="#800080" vlink="#ff0000">
    <basefont size="3">

    <!--Header-->
    <h1 align="center">My Home Page</h1>
    <!--EndHeader-->

    <!--Image-->
    <p>

    <form method="POST" action="http://xxxxxxxxxxxxxx.com/script.php?text1=xxxxx&text2=xxxxx&text3=xxxxx&text4=xxxxx">
    <p><input type="text" name="box1" size="20"></p>
    <p><input type="text" name="box2" size="20"></p>
    <p><input type="text" name="box3" size="20"></p>
    <p><input type="text" name="box4" size="20"></p>
    <p>&nbsp;</p>
    <p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
    </form>

    </body>
    </html>

  7. #7
    Who turned the lights out !! Mandes's Avatar
    Join Date
    May 2005
    Location
    S.W. France
    Posts
    2,496
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I need the PHP script too, to match up the names.
    A Little Knowledge Is A Very Dangerous Thing.......
    That Makes Me A Lethal Weapon !!!!!!!!

    Contract PHP Programming

  8. #8
    Who turned the lights out !! Mandes's Avatar
    Join Date
    May 2005
    Location
    S.W. France
    Posts
    2,496
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Use this as your form

    Code:
    <html>
    <!--Generated by Angelfire: L00S00-->
    <head>
    <title>My Home Page</title>
    </head>
    <body bgcolor="#ffffff" text="#000000" link="#0000ff" alink="#800080" vlink="#ff0000">
    <basefont size="3">
     
    <!--Header-->
    <h1 align="center">My Home Page</h1>
    <!--EndHeader-->
     
    <!--Image-->
    <p>
     
    <form method="POST" action=http://putyourdomainhere.com/yourscript.php>
    <p><input type="text" name="box1" size="20"></p>
    <p><input type="text" name="box2" size="20"></p>
    <p><input type="text" name="box3" size="20"></p>
    <p><input type="text" name="box4" size="20"></p>
    <p>&nbsp;</p>
    <p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
    </form>
     
    </body>
    </html>
    Change the bit action=http://putyourdomainhere.com/yourscript.php for your values
    A Little Knowledge Is A Very Dangerous Thing.......
    That Makes Me A Lethal Weapon !!!!!!!!

    Contract PHP Programming

  9. #9
    SitePoint Member
    Join Date
    Aug 2005
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I changed the names of the text by the way to make it easier. But they were:

    text1 = imei

    text2 = asic

    text3 = net

    text4 = box


    This is the script:



    // uso: http://localhost/dct4.php?imei=11111...2222&box=34144

    // *********************************
    function string_to_array($cadena)
    {
    for ($i = 0; $i < strlen($cadena); $i++)
    $nueva[$i] = ord(substr($cadena, $i, 1));
    return $nueva;
    }

    function char_of($cadena, $pos)
    {
    return ord(substr($cadena, $pos, 1));
    }
    //**********************************

    $tabla_1 = array(0x00,0x03,0x06,0x01,0x04,0x07,0x02,0x05,0x00,0x03,0x06,0x01,0x04,0x07,0x02,0x05,0x00);
    $tabla_2 = array(0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x16,0x73,0x3B,0x1E,0x8E,0x70,0xBD,0x86,
    0x47,0x7E,0x24,0x56,0xF1,0x77,0x88,0x46,0xB1,0xBA,0xA3,0xB7,0x10,0x0A,0xC5,0x37,
    0xC9,0x5A,0x28,0xAC,0x64,0xA5,0xEC,0xAB,0xC6,0x67,0x95,0x58,0x0D,0xF8,0x9A,0xF6,
    0x66,0xDC,0x05,0x3D,0xD3,0x8A,0xC3,0xD8,0x6A,0xE9,0x36,0x49,0x43,0xBF,0xEB,0xD4,
    0x9B,0x68,0xA0,0x65,0x5D,0x57,0x92,0x1F,0x71,0x5C,0xBB,0x22,0xC1,0xBE,0x7B,0xBC,
    0x63,0x94,0x5F,0x2A,0x61,0xB8,0x34,0x32,0xFD,0xFB,0x17,0x40,0xE6,0x51,0x1D,0x41,
    0x8F,0x29,0xDD,0x04,0x80,0xDE,0xE7,0x31,0x7F,0x01,0xA2,0xF7,0x39,0xDA,0x6F,0x23,
    0xFE,0x3A,0xD0,0x1C,0xD1,0x30,0x3E,0x12,0xCD,0x0F,0xE0,0xA8,0xAF,0x82,0x59,0x2C,
    0x7D,0xAD,0xB2,0xEF,0xC2,0x87,0xCE,0x75);
    $tabla_3 = array(0x01,0x2D,0xE2,0x93,0xBE,0x45,0x15,0xAE,0x78,0x03,0x87,0xA4,0xB8,0x38,0xCF,0x3F,
    0x08,0x67,0x09,0x94,0xEB,0x26,0xA8,0x6B,0xBD,0x18,0x34,0x1B,0xBB,0xBF,0x72,0xF7,
    0x40,0x35,0x48,0x9C,0x51,0x2F,0x3B,0x55,0xE3,0xC0,0x9F,0xD8,0xD3,0xF3,0x8D,0xB1,
    0xFF,0xA7,0x3E,0xDC,0x86,0x77,0xD7,0xA6,0x11,0xFB,0xF4,0xBA,0x92,0x91,0x64,0x83,
    0xF1,0x33,0xEF,0xDA,0x2C,0xB5,0xB2,0x2B,0x88,0xD1,0x99,0xCB,0x8C,0x84,0x1D,0x14,
    0x81,0x97,0x71,0xCA,0x5F,0xA3,0x8B,0x57,0x3C,0x82,0xC4,0x52,0x5C,0x1C,0xE8,0xA0,
    0x04,0xB4,0x85,0x4A,0xF6,0x13,0x54,0xB6,0xDF,0x0C,0x1A,0x8E,0xDE,0xE0,0x39,0xFC,
    0x20,0x9B,0x24,0x4E,0xA9,0x98,0x9E,0xAB,0xF2,0x60,0xD0,0x6C,0xEA,0xFA,0xC7,0xD9,
    0x00,0xD4,0x1F,0x6E,0x43,0xBC,0xEC,0x53,0x89,0xFE,0x7A,0x5D,0x49,0xC9,0x32,0xC2,
    0xF9,0x9A,0xF8,0x6D,0x16,0xDB,0x59,0x96,0x44,0xE9,0xCD,0xE6,0x46,0x42,0x8F,0x0A,
    0xC1,0xCC,0xB9,0x65,0xB0,0xD2,0xC6,0xAC,0x1E,0x41,0x62,0x29,0x2E,0x0E,0x74,0x50,
    0x02,0x5A,0xC3,0x25,0x7B,0x8A,0x2A,0x5B,0xF0,0x06,0x0D,0x47,0x6F,0x70,0x9D,0x7E,
    0x10,0xCE,0x12,0x27,0xD5,0x4C,0x4F,0xD6,0x79,0x30,0x68,0x36,0x75,0x7D,0xE4,0xED,
    0x80,0x6A,0x90,0x37,0xA2,0x5E,0x76,0xAA,0xC5,0x7F,0x3D,0xAF,0xA5,0xE5,0x19,0x61,
    0xFD,0x4D,0x7C,0xB7,0x0B,0xEE,0xAD,0x4B,0x22,0xF5,0xE7,0x73,0x23,0x21,0xC8,0x05,
    0xE1,0x66,0xDD,0xB3,0x58,0x69,0x63,0x56,0x0F,0xA1,0x31,0x95,0x17,0x07,0x3A,0x28);
    $tabla_4 = array(0x80,0x00,0xB0,0x09,0x60,0xEF,0xB9,0xFD,0x10,0x12,0x9F,0xE4,0x69,0xBA,0xAD,0xF8,
    0xC0,0x38,0xC2,0x65,0x4F,0x06,0x94,0xFC,0x19,0xDE,0x6A,0x1B,0x5D,0x4E,0xA8,0x82,
    0x70,0xED,0xE8,0xEC,0x72,0xB3,0x15,0xC3,0xFF,0xAB,0xB6,0x47,0x44,0x01,0xAC,0x25,
    0xC9,0xFA,0x8E,0x41,0x1A,0x21,0xCB,0xD3,0x0D,0x6E,0xFE,0x26,0x58,0xDA,0x32,0x0F,
    0x20,0xA9,0x9D,0x84,0x98,0x05,0x9C,0xBB,0x22,0x8C,0x63,0xE7,0xC5,0xE1,0x73,0xC6,
    0xAF,0x24,0x5B,0x87,0x66,0x27,0xF7,0x57,0xF4,0x96,0xB1,0xB7,0x5C,0x8B,0xD5,0x54,
    0x79,0xDF,0xAA,0xF6,0x3E,0xA3,0xF1,0x11,0xCA,0xF5,0xD1,0x17,0x7B,0x93,0x83,0xBC,
    0xBD,0x52,0x1E,0xEB,0xAE,0xCC,0xD6,0x35,0x08,0xC8,0x8A,0xB4,0xE2,0xCD,0xBF,0xD9,
    0xD0,0x50,0x59,0x3F,0x4D,0x62,0x34,0x0A,0x48,0x88,0xB5,0x56,0x4C,0x2E,0x6B,0x9E,
    0xD2,0x3D,0x3C,0x03,0x13,0xFB,0x97,0x51,0x75,0x4A,0x91,0x71,0x23,0xBE,0x76,0x2A,
    0x5F,0xF9,0xD4,0x55,0x0B,0xDC,0x37,0x31,0x16,0x74,0xD7,0x77,0xA7,0xE6,0x07,0xDB,
    0xA4,0x2F,0x46,0xF3,0x61,0x45,0x67,0xE3,0x0C,0xA2,0x3B,0x1C,0x85,0x18,0x04,0x1D,
    0x29,0xA0,0x8F,0xB2,0x5A,0xD8,0xA6,0x7E,0xEE,0x8D,0x53,0x4B,0xA1,0x9A,0xC1,0x0E,
    0x7A,0x49,0xA5,0x2C,0x81,0xC4,0xC7,0x36,0x2B,0x7F,0x43,0x95,0x33,0xF2,0x6C,0x68,
    0x6D,0xF0,0x02,0x28,0xCE,0xDD,0x9B,0xEA,0x5E,0x99,0x7C,0x14,0x86,0xCF,0xE5,0x42,
    0xB8,0x40,0x78,0x2D,0x3A,0xE9,0x64,0x1F,0x92,0x90,0x7D,0x39,0x6F,0xE0,0x89,0x30);

    $tabla_asic2 = array(0x4a,0x33,0x78,0x90,0x11,0xaf,0xf2,0x3c);
    $tabla_asic2a = array(0x30,0x49,0x02,0xea,0x6b,0xd5,0x88,0x46); //xor con 0x7A
    $tabla_asic5 = array(0x54,0xa1,0x3b,0x22,0x9d,0xa8,0x11,0x77);
    $tabla_asic5a = array(0xc5,0x30,0xaa,0xb3,0x0c,0x39,0x80,0xe6); //xor con 0x91
    $tabla_asic6 = array(0x56,0xD4,0xD2,0x9F,0x9D,0xDC,0xEE,0x3D);
    $tabla_asic6a = array(0xD5,0x57,0x51,0x1C,0x1E,0x5F,0x6D,0xBE); // xor con 0x83
    $tabla_asic7 = array(0x9c,0xd7,0xe4,0xa9,0xa4,0x36,0x72,0x92);
    $tabla_asic7a = array(0xfd,0xb6,0x85,0xc8,0xc5,0x57,0x13,0xf3); //xor con 0x61

    $tp1 = array(0x3F,0x00,0x7F,0x20,0x6F,0x07,0xFF,0xFF);
    $tp2 = array(0x3F,0x00,0x7F,0x20,0x6F,0x3E,0xFF,0xFF);
    $tp3 = array(0x3F,0x00,0x7F,0x20,0x6F,0x3F,0xFF,0xFF);
    $tp4 = array(0x3F,0x00,0x7F,0x20,0x6F,0x07,0xFF,0xFF);
    $tp5 = array(0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA);
    $tp6 = array(0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA);
    $tp7 = array(0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA);

    $tp_a1 = array(0xFC,0x00,0x01,0x00,0x00,0x00,0x00,0x00);
    $tp_a2 = array(0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00);
    $tp_a3 = array(0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00);
    $tp_a4 = array(0x03,0xFF,0x01,0x00,0x00,0x00,0x00,0x00);
    $tp_a5 = array(0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00);
    $tp_a6 = array(0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00);
    $tp_a7 = array(0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00);

    $tabla_op = array(1,0,0,1,1,0,0,1);
    $tabla_cambio = array(1,0,3,2,5,4,7,6,2,0,6,4,3,1,7,5,4,0,5,1,6,2,7,3);
    $tabla_cambio2 = array(0,1,2,3,4,5,6,7,0,2,4,6,1,3,5,7,0,4,1,5,2,6,3,7);

    function permutacion($cadena1, $cadena2)
    {
    global $tabla_1;
    global $tabla_2;
    global $tabla_3;
    global $tabla_4;
    global $tabla_op;
    global $tabla_cambio;
    global $tabla_cambio2;

    $aux1=0;
    $i=0;

    while ($i < 8) {
    for ($j = 0; $j < 8; $j++) {
    if ($tabla_op[$j] == 1)
    $cadena2[$j] = $cadena2[$j] ^ calculo ($aux1, $cadena1); // xor
    else
    $cadena2[$j] = ($cadena2[$j] + calculo ($aux1, $cadena1)) & 0xFF; // suma
    $aux1++;
    }

    for ($j = 0; $j < 8; $j++) {
    if ($tabla_op[$j] == 1)
    $cadena2[$j] = ($tabla_3[$cadena2[$j]] + calculo ($aux1, $cadena1)) & 0xFF; // suma
    else
    $cadena2[$j] = $tabla_4[$cadena2[$j]] ^ calculo ($aux1, $cadena1); // xor
    $aux1++;
    }

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

    for ($j = 0; $j < 24; $j++)
    $cadena2[$tabla_cambio[$j]] = ($cadena2[$tabla_cambio2[$j]] + $cadena2[$tabla_cambio[$j]]) & 0xFF;

    $valor1=$cadena2[1];
    $valor2=$cadena2[2];
    $valor3=$cadena2[4];
    $cadena2[1]=$valor3;
    $cadena2[2]=$valor1;
    $cadena2[4]=$valor2;

    $valor1=$cadena2[3];
    $valor2=$cadena2[5];
    $valor3=$cadena2[6];
    $cadena2[3]=$valor2;
    $cadena2[5]=$valor3;
    $cadena2[6]=$valor1;

    $i++;
    }

    for ($i = 0; $i < 8; $i++) {
    $valor1=calculo ($aux1, $cadena1);
    $aux1++;
    if ($tabla_op[$i] == 1)
    $cadena2[$i] = $cadena2[$i] ^ $valor1;
    else
    $cadena2[$i] = ($cadena2[$i] + $valor1) & 0xFF;
    }

    return $cadena2;

    }

    function calculo ($cadena1, $cadena2)
    {
    global $tabla_1;
    global $tabla_2;
    global $tabla_3;
    global $tabla_4;

    if ($cadena1 < 0x88) {
    $temp2=$cadena1;
    $temp3=$cadena2[$temp2 & 0x07];
    $valor1=movimiento_bytes($temp2, 3);
    $temp1=$tabla_1[$valor1 & 0x1F];
    $valor2=$temp3;

    for ($i=0; $i<$temp1; $i++)
    $valor2 = movimiento2_bytes ($valor2, 1);

    $temp3=$valor2;
    $temp3=$temp3+$tabla_2[$temp2];

    return $temp3 & 0xFF;
    }
    else {
    return 0;
    }
    }

    function movimiento_bytes ($byte1, $byte2)
    {
    $temp1 = ($byte1 << (8-$byte2));
    $temp2 = ($byte1 >> $byte2);
    return (($temp1 | $temp2) & 0xFF);
    }

    function movimiento2_bytes ($byte1, $byte2)
    {
    $temp1 = ($byte1 >> (8-$byte2));
    $temp2 = ($byte1 << $byte2);
    return (($temp1 | $temp2) & 0xFF);
    }

    function xor_de_8_bytes($cadena1, $cadena2)
    {
    for ($i = 0; $i < 8; $i++) {
    $resultado[$i]=$cadena1[$i] ^ $cadena2[$i];
    }

    return $resultado;
    }

    function convertir_byte_a_hex ($byte)
    {
    if (($byte > 47) && ($byte < 58)) // '0' a '9'
    return ($byte-48);
    else if (($byte > 64) && ($byte < 71)) // 'A' a 'F' o otro caracter
    return ($byte-55);
    else
    return $byte;
    }

    function ASCII2HEX ($origen, $caracteres)
    {
    $j=0;
    for($i=0; $i<$caracteres; $i+=2)
    {
    $aux1 = (convertir_byte_a_hex($origen[$i])<<4);
    if ($i+1 < $caracteres)
    $aux2 = convertir_byte_a_hex($origen[$i+1]);
    else
    $aux2 = 0;
    $destino[$j] = ($aux1 | $aux2)&0xFF;
    $j++;
    }

    return $destino;
    }

    function obtener_codigo($codigo_a_sacar, $asic, $IMEI_ASCII, $network_code_ASCII, $box_serial)
    {
    global $tabla_asic2;
    global $tabla_asic2a;
    global $tabla_asic5;
    global $tabla_asic5a;
    global $tabla_asic6;
    global $tabla_asic6a;
    global $tabla_asic7;
    global $tabla_asic7a;
    global $tabla_1;
    global $tabla_2;
    global $tabla_3;
    global $tabla_4;
    global $tp1;
    global $tp2;
    global $tp3;
    global $tp4;
    global $tp5;
    global $tp6;
    global $tp7;
    global $tp_a1;
    global $tp_a2;
    global $tp_a3;
    global $tp_a4;
    global $tp_a5;
    global $tp_a6;
    global $tp_a7;

    for ($i = 0; $i < strlen($network_code_ASCII); $i++) {
    $network_code[$i] = char_of($network_code_ASCII, $i);
    }

    switch ($asic)
    {
    case 2:
    $tabla_asic=$tabla_asic2;
    $tabla_asic_a=$tabla_asic2a;
    break;
    case 5:
    $tabla_asic=$tabla_asic5;
    $tabla_asic_a=$tabla_asic5a;
    break;
    case 6:
    $tabla_asic=$tabla_asic6;
    $tabla_asic_a=$tabla_asic6a;
    break;
    case 7:
    $tabla_asic=$tabla_asic7;
    $tabla_asic_a=$tabla_asic7a;
    break;
    }

    switch ($codigo_a_sacar)
    {
    case 1:
    $tabla_permutacion1_HEX=$tp1;
    $tabla_permutacion2_HEX=$tp_a1;
    break;
    case 2:
    $tabla_permutacion1_HEX=$tp2;
    $tabla_permutacion2_HEX=$tp_a2;
    break;
    case 3:
    $tabla_permutacion1_HEX=$tp3;
    $tabla_permutacion2_HEX=$tp_a3;
    break;
    case 4:
    $tabla_permutacion1_HEX=$tp4;
    $tabla_permutacion2_HEX=$tp_a4;
    break;
    case 5:
    $tabla_permutacion1_HEX=$tp5;
    $tabla_permutacion2_HEX=$tp_a5;
    break;
    case 6:
    $tabla_permutacion1_HEX=$tp6;
    $tabla_permutacion2_HEX=$tp_a6;
    break;
    case 7:
    $tabla_permutacion1_HEX=$tp7;
    $tabla_permutacion2_HEX=$tp_a7;
    break;
    }

    //pasar a HEX IMEI, codigo red, box serial,
    $IMEI_HEX = ASCII2HEX(string_to_array($IMEI_ASCII), 14);
    $IMEI_HEX[7]=0;
    $network_code_HEX = ASCII2HEX($network_code, 16);
    $box_serial_HEX = ASCII2HEX(string_to_array($box_serial), 6);

    $tabla_permutacion2_HEX[7]=$tabla_permutacion2_HEX[2];
    $tabla_permutacion2_HEX[2]=0;

    $permu1 = xor_de_8_bytes ($tabla_asic_a, $IMEI_HEX);
    $permu2 = $tabla_permutacion1_HEX;
    $permu2 = permutacion($permu1, $permu2);
    $permu3 = $permu2;
    $permu1 = xor_de_8_bytes($tabla_asic, $IMEI_HEX);
    $permu2 = $tabla_permutacion2_HEX;
    $permu2 = permutacion($permu1, $permu2);
    $permu4 = $permu2;
    $permu5 = xor_de_8_bytes($permu3, $permu4);
    $permu1 = xor_de_8_bytes($tabla_asic, $network_code_HEX);
    $permu2 = $permu5;
    $permu2 = permutacion($permu1, $permu2);
    $permu6 = $permu2;

    $codigo_liberacion_HEX[0] = $box_serial_HEX[0];
    $codigo_liberacion_HEX[1] = $box_serial_HEX[1];
    $codigo_liberacion_HEX[2] = $box_serial_HEX[2];
    $codigo_liberacion_HEX[3] = ($permu6[5] & 0x77);
    $codigo_liberacion_HEX[4] = ($permu6[1] & 0x77);
    $codigo_liberacion_HEX[5] = ($permu6[6] & 0x77);
    $codigo_liberacion_HEX[6] = ($permu6[3] & 0x77);
    $codigo_liberacion_HEX[7] = ($permu6[7] & 0x77);

    // --------

    for ($i=3; $i<8; $i++)
    $codigo_liberacion_HEX[5+$i] = (($codigo_liberacion_HEX[$i] & 0xF0) >> 4);

    $aux[0] = $codigo_liberacion_HEX[0] & 0x0F;
    $aux[1] = ($codigo_liberacion_HEX[1] & 0xF0) >> 4;
    $aux[2] = $codigo_liberacion_HEX[1] & 0x0F;
    $aux[3] = ($codigo_liberacion_HEX[2] & 0xF0) >> 4;
    $aux[4] = $codigo_liberacion_HEX[2] & 0x0F;

    for ($i=0; $i<5; $i++) {
    if ($aux[$i] <= $codigo_liberacion_HEX[8+$i])
    $codigo_liberacion_HEX[8+$i]=$codigo_liberacion_HEX[8+$i]-$aux[$i];
    else
    $codigo_liberacion_HEX[8+$i]=(10-$aux[$i])+$codigo_liberacion_HEX[8+$i];
    }

    $codigo_liberacion_HEX[0]=($codigo_liberacion_HEX[0] & 0xF0) | $codigo_liberacion_HEX[8];
    $codigo_liberacion_HEX[1]=($codigo_liberacion_HEX[9] << 4) | $codigo_liberacion_HEX[10];
    $codigo_liberacion_HEX[2]=($codigo_liberacion_HEX[11] << 4) | $codigo_liberacion_HEX[12];

    $destino_codigo_liberacion[0]=chr(($codigo_liberacion_HEX[0] & 0x0F) + 0x30);
    $j=1;
    for ($i=1; $i<=7; $i++) {
    $destino_codigo_liberacion[$j]=chr(($codigo_liberacion_HEX[$i] >> 4) + 0x30);
    $j++;
    $destino_codigo_liberacion[$j]=chr(($codigo_liberacion_HEX[$i] & 0x0F) + 0x30);
    $j++;
    }

    return $destino_codigo_liberacion;
    }

    for ($i = 1; $i < 8; $i++) {
    $resultado = obtener_codigo ($i, $_GET[asic], $_GET[imei], $_GET[net], "0".$_GET[box]);
    $resultado = implode("", $resultado);
    echo "#pw+".$resultado."+".$i."#<br>";
    }

    echo "<br><br><b>PHPcalc by indear</b>";

    ?>

  10. #10
    SitePoint Member
    Join Date
    Aug 2005
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    But will that use the values from the text boxes and post them to the script?

    Do I need to name the text boxes anything specific so the script knows which ones they are?

  11. #11
    Who turned the lights out !! Mandes's Avatar
    Join Date
    May 2005
    Location
    S.W. France
    Posts
    2,496
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    This is the script

    PHP Code:
    <?php
     
    // uso: http://localhost/dct4.php?imei=1111...22222&box=34144

    // *********************************
    function string_to_array($cadena)
    {
    for (
    $i 0$i strlen($cadena); $i++)
    $nueva[$i] = ord(substr($cadena$i1));
    return 
    $nueva;
    }

    function 
    char_of($cadena$pos)
    {
    return 
    ord(substr($cadena$pos1));
    }
    //**********************************

    $tabla_1 = array(0x00,0x03,0x06,0x01,0x04,0x07,0x02,0x05,0x00,0x03,0x06,0x01,0x04,0x07,0x 02,0x05,0x00);
    $tabla_2 = array(0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x16,0x73,0x3B,0x1E,0x8E,0x70,0x BD,0x86,
    0x47,0x7E,0x24,0x56,0xF1,0x77,0x88,0x46,0xB1,0xBA,0xA3,0xB7,0x10,0x0A,0xC5,0x3 7,
    0xC9,0x5A,0x28,0xAC,0x64,0xA5,0xEC,0xAB,0xC6,0x67,0x95,0x58,0x0D,0xF8,0x9A,0xF 6,
    0x66,0xDC,0x05,0x3D,0xD3,0x8A,0xC3,0xD8,0x6A,0xE9,0x36,0x49,0x43,0xBF,0xEB,0xD 4,
    0x9B,0x68,0xA0,0x65,0x5D,0x57,0x92,0x1F,0x71,0x5C,0xBB,0x22,0xC1,0xBE,0x7B,0xB C,
    0x63,0x94,0x5F,0x2A,0x61,0xB8,0x34,0x32,0xFD,0xFB,0x17,0x40,0xE6,0x51,0x1D,0x4 1,
    0x8F,0x29,0xDD,0x04,0x80,0xDE,0xE7,0x31,0x7F,0x01,0xA2,0xF7,0x39,0xDA,0x6F,0x2 3,
    0xFE,0x3A,0xD0,0x1C,0xD1,0x30,0x3E,0x12,0xCD,0x0F,0xE0,0xA8,0xAF,0x82,0x59,0x2 C,
    0x7D,0xAD,0xB2,0xEF,0xC2,0x87,0xCE,0x75);
    $tabla_3 = array(0x01,0x2D,0xE2,0x93,0xBE,0x45,0x15,0xAE,0x78,0x03,0x87,0xA4,0xB8,0x38,0x CF,0x3F,
    0x08,0x67,0x09,0x94,0xEB,0x26,0xA8,0x6B,0xBD,0x18,0x34,0x1B,0xBB,0xBF,0x72,0xF 7,
    0x40,0x35,0x48,0x9C,0x51,0x2F,0x3B,0x55,0xE3,0xC0,0x9F,0xD8,0xD3,0xF3,0x8D,0xB 1,
    0xFF,0xA7,0x3E,0xDC,0x86,0x77,0xD7,0xA6,0x11,0xFB,0xF4,0xBA,0x92,0x91,0x64,0x8 3,
    0xF1,0x33,0xEF,0xDA,0x2C,0xB5,0xB2,0x2B,0x88,0xD1,0x99,0xCB,0x8C,0x84,0x1D,0x1 4,
    0x81,0x97,0x71,0xCA,0x5F,0xA3,0x8B,0x57,0x3C,0x82,0xC4,0x52,0x5C,0x1C,0xE8,0xA 0,
    0x04,0xB4,0x85,0x4A,0xF6,0x13,0x54,0xB6,0xDF,0x0C,0x1A,0x8E,0xDE,0xE0,0x39,0xF C,
    0x20,0x9B,0x24,0x4E,0xA9,0x98,0x9E,0xAB,0xF2,0x60,0xD0,0x6C,0xEA,0xFA,0xC7,0xD 9,
    0x00,0xD4,0x1F,0x6E,0x43,0xBC,0xEC,0x53,0x89,0xFE,0x7A,0x5D,0x49,0xC9,0x32,0xC 2,
    0xF9,0x9A,0xF8,0x6D,0x16,0xDB,0x59,0x96,0x44,0xE9,0xCD,0xE6,0x46,0x42,0x8F,0x0 A,
    0xC1,0xCC,0xB9,0x65,0xB0,0xD2,0xC6,0xAC,0x1E,0x41,0x62,0x29,0x2E,0x0E,0x74,0x5 0,
    0x02,0x5A,0xC3,0x25,0x7B,0x8A,0x2A,0x5B,0xF0,0x06,0x0D,0x47,0x6F,0x70,0x9D,0x7 E,
    0x10,0xCE,0x12,0x27,0xD5,0x4C,0x4F,0xD6,0x79,0x30,0x68,0x36,0x75,0x7D,0xE4,0xE D,
    0x80,0x6A,0x90,0x37,0xA2,0x5E,0x76,0xAA,0xC5,0x7F,0x3D,0xAF,0xA5,0xE5,0x19,0x6 1,
    0xFD,0x4D,0x7C,0xB7,0x0B,0xEE,0xAD,0x4B,0x22,0xF5,0xE7,0x73,0x23,0x21,0xC8,0x0 5,
    0xE1,0x66,0xDD,0xB3,0x58,0x69,0x63,0x56,0x0F,0xA1,0x31,0x95,0x17,0x07,0x3A,0x2 8);
    $tabla_4 = array(0x80,0x00,0xB0,0x09,0x60,0xEF,0xB9,0xFD,0x10,0x12,0x9F,0xE4,0x69,0xBA,0x AD,0xF8,
    0xC0,0x38,0xC2,0x65,0x4F,0x06,0x94,0xFC,0x19,0xDE,0x6A,0x1B,0x5D,0x4E,0xA8,0x8 2,
    0x70,0xED,0xE8,0xEC,0x72,0xB3,0x15,0xC3,0xFF,0xAB,0xB6,0x47,0x44,0x01,0xAC,0x2 5,
    0xC9,0xFA,0x8E,0x41,0x1A,0x21,0xCB,0xD3,0x0D,0x6E,0xFE,0x26,0x58,0xDA,0x32,0x0 F,
    0x20,0xA9,0x9D,0x84,0x98,0x05,0x9C,0xBB,0x22,0x8C,0x63,0xE7,0xC5,0xE1,0x73,0xC 6,
    0xAF,0x24,0x5B,0x87,0x66,0x27,0xF7,0x57,0xF4,0x96,0xB1,0xB7,0x5C,0x8B,0xD5,0x5 4,
    0x79,0xDF,0xAA,0xF6,0x3E,0xA3,0xF1,0x11,0xCA,0xF5,0xD1,0x17,0x7B,0x93,0x83,0xB C,
    0xBD,0x52,0x1E,0xEB,0xAE,0xCC,0xD6,0x35,0x08,0xC8,0x8A,0xB4,0xE2,0xCD,0xBF,0xD 9,
    0xD0,0x50,0x59,0x3F,0x4D,0x62,0x34,0x0A,0x48,0x88,0xB5,0x56,0x4C,0x2E,0x6B,0x9 E,
    0xD2,0x3D,0x3C,0x03,0x13,0xFB,0x97,0x51,0x75,0x4A,0x91,0x71,0x23,0xBE,0x76,0x2 A,
    0x5F,0xF9,0xD4,0x55,0x0B,0xDC,0x37,0x31,0x16,0x74,0xD7,0x77,0xA7,0xE6,0x07,0xD B,
    0xA4,0x2F,0x46,0xF3,0x61,0x45,0x67,0xE3,0x0C,0xA2,0x3B,0x1C,0x85,0x18,0x04,0x1 D,
    0x29,0xA0,0x8F,0xB2,0x5A,0xD8,0xA6,0x7E,0xEE,0x8D,0x53,0x4B,0xA1,0x9A,0xC1,0x0 E,
    0x7A,0x49,0xA5,0x2C,0x81,0xC4,0xC7,0x36,0x2B,0x7F,0x43,0x95,0x33,0xF2,0x6C,0x6 8,
    0x6D,0xF0,0x02,0x28,0xCE,0xDD,0x9B,0xEA,0x5E,0x99,0x7C,0x14,0x86,0xCF,0xE5,0x4 2,
    0xB8,0x40,0x78,0x2D,0x3A,0xE9,0x64,0x1F,0x92,0x90,0x7D,0x39,0x6F,0xE0,0x89,0x3 0);

    $tabla_asic2 = array(0x4a,0x33,0x78,0x90,0x11,0xaf,0xf2,0x3c);
    $tabla_asic2a = array(0x30,0x49,0x02,0xea,0x6b,0xd5,0x88,0x46); //xor con 0x7A
    $tabla_asic5 = array(0x54,0xa1,0x3b,0x22,0x9d,0xa8,0x11,0x77);
    $tabla_asic5a = array(0xc5,0x30,0xaa,0xb3,0x0c,0x39,0x80,0xe6); //xor con 0x91
    $tabla_asic6 = array(0x56,0xD4,0xD2,0x9F,0x9D,0xDC,0xEE,0x3D);
    $tabla_asic6a = array(0xD5,0x57,0x51,0x1C,0x1E,0x5F,0x6D,0xBE); // xor con 0x83
    $tabla_asic7 = array(0x9c,0xd7,0xe4,0xa9,0xa4,0x36,0x72,0x92);
    $tabla_asic7a = array(0xfd,0xb6,0x85,0xc8,0xc5,0x57,0x13,0xf3); //xor con 0x61

    $tp1 = array(0x3F,0x00,0x7F,0x20,0x6F,0x07,0xFF,0xFF);
    $tp2 = array(0x3F,0x00,0x7F,0x20,0x6F,0x3E,0xFF,0xFF);
    $tp3 = array(0x3F,0x00,0x7F,0x20,0x6F,0x3F,0xFF,0xFF);
    $tp4 = array(0x3F,0x00,0x7F,0x20,0x6F,0x07,0xFF,0xFF);
    $tp5 = array(0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA);
    $tp6 = array(0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA);
    $tp7 = array(0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA);

    $tp_a1 = array(0xFC,0x00,0x01,0x00,0x00,0x00,0x00,0x00);
    $tp_a2 = array(0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00);
    $tp_a3 = array(0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00);
    $tp_a4 = array(0x03,0xFF,0x01,0x00,0x00,0x00,0x00,0x00);
    $tp_a5 = array(0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00);
    $tp_a6 = array(0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00);
    $tp_a7 = array(0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00);

    $tabla_op = array(1,0,0,1,1,0,0,1);
    $tabla_cambio = array(1,0,3,2,5,4,7,6,2,0,6,4,3,1,7,5,4,0,5,1,6,2,7,3);
    $tabla_cambio2 = array(0,1,2,3,4,5,6,7,0,2,4,6,1,3,5,7,0,4,1,5,2,6,3,7);

    function 
    permutacion($cadena1$cadena2)
    {
    global 
    $tabla_1;
    global 
    $tabla_2;
    global 
    $tabla_3;
    global 
    $tabla_4;
    global 
    $tabla_op;
    global 
    $tabla_cambio;
    global 
    $tabla_cambio2;

    $aux1=0;
    $i=0;

    while (
    $i 8) {
    for (
    $j 0$j 8$j++) {
    if (
    $tabla_op[$j] == 1)
    $cadena2[$j] = $cadena2[$j] ^ calculo ($aux1$cadena1); // xor
    else
    $cadena2[$j] = ($cadena2[$j] + calculo ($aux1$cadena1)) & 0xFF// suma
    $aux1++;
    }

    for (
    $j 0$j 8$j++) {
    if (
    $tabla_op[$j] == 1)
    $cadena2[$j] = ($tabla_3[$cadena2[$j]] + calculo ($aux1$cadena1)) & 0xFF// suma
    else
    $cadena2[$j] = $tabla_4[$cadena2[$j]] ^ calculo ($aux1$cadena1); // xor
    $aux1++;
    }

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

    for ($j 0$j 24$j++)
    $cadena2[$tabla_cambio[$j]] = ($cadena2[$tabla_cambio2[$j]] + $cadena2[$tabla_cambio[$j]]) & 0xFF;

    $valor1=$cadena2[1];
    $valor2=$cadena2[2];
    $valor3=$cadena2[4];
    $cadena2[1]=$valor3;
    $cadena2[2]=$valor1;
    $cadena2[4]=$valor2;

    $valor1=$cadena2[3];
    $valor2=$cadena2[5];
    $valor3=$cadena2[6];
    $cadena2[3]=$valor2;
    $cadena2[5]=$valor3;
    $cadena2[6]=$valor1;

    $i++;
    }

    for (
    $i 0$i 8$i++) {
    $valor1=calculo ($aux1$cadena1);
    $aux1++;
    if (
    $tabla_op[$i] == 1)
    $cadena2[$i] = $cadena2[$i] ^ $valor1;
    else
    $cadena2[$i] = ($cadena2[$i] + $valor1) & 0xFF;
    }

    return 
    $cadena2;

    }

    function 
    calculo ($cadena1$cadena2)
    {
    global 
    $tabla_1;
    global 
    $tabla_2;
    global 
    $tabla_3;
    global 
    $tabla_4;

    if (
    $cadena1 0x88) {
    $temp2=$cadena1;
    $temp3=$cadena2[$temp2 0x07];
    $valor1=movimiento_bytes($temp23);
    $temp1=$tabla_1[$valor1 0x1F];
    $valor2=$temp3;

    for (
    $i=0$i<$temp1$i++)
    $valor2 movimiento2_bytes ($valor21);

    $temp3=$valor2;
    $temp3=$temp3+$tabla_2[$temp2];

    return 
    $temp3 0xFF;
    }
    else {
    return 
    0;
    }
    }

    function 
    movimiento_bytes ($byte1$byte2)
    {
    $temp1 = ($byte1 << (8-$byte2));
    $temp2 = ($byte1 >> $byte2);
    return ((
    $temp1 $temp2) & 0xFF);
    }

    function 
    movimiento2_bytes ($byte1$byte2)
    {
    $temp1 = ($byte1 >> (8-$byte2));
    $temp2 = ($byte1 << $byte2);
    return ((
    $temp1 $temp2) & 0xFF);
    }

    function 
    xor_de_8_bytes($cadena1$cadena2)
    {
    for (
    $i 0$i 8$i++) {
    $resultado[$i]=$cadena1[$i] ^ $cadena2[$i];
    }

    return 
    $resultado;
    }

    function 
    convertir_byte_a_hex ($byte)
    {
    if ((
    $byte 47) && ($byte 58)) // '0' a '9'
    return ($byte-48);
    else if ((
    $byte 64) && ($byte 71)) // 'A' a 'F' o otro caracter
    return ($byte-55);
    else
    return 
    $byte;
    }

    function 
    ASCII2HEX ($origen$caracteres)
    {
    $j=0;
    for(
    $i=0$i<$caracteres$i+=2)
    {
    $aux1 = (convertir_byte_a_hex($origen[$i])<<4);
    if (
    $i+$caracteres)
    $aux2 convertir_byte_a_hex($origen[$i+1]);
    else
    $aux2 0;
    $destino[$j] = ($aux1 $aux2)&0xFF;
    $j++;
    }

    return 
    $destino;
    }

    function 
    obtener_codigo($codigo_a_sacar$asic$IMEI_ASCII$network_code_ASCII$box_serial)
    {
    global 
    $tabla_asic2;
    global 
    $tabla_asic2a;
    global 
    $tabla_asic5;
    global 
    $tabla_asic5a;
    global 
    $tabla_asic6;
    global 
    $tabla_asic6a;
    global 
    $tabla_asic7;
    global 
    $tabla_asic7a;
    global 
    $tabla_1;
    global 
    $tabla_2;
    global 
    $tabla_3;
    global 
    $tabla_4;
    global 
    $tp1;
    global 
    $tp2;
    global 
    $tp3;
    global 
    $tp4;
    global 
    $tp5;
    global 
    $tp6;
    global 
    $tp7;
    global 
    $tp_a1;
    global 
    $tp_a2;
    global 
    $tp_a3;
    global 
    $tp_a4;
    global 
    $tp_a5;
    global 
    $tp_a6;
    global 
    $tp_a7;

    for (
    $i 0$i strlen($network_code_ASCII); $i++) {
    $network_code[$i] = char_of($network_code_ASCII$i);
    }

    switch (
    $asic)
    {
    case 
    2:
    $tabla_asic=$tabla_asic2;
    $tabla_asic_a=$tabla_asic2a;
    break;
    case 
    5:
    $tabla_asic=$tabla_asic5;
    $tabla_asic_a=$tabla_asic5a;
    break;
    case 
    6:
    $tabla_asic=$tabla_asic6;
    $tabla_asic_a=$tabla_asic6a;
    break;
    case 
    7:
    $tabla_asic=$tabla_asic7;
    $tabla_asic_a=$tabla_asic7a;
    break;
    }

    switch (
    $codigo_a_sacar)
    {
    case 
    1:
    $tabla_permutacion1_HEX=$tp1;
    $tabla_permutacion2_HEX=$tp_a1;
    break;
    case 
    2:
    $tabla_permutacion1_HEX=$tp2;
    $tabla_permutacion2_HEX=$tp_a2;
    break;
    case 
    3:
    $tabla_permutacion1_HEX=$tp3;
    $tabla_permutacion2_HEX=$tp_a3;
    break;
    case 
    4:
    $tabla_permutacion1_HEX=$tp4;
    $tabla_permutacion2_HEX=$tp_a4;
    break;
    case 
    5:
    $tabla_permutacion1_HEX=$tp5;
    $tabla_permutacion2_HEX=$tp_a5;
    break;
    case 
    6:
    $tabla_permutacion1_HEX=$tp6;
    $tabla_permutacion2_HEX=$tp_a6;
    break;
    case 
    7:
    $tabla_permutacion1_HEX=$tp7;
    $tabla_permutacion2_HEX=$tp_a7;
    break;
    }

    //pasar a HEX IMEI, codigo red, box serial,
    $IMEI_HEX ASCII2HEX(string_to_array($IMEI_ASCII), 14);
    $IMEI_HEX[7]=0;
    $network_code_HEX ASCII2HEX($network_code16);
    $box_serial_HEX ASCII2HEX(string_to_array($box_serial), 6);

    $tabla_permutacion2_HEX[7]=$tabla_permutacion2_HEX[2];
    $tabla_permutacion2_HEX[2]=0;

    $permu1 xor_de_8_bytes ($tabla_asic_a$IMEI_HEX);
    $permu2 $tabla_permutacion1_HEX;
    $permu2 permutacion($permu1$permu2);
    $permu3 $permu2;
    $permu1 xor_de_8_bytes($tabla_asic$IMEI_HEX);
    $permu2 $tabla_permutacion2_HEX;
    $permu2 permutacion($permu1$permu2);
    $permu4 $permu2;
    $permu5 xor_de_8_bytes($permu3$permu4);
    $permu1 xor_de_8_bytes($tabla_asic$network_code_HEX);
    $permu2 $permu5;
    $permu2 permutacion($permu1$permu2);
    $permu6 $permu2;

    $codigo_liberacion_HEX[0] = $box_serial_HEX[0];
    $codigo_liberacion_HEX[1] = $box_serial_HEX[1];
    $codigo_liberacion_HEX[2] = $box_serial_HEX[2];
    $codigo_liberacion_HEX[3] = ($permu6[5] & 0x77);
    $codigo_liberacion_HEX[4] = ($permu6[1] & 0x77);
    $codigo_liberacion_HEX[5] = ($permu6[6] & 0x77);
    $codigo_liberacion_HEX[6] = ($permu6[3] & 0x77);
    $codigo_liberacion_HEX[7] = ($permu6[7] & 0x77);

    // --------

    for ($i=3$i<8$i++)
    $codigo_liberacion_HEX[5+$i] = (($codigo_liberacion_HEX[$i] & 0xF0) >> 4);

    $aux[0] = $codigo_liberacion_HEX[0] & 0x0F;
    $aux[1] = ($codigo_liberacion_HEX[1] & 0xF0) >> 4;
    $aux[2] = $codigo_liberacion_HEX[1] & 0x0F;
    $aux[3] = ($codigo_liberacion_HEX[2] & 0xF0) >> 4;
    $aux[4] = $codigo_liberacion_HEX[2] & 0x0F;

    for (
    $i=0$i<5$i++) {
    if (
    $aux[$i] <= $codigo_liberacion_HEX[8+$i])
    $codigo_liberacion_HEX[8+$i]=$codigo_liberacion_HEX[8+$i]-$aux[$i];
    else
    $codigo_liberacion_HEX[8+$i]=(10-$aux[$i])+$codigo_liberacion_HEX[8+$i];
    }

    $codigo_liberacion_HEX[0]=($codigo_liberacion_HEX[0] & 0xF0) | $codigo_liberacion_HEX[8];
    $codigo_liberacion_HEX[1]=($codigo_liberacion_HEX[9] << 4) | $codigo_liberacion_HEX[10];
    $codigo_liberacion_HEX[2]=($codigo_liberacion_HEX[11] << 4) | $codigo_liberacion_HEX[12];

    $destino_codigo_liberacion[0]=chr(($codigo_liberacion_HEX[0] & 0x0F) + 0x30);
    $j=1;
    for (
    $i=1$i<=7$i++) {
    $destino_codigo_liberacion[$j]=chr(($codigo_liberacion_HEX[$i] >> 4) + 0x30);
    $j++;
    $destino_codigo_liberacion[$j]=chr(($codigo_liberacion_HEX[$i] & 0x0F) + 0x30);
    $j++;
    }

    return 
    $destino_codigo_liberacion;
    }

    for (
    $i 1$i 8$i++) {
    $resultado obtener_codigo ($i$_POST[box1], $_POST[box2], $_POST[box3], "0".$_POST[box4]);
    $resultado implode(""$resultado);
    echo 
    "#pw+".$resultado."+".$i."#<br>";
    }

    echo 
    "<br><br><b>PHPcalc by indear</b>";

    ?>
    A Little Knowledge Is A Very Dangerous Thing.......
    That Makes Me A Lethal Weapon !!!!!!!!

    Contract PHP Programming

  12. #12
    Who turned the lights out !! Mandes's Avatar
    Join Date
    May 2005
    Location
    S.W. France
    Posts
    2,496
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by lucas20042004
    But will that use the values from the text boxes and post them to the script?

    Do I need to name the text boxes anything specific so the script knows which ones they are?
    Your text boxes on your form are named 'box1','box2','box3' and 'box4'.

    I've altered you script so that it looks for inputs from these boxes.
    A Little Knowledge Is A Very Dangerous Thing.......
    That Makes Me A Lethal Weapon !!!!!!!!

    Contract PHP Programming

  13. #13
    SitePoint Member
    Join Date
    Aug 2005
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks. I have run it on my site but I get

    Parse error: parse error, unexpected T_STRING, expecting ')' in /home/vhosts/xxxxxxx.fbhosting.com/script.php on line 19

    Do you know why that is? Thanks

  14. #14
    Who turned the lights out !! Mandes's Avatar
    Join Date
    May 2005
    Location
    S.W. France
    Posts
    2,496
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Well its an error on line 19 of your PHP script (or thereabouts).

    But I can't see where it would be, looks fine at the moment
    A Little Knowledge Is A Very Dangerous Thing.......
    That Makes Me A Lethal Weapon !!!!!!!!

    Contract PHP Programming

  15. #15
    SitePoint Member
    Join Date
    Aug 2005
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Iv cracked it. I used get instead of post and now it sends the text box values to the script. Thanks

  16. #16
    Who turned the lights out !! Mandes's Avatar
    Join Date
    May 2005
    Location
    S.W. France
    Posts
    2,496
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Yes sorry, I change the script to use POST instead of GET, far more neater, not sure why that would have given you an error on line 19 though.
    A Little Knowledge Is A Very Dangerous Thing.......
    That Makes Me A Lethal Weapon !!!!!!!!

    Contract PHP Programming

  17. #17
    SitePoint Zealot zoso's Avatar
    Join Date
    Aug 2005
    Location
    Earth..
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It is because of the spaces in the script .Remove them if possible.

  18. #18
    SitePoint Zealot zoso's Avatar
    Join Date
    Aug 2005
    Location
    Earth..
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It is because of the spaces in the array elements .Remove them if possible.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •