[PHP] mail body not decoded by base64_decode

2009-05-28 Thread vuthecuong

Hi all
I'm using below function to send Japanese mail, mail clients such as outlook
etc displayed Japanese text withou problems but if I viewed JP mail via
web-based mail such as Gmail, the JP subject is normally displayed, however
the JP body still base64 encoded strings, it still was not decoded yet.
Could anyone tell me solution to solve this?
===
private static function _sendPc( $from, $to, $subject, $body, $contentType,
$charSet=shift_jis, $header=, $parameter=){
Debugger::snap();
//make header
$headers = From: $from\n;
$headers .= MIME-Version: 1.0\n;
$headers .= Content-type: $contentType; charset=ISO-2022-JP\n;
//$headers .= Content-type: $contentType; charset=SHIFT_JIS\n;
//$headers .= Content-Transfer-Encoding: base64;
$headers .= Content-Transfer-Encoding: quoted-printable;


// add header to mail
if( strlen( $header )  0 ){
$headers .= \n;
$headers .= $header;
}

//make parameter
$parameters = $parameter;

//make subject
$subject = '=?ISO-2022-JP?B?'.base64_encode(mb_convert_encoding($subject,
'ISO-2022-JP', 'AUTO' )).'?=';
//$subject = '=?SHIFT_JIS?B?'.base64_encode($subject).'?=';
//$body = base64_encode($body);
$body = mb_convert_encoding( $body, 'ISO-2022-JP', AUTO);

// a,b...@mail.com こんなEMAILアドレスがたまにあるための回避策
$pos1 = strpos($to, ,);
$pos2 = strpos($to,);
if( $pos1 !== FALSE  $pos2 === FALSE ){
$to =  . $to .;
}

if( $parameters != null  strlen( $parameters )  0 )
mail( $to, $subject, $body, $headers, $parameters );
else
mail( $to, $subject, $body, $headers,-f . $from );

Debugger::debug( sended );
return true;
}

Thanks and regards,
-- 
View this message in context: 
http://www.nabble.com/mail-body-not-decoded-by-base64_decode-tp23773646p23773646.html
Sent from the PHP - General mailing list archive at Nabble.com.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] apache user cannot execute useradd via sudo :(

2009-05-22 Thread vuthecuong


Hi all
My server is centos 5.1 with php 5.1.6.
In my app I want apache to add user through sudo.

My sudoers file is:
%apache ALL=(ALL) NOPASSWD: ALL
%tony ALL=(ALL) NOPASSWD: ALL

My test.php í:
?php
$username=hixhix;
system(/usr/bin/sudo /usr/sbin/useradd -s /sbin/nologin -M
$username,$returnvalue);
echo return value: $returnvalue;
However, user 'hixhix' not created by apache at all, it always returned 1.
how can I make my apache tu add user using sudo?
Please help me. I need your help.
Thanks and regards.
-- 
View this message in context: 
http://www.nabble.com/apache-user-cannot-execute-useradd-via-sudo-%3A%28-tp23668764p23668764.html
Sent from the PHP - General mailing list archive at Nabble.com.


Re: [PHP] apache user cannot execute useradd via sudo :(

2009-05-22 Thread vuthecuong



Michael A. Peters wrote:
 
 vuthecuong wrote:
 
 Hi all
 My server is centos 5.1 with php 5.1.6.
 In my app I want apache to add user through sudo.
 
 My sudoers file is:
 %apache ALL=(ALL) NOPASSWD: ALL
 %tony ALL=(ALL) NOPASSWD: ALL
 
 My test.php í:
 ?php
 $username=hixhix;
 system(/usr/bin/sudo /usr/sbin/useradd -s /sbin/nologin -M
 $username,$returnvalue);
 echo return value: $returnvalue;
 However, user 'hixhix' not created by apache at all, it always returned
 1.
 how can I make my apache tu add user using sudo?
 Please help me. I need your help.
 Thanks and regards.
 
 That's not a very secure sudoers file.
 
 But you probably don't want to use sudo to this anyway.
 
 What you probably should do is write a shell script (IE w/ perl) that is 
 suid root and executable by apache that adds the user to your system.
 
 I don't know what your sudo error is, but have you looked at your sudo 
 log file?
 
 Make damn sure you validate the $username variable whatever solution you 
 end up using.
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
Yeah I know my script don't care at all about security. I'm keeping it fot
the sake of simplicity.
After making it 'work', I will take a look seriously about security.
So, why it not create user for me?
thanks and regards
-- 
View this message in context: 
http://www.nabble.com/apache-user-cannot-execute-useradd-via-sudo-%3A%28-tp23668764p23680766.html
Sent from the PHP - General mailing list archive at Nabble.com.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] imagick raises error

2008-12-19 Thread vuthecuong

Hi,
Currently I'm reading below page:
http://www.imagemagick.org/Usage/api/#php
When I tried imagick example of it, php raised error about function :
Imagick::readimage() .
Fatal error: Non-static method Imagick::readimage() cannot be called
statically in /usr/local/www/apache22/data/php/im/imagick_hello.php on line
2

I don't know what is the cause. How can I solve this?
I'm running latest IM 6.4.7 with imagick 2.2.1, php 5.2.8 in Freebsd 7.0,
all built from ports.
Thanks and regards,
below is whole example of above site:

?php
$handle = imagick_readimage( getcwd() . image.jpg );
if ( imagick_iserror( $handle ) ) {
$reason = imagick_failedreason( $handle ) ;
$description = imagick_faileddescription( $handle ) ;

print Handle Read failed!BR\n;
print Reason: $reasonBR\n;
print Description: $descriptionBR\n;
exit ;
}
header( Content-type:  . imagick_getmimetype( $handle ) );
print imagick_image2blob( $handle );
? 
-- 
View this message in context: 
http://www.nabble.com/imagick-raises-error-tp21088873p21088873.html
Sent from the PHP - General mailing list archive at Nabble.com.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Newbie: can I store flash file into Mysql DB

2008-10-29 Thread vuthecuong

technically can I store flash file into Mysql DB using PHP?
what point should I pay attention for that?
Thank you
-- 
View this message in context: 
http://www.nabble.com/Newbie%3A-can-I-store-flash-file-into-Mysql-DB-tp20224150p20224150.html
Sent from the PHP - General mailing list archive at Nabble.com.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Newbie: can I store flash file into Mysql DB

2008-10-29 Thread vuthecuong



Stut wrote:
 
 On 29 Oct 2008, at 10:20, vuthecuong wrote:
 technically can I store flash file into Mysql DB using PHP?
 
 Yes.
 
 what point should I pay attention for that?
 
 The blob field type.
 
 But I would recommend against it. Why not store the files on disk and  
 only store the filenames in the DB?
 
 -Stut
 
 -- 
 http://stut.net/
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
Thanks for fast reply. Could you tell me the reason against it?
regards,

-- 
View this message in context: 
http://www.nabble.com/Newbie%3A-can-I-store-flash-file-into-Mysql-DB-tp20224150p20224340.html
Sent from the PHP - General mailing list archive at Nabble.com.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Newbie: can I store flash file into Mysql DB

2008-10-29 Thread vuthecuong




Stut wrote:
 
 On 29 Oct 2008, at 10:32, vuthecuong wrote:

 Stut wrote:

 On 29 Oct 2008, at 10:20, vuthecuong wrote:
 technically can I store flash file into Mysql DB using PHP?

 Yes.

 what point should I pay attention for that?

 The blob field type.

 But I would recommend against it. Why not store the files on disk and
 only store the filenames in the DB?

 Thanks for fast reply. Could you tell me the reason against it?
 
 In my experience it's a lot harder to manage than files. DB backups  
 and restores start taking a long time - not good when disaster strikes  
 and you need to get back up and running quickly. Scripts that serve  
 blobs can take up a lot of memory since they need to load the entire  
 blob before outputting it to the browser whereas files can be streamed.
 
 Google for something like store files in mysql and you'll find a lot  
 of opinion on the advantages and disadvantages. If the files are small  
 enough and there aren't many then it can work well, but personally I'd  
 never do it again after some nasty experiences a few years back.
 
 -Stut
 
 -- 
 http://stut.net/
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
THanks Stut, I learned from you a lot. I'll take that into account.
regards
-- 
View this message in context: 
http://www.nabble.com/Newbie%3A-can-I-store-flash-file-into-Mysql-DB-tp20224150p20224881.html
Sent from the PHP - General mailing list archive at Nabble.com.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] create/write to psd file

