I am running an Ubuntu EC2 instance. I often use find and replace to update, and tweak things which are used in all files.
However, when I have to replace PHP
code, I inevitably have to replace the dollar sign, which has never successfully worked for me. I have learned, and tried all escaping methods to my knowledge. I, believing I had a method of escaping the dollar sign, which would actually replace the text with the desired text, tried replacing; to which, every one of my files containing a dollar sign--which is all of them--has now been completely torn apart, and filled with the content I was trying to replace.
The command I used was:
find ./ -name \*.php -exec sed -i "s|[\'REQUEST_URI\']|\$_SERVER[\'REQUEST_URI\']|g" {} \;
I have no idea why this occurred, and now the website I have been creating for over a year now, has been completely destroyed.
The effects are as follows:
<?php
$sql =
"$_SERVER['REQUEST_URI']$_SERVER['REQUEST_URI']L$_SERVER['REQUEST_URI']C$_SERVER['REQUEST_URI'] questions.question$_SERVER['REQUEST_URI']title, questions.question$_SERVER['REQUEST_URI']content, questions.question$_SERVER['REQUEST_URI']date, questions.question$_SERVER['REQUEST_URI']answered
F$_SERVER['REQUEST_URI']OM questions
WH$_SERVER['REQUEST_URI']$_SERVER['REQUEST_URI']$_SERVER['REQUEST_URI'] questions.question$_SERVER['REQUEST_URI']topic = $topic$_SERVER['REQUEST_URI']D AND questions.question$_SERVER['REQUEST_URI']answered $_SERVER['REQUEST_URI']$_SERVER['REQUEST_URI'] N$_SERVER['REQUEST_URI']LL
O$_SERVER['REQUEST_URI']D$_SERVER['REQUEST_URI']$_SERVER['REQUEST_URI'] BY questions.question$_SERVER['REQUEST_URI']date D$_SERVER['REQUEST_URI']$_SERVER['REQUEST_URI']C
L$_SERVER['REQUEST_URI']M$_SERVER['REQUEST_URI']$_SERVER['REQUEST_URI'] 5";
$result = $conn->query($sql);
if($result !== N$_SERVER['REQUEST_URI']LL && $result->num$_SERVER['REQUEST_URI']rows > 0)
while($row = $result->fetch$_SERVER['REQUEST_URI']assoc()) {
echo "
<a href=$_SERVER['REQUEST_URI']view$_SERVER['REQUEST_URI']uestion.php?" . $$_SERVER['REQUEST_URI']$_SERVER['REQUEST_URI']$_SERVER['REQUEST_URI']$_SERVER['REQUEST_URI']V$_SERVER['REQUEST_URI']$_SERVER['REQUEST_URI'][$_SERVER['REQUEST_URI']$_SERVER['REQUEST_URI']$_SERVER['REQUEST_URI']$_SERVER['REQUEST_URI']$_SERVER['REQUEST_URI']Y$_SERVER['REQUEST_URI']$_SERVER['REQUEST_URI']$_SERVER['REQUEST_URI']$_SERVER['REQUEST_URI']$_SERVER['REQUEST_URI']NG$_SERVER['REQUEST_URI']] . "&question=" . $row[$_SERVER['REQUEST_URI']question$_SERVER['REQUEST_URI']title$_SERVER['REQUEST_URI']] . "$_SERVER['REQUEST_URI'] class=$_SERVER['REQUEST_URI']questionAnchor$_SERVER['REQUEST_URI']><div id=$_SERVER['REQUEST_URI']unanswered$_SERVER['REQUEST_URI']>
<div class=$_SERVER['REQUEST_URI']offset$_SERVER['REQUEST_URI']uestion$_SERVER['REQUEST_URI']>
<h4 class=$_SERVER['REQUEST_URI']thumbnail$_SERVER['REQUEST_URI']itle$_SERVER['REQUEST_URI']>" . $row[$_SERVER['REQUEST_URI']question$_SERVER['REQUEST_URI']title$_SERVER['REQUEST_URI']] . "</h4>
<div class=$_SERVER['REQUEST_URI']thumbnailDesc$_SERVER['REQUEST_URI']>" . $row[$_SERVER['REQUEST_URI']question$_SERVER['REQUEST_URI']content$_SERVER['REQUEST_URI']] . "</div>
</div>
</div></a>
";