PHP string variable and string
Posted: Fri Apr 27, 2007 2:28 am
hi *,
i have a problems in string. i want to exec a shell command from php. when i want to change password of user the shell command is
if password is x'>
./pwdsync.sh 'local001' 'x'\''>'
if password is '
./pwdsync.sh 'local001' \'
and code in php
$txtpwd = str_replace("'","'\'\\\'\''",$txtpwd);
exec('/opt/ua/sh/pwdsync.sh \'' . $mnid . '\' \'' . $txtpwd . '\'');
but i can't do it successful. if i use
exec('/opt/ua/sh/pwdsync.sh \'' . $mnid . '\' \'' . '\'\\\'\'' . '\'');
the password change to ' successfully. and when i echo txtpwd, it's not match with the string i assigned.
plz, help me.
i have a problems in string. i want to exec a shell command from php. when i want to change password of user the shell command is
if password is x'>
./pwdsync.sh 'local001' 'x'\''>'
if password is '
./pwdsync.sh 'local001' \'
and code in php
$txtpwd = str_replace("'","'\'\\\'\''",$txtpwd);
exec('/opt/ua/sh/pwdsync.sh \'' . $mnid . '\' \'' . $txtpwd . '\'');
but i can't do it successful. if i use
exec('/opt/ua/sh/pwdsync.sh \'' . $mnid . '\' \'' . '\'\\\'\'' . '\'');
the password change to ' successfully. and when i echo txtpwd, it's not match with the string i assigned.
plz, help me.