php-general Digest 26 May 2011 19:00:57 -0000 Issue 7329

Topics (messages 313153 through 313156):

Re: How can a UTF-8 string can be converted to an array of Bytes?
        313153 by: Eric Butera

Re: simple question abt convert to integer
        313154 by: Bálint Horváth
        313155 by: Negin Nickparsa

PHP to Java integration using : shell_exec function
        313156 by: Eli Orr (Office)

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
On Wed, May 25, 2011 at 8:15 AM, Eli Orr (Office) <eli....@logodial.com> wrote:
> Hi,
>
> Since a UTF-8 is a multi-bytes mechanism I get for 2 or 3 bytes  UTF-8
> encoded character a single character
>
> How can it be break into the REAL bytes array that represent the UTF-8
> string
>  and how  can we reassembled the bytes array  back to UTF-8?
>
> --
> Best Regards,
>
> *Eli Orr*
> CTO & Founder
> *LogoDial Ltd.*
>
> __
>

You can use mb_substr [1] with a UTF-8 encoding to get the single characters.

http://us.php.net/mb_substr

--- End Message ---
--- Begin Message ---
The problem is that if you set the post directly to the query it's available
to be an attach code in the field... (eg. DROP DATABASE;) it's called to
"SQL injection"...

what I mean on filtering:
always check the values in query eg.: $id = $_POST['id'];
if(is_numeric($id)){...}else{bad post}
and at other fields u can use eg. strstr() etc...

On Wed, May 25, 2011 at 4:38 PM, Negin Nickparsa <nickpa...@gmail.com>wrote:

> Tnx to all:D
> Paul you are absolutly right:D
> it was a bad mistake from me
> there was no need 2 convert it
> Balint helped me n with mysql_error i found that
> my code hasn't any mistake
> i just forgot the BIG thing!
> selecting db:D
> i totally forgot it because i had array keys with if statement n in there i
> selected it
> but in the last one of them i forgot 2 set the selection of DB
> Ashley what is OP? and filtering i didn't understand
> Andre why u r telling me
> Note: you *didn't* execute the query by calling mysql_query on it.
> if it doesn't execute the query then what's it doing?
> Reply
> Vitalli believe me that i tried it n i can send the string without  error i
> tried it:
> $query1="select * from patient where id=".$_POST['txt'];
> it works! after i found my error i tried it 2 n it was right!!!
>

--- End Message ---
--- Begin Message ---
i got it tnx Balint

--- End Message ---
--- Begin Message ---

Hi,

Please advise if the following is possible and how can pass parameters from the PHP to the Java application.

Thanks.

Here's my script draft:

<?PHP
      ...
      ....
      $XML_toEnc = urlencode ($XML);

// The XML_toEnc is a string and shall be urlencoded ! $EncXML = shell_exec(""/usr/bin/java/java -jar MyApp.jar -XML <$XML_toEnc>); <<== ??? How can I pass parameters like a large string of let say XML?

echo  $EncXML; // back to the MObile Client

// Receiving client shall:
//  urldecode the string


?>


Eli Orr


--- End Message ---

Reply via email to