forms - php exec change password in file -
i'm trying make simple input form change password in config file. believe pretty close after trying hour exec line below correct believe need help.
# password in conf file # $password = '12345'; <?php if(isset($_request['new_pass'])){ exec('sed -i '.escapeshellarg('s/\$password=.*/\$password=\'".$_request['new_pass'].'\'/g')." include/conf.php"); echo 'password changed'; } ?> <form method="get" action="<?php echo $_server['php_self']; ?>"> <input type="text" name="new_pass" maxlength="59"> <input type="submit" name="submit" value="submit" /> </form>
i'm ' quotations tripping me up.
when in doubt, @ syntax highlighting.
exec('sed -i ' . escapeshellarg('s/\$password=.*/\$password=\''.$_request['new_pass'].'\'/g')." include/conf.php");
Comments
Post a Comment