I got this little problem here with my website. I want to replace a string in one of my html file. I did a php file that find the specific string and replace it but it become useless become the string to change is not the same after...
In my HTML file, I'm able to change 7NT0j5dB2QMyWv96nXIDgaR4PJ for whatever random string the PHP file generate
<tr>
<td>Secret Key</td>
<td><strong style="color:#b94a48;">7NT0j5dB2QMyWv96nXIDgaR4PJ</strong></td>
</tr>
But in my PHP file the string to replace still 7NT0j5dB2QMyWv96nXIDgaR4PJ not the new one...
There is my php code :
$contents = file_get_contents ("step-second-test.php");
$contents = str_replace(array("7NT0j5dB2QMyWv96nXIDgaR4PJ"), generateRandomString($length = 26), $contents);
file_put_contents("step-second-test.php", $contents);
generateRandomString, which you didn't includefile_put_contents("step-second-test.php", $contents);changes the file, meaning it is basically useless after the first run.