2008-10-27 Thread vuthecuong

Hi all
Is there a way to create/read/write to psd file? (photoshop format)

I would like to hear opinion form you:
Do you recommend gd2 or imageMagick to perform this task? and why
thanks in advanced 
-- 
View this message in context: 
http://www.nabble.com/create-write-to-psd-file-tp20182477p20182477.html
Sent from the PHP - General mailing list archive at Nabble.com.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] create/write to psd file

2008-10-27 Thread vuthecuong



Ashley Sheridan-3 wrote:
 
 Off the top of my head, I don't think this is possible. A quick Google
 yields nothing either. I'm assuming it has to be a PSD for the layers?
 
Sure. I woudd like to read PSd files with multiple layes, and of course when
I write to it,
I should keep it's layers state also.
Is there any point to resource in some where please?
please help me. I need your help.
Thanks in advanced.

-- 
View this message in context: 
http://www.nabble.com/create-write-to-psd-file-tp20182477p20182544.html
Sent from the PHP - General mailing list archive at Nabble.com.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] create/write to psd file

2008-10-27 Thread vuthecuong



Ashley Sheridan-3 wrote:
 
 On Sun, 2008-10-26 at 23:45 -0700, vuthecuong wrote:
 
 
 Ashley Sheridan-3 wrote:
  
  Off the top of my head, I don't think this is possible. A quick Google
  yields nothing either. I'm assuming it has to be a PSD for the layers?
  
 Sure. I woudd like to read PSd files with multiple layes, and of course
 when
 I write to it,
 I should keep it's layers state also.
 Is there any point to resource in some where please?
 please help me. I need your help.
 Thanks in advanced.
 
 -- 
 View this message in context:
 http://www.nabble.com/create-write-to-psd-file-tp20182477p20182544.html
 Sent from the PHP - General mailing list archive at Nabble.com.
 
 
 You want me to point you in the direction of a resource, even though
 I've said I couldn't find one...?
 
 The closest I can find is a class which will read a PSD in, although I'm
 betting it'll only be a very, very old PSD.
 
 It might be possible to do what you need by using the Gimp, but I'm just
 not sure how much is possible with it over the command line.
 
 
 Ash
 www.ashleysheridan.co.uk
 
 
 -- 
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
Thank you for useful info.
Anyway I will check it out.
regards,

-- 
View this message in context: 
http://www.nabble.com/create-write-to-psd-file-tp20182477p20182592.html
Sent from the PHP - General mailing list archive at Nabble.com.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] xdebug with Quanta

2007-04-07 Thread vuthecuong

   Does anyone use xdebug with QUanta?
Could you give a tutorial to use it?
Or give me a website link about this?
Tnx

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php