php-general Digest 7 Sep 2007 14:01:10 -0000 Issue 5005
Topics (messages 261809 through 261815):
Re: Generating foldout menus in php
261809 by: Ken Kixmoeller -- reply to ken.kixmoeller.com
Is it possible to create a php.so
261810 by: Khai
Converting PHP code to C#?
261811 by: Symbian
261812 by: mike
Re: capital "I" letters in func/class method names do not work with turkish
locale in php5
261813 by: Roman
Reg.Photo Upload Tool
261814 by: Ramesh.b
261815 by: Jay Blanchard
Administrivia:
To subscribe to the digest, e-mail:
[EMAIL PROTECTED]
To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]
To post to the list, e-mail:
[EMAIL PROTECTED]
----------------------------------------------------------------------
--- Begin Message ---
On Sep 6, 2007, at 1:17 PM, Ken Kixmoeller -- reply to
[EMAIL PROTECTED] wrote:
Aesthetically, though, even though I used the "horizontal" classes,
it comes out vertical
Never mind (not that you did) -- got it working fine ---
--- End Message ---
--- Begin Message ---
I have several background processes written in PHP. In our design, we
have the parent process which check if there is work to process, and if
so launch a child process via exec() to do actual work. By design, we
want the child process to do just what it was told to do and gracefully
terminate. We don't want the child process to live longer than 10
minutes.
My coworker looked at ZendPlatform, and APC, but he found that these
does not do anything for PHP program that are run from command line. I
know at this point ZendPlatform does not support command line. Is this
true with APC? Is there any other caching implementation that we can use?
Is it possible to compile PHP so that the core of it is in a dynamically
linked library (I am running in a Linux/Unix environment)?
Can I turn my PHP code into a dynamic link library ?
Thanks
Khai
--- End Message ---
--- Begin Message ---
Hi,
I'm not sure if this is the right place to post this, I have some decryption
routines that use mcrypt that I need to decrypt in .NET, does anyone know
how why I cant get this to work?
---- PHP
$mcryptSize = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB);
$mcryptIV = mcrypt_create_iv($mcryptSize, MCRYPT_RAND);
$mcryptData = pack("H*", $data);
$decryptData =
mcrypt_decrypt(MCRYPT_RIJNDAEL_128,$key,$mcryptData,MCRYPT_MODE_ECB,$mcryptIV);
---------
$decryptData should be 2048 in size. Here's my C# converted bits:
------------- C#
RijndaelManaged rj = new RijndaelManaged();
rj.Mode = CipherMode.ECB;
rj.Key = ASCIIEncoding.ASCII.GetBytes(KEY);
rj.KeySize = 128;
rj.GenerateIV();
rj.Padding = PaddingMode.Zeros;
ICryptoTransform trans = rj.CreateDecryptor(rj.Key, rj.IV);
byte[] Buffer = Convert.FromBase64String(DATA);
string dataD =
ASCIIEncoding.ASCII.GetString(trans.TransformFinalBlock(Buffer,0,
Buffer.Length));
-------------
However the length is 3017
Any ideas?
Thanks,
Sym
--
View this message in context:
http://www.nabble.com/Converting-PHP-code-to-C---tf4397727.html#a12541304
Sent from the PHP - General mailing list archive at Nabble.com.
--- End Message ---
--- Begin Message ---
On 9/7/07, Symbian <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I'm not sure if this is the right place to post this, I have some decryption
> routines that use mcrypt that I need to decrypt in .NET, does anyone know
> how why I cant get this to work?
I've done it in reverse - something encrypted in .NET and then decrypted in PHP
these were my notes...
To get .NET and PHP to play friendly with two-way encryption, you need
to make sure some things happen in both:
In .NET:
1) You need to set the Padding to PaddingMode.Zeros, i.e.:
Rijndael alg = Rijndael.Create();
alg.Padding = PaddingMode.Zeros;
2) You also need to make sure to use System.Text.Encoding.ASCII or
System.Text.Encoding.UTF8; System.Text.Encoding.Unicode will *not*
work (perhaps in PHP6 this might be possible.)
3) Need to make sure the IV and key are the same as defined in PHP.
In PHP:
1) You need the mcrypt extension installed.
2) Need to make sure the IV and key are the same as defined in .NET.
3) You can issue this single line of code to decrypt:
mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $encrypted_text, "cbc", $iv);
Notes:
1) By default .NET uses a 128-bit cipher in CBC mode when you
initialize Rijndael. That might not be common knowledge.
2) If you're sending this data via a URL or cookie or something else,
be sure to base64 encode on the .NET side, and base64_decode() the
data on the PHP side.
below i would say that:
a) you need to make sure the IV is the same. right now it looks like
you are creating a random one in PHP and a different one in .NET. that
would be my first thing to check.
b) not sure if ECB vs. CBC is any different; i know CBC will work though.
hope that helps some. it took some debugging for us, and it didn't
help that our .NET guy created the IV using low and high ascii
character codes that I had to reproduce in PHP for the IV and the
key... I would get different sizes as well, but once the stars aligned
it worked perfectly. Be sure that any base64 encoding/decoding or
anything like that is done in the proper order (typically start out
with no encoding, get it to work, then add on encoding and decoding on
both ends properly, etc.)
good luck :)
> ---- PHP
> $mcryptSize = mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB);
> $mcryptIV = mcrypt_create_iv($mcryptSize, MCRYPT_RAND);
> $mcryptData = pack("H*", $data);
> $decryptData =
> mcrypt_decrypt(MCRYPT_RIJNDAEL_128,$key,$mcryptData,MCRYPT_MODE_ECB,$mcryptIV);
> ---------
>
> $decryptData should be 2048 in size. Here's my C# converted bits:
> ------------- C#
>
> RijndaelManaged rj = new RijndaelManaged();
> rj.Mode = CipherMode.ECB;
> rj.Key = ASCIIEncoding.ASCII.GetBytes(KEY);
> rj.KeySize = 128;
> rj.GenerateIV();
> rj.Padding = PaddingMode.Zeros;
> ICryptoTransform trans = rj.CreateDecryptor(rj.Key, rj.IV);
> byte[] Buffer = Convert.FromBase64String(DATA);
> string dataD =
> ASCIIEncoding.ASCII.GetString(trans.TransformFinalBlock(Buffer,0,
> Buffer.Length));
> -------------
>
> However the length is 3017
--- End Message ---
--- Begin Message ---
On Thu, 06 Sep 2007 15:57:57 +0300, Tijnema <[EMAIL PROTECTED]> wrote:
On 9/6/07, Roman Neumüller <[EMAIL PROTECTED]> wrote:
I'm a german web-designer living in Turkey.
Sometimes I use opensource software like gallery2 or WP to have
customers
have some
nice web albums or blog. The turkish translation files of such
opensource
software
usually use gettext and .po files for i18n and are always a bit behind
the
translation
status of other european languages.
I decided to work a bit on some of those tr.po files on my local linux
box
(opensuse 10.2 with apache 2.x mysql 5.x and php 5.2.0). But when I
started the
test phase in turkish I couldn't test because of strange errors.
I contacted the forum of gallery2 and after investigating the problem I
stumbled over an answer of bug #35050 at bugs.php.net:
http://bugs.php.net/bug.php?id=35050
and its status: WONT FIX
Now that's really great. It means that turkish hosting providers cannot
use php5 at all!
And as of the news on php.net php4 will not be supported or developed
any
further
after the end of 2007! Will Turks really have now to wait for a php6?
When will that come out?
That's seems to me to be a sort of discrimination of turkish language in
php5.
Is it technical so difficult to develop a patch for this bug?
Sincerely
Well, only 1 hour later than your email, there has been posted a patch
on the bug page that fixes it.
Tijnema
I had a look at the patch under http://www.topolis.lt/php/#35050 and saw it
did not work for my system (php5.2.0) I wrote to the author of the patch
and
got this answer:
Patch is written for PHP 5.2.5-dev. It should work in 6.0-dev and PHP
5.2.1 or later version. Any version later than 2006-12-05.
But he also said:
If you need workaround, just set LC_CTYPE locale to C. It also deals with
programming mistakes in PHP scripts.setlocale(LC_ALL,'tr_TR.UTF-8');
setlocale(LC_CTYPE, 'C');
and that seems to work - at least in case of my gallery2 under php5.2.0.
--- End Message ---
--- Begin Message ---
Hello,
Any opensource or PHP applicaiton is available for Photo upload tool?.
Thanks
Ramesh
--- End Message ---
--- Begin Message ---
[snip]
Any opensource or PHP applicaiton is available for Photo upload tool?.
[/snip]
Easy to do yourself....
http://us2.php.net/manual/en/features.file-upload.php
--- End Message ---