Hey, I know how to use ereg and preg and str replace but now I want to just replace an entire line with a certain pattern in it:
while($CAread=fgets($CAhandle, 100000))
{
if(ereg("input_password",$CAread)) //replace password
{
//put input_password='$password' here
}
else if(ereg("output_password",$CAread)) //replace password
{
//put output_password='$password' here
}
}
Like if a line has input_password or output_password, I just want to replace the line completely regardless of what was after input_password or output_password on the original line.
By the ways the form is:
input_password = secret
output_password = secret
I want to replace the secrets with my password(it won't neccesarily be secret) and at the end after the actions are done I want it to revert to:
#input_password=
#output_password=
basically blanking out the password to prevent hacking. I'm tried ereg and preg pattern matches, but it doesn't seem to work right.
Thanks.