I have a database that records incidents of network abuse and allows me to send different warnings to customers based on the type of network abuse that has occured. The warning is displayed in a form first to allow any changes to be made to it before being sent and includes some personalised info such as the IP address of the offending machine.
If I store the message body in a variable within the script I have no problems but I am trying to keep all the warnings in their own files and as a result the variable name seems to appear instead of its value in the form 🙁
The code I am using is as follows:
//Include hosts details
include('scripts/define_host_details.php');
//Open the correct warning file and load the contents into a variable
$filename = "warnings/omr1"; //kept simple for this query
$fd = fopen("$filename", "r");
$contents = fread($fd, filesize($filename));
fclose ($fd);
//Display HTML form
echo "
...
<textarea class='courier' name='msg' cols='72' rows='25'>$contents</textarea>
...
";
This gives the output as:
Dear Sir.
It has been brought to our attention that the machine running on:
$ipAddr
is vulnerable to unauthorised third party relaying.
but should display the actual IP address. I tried doing this with the contents of the warning mail stored in a mySQL db but got the same results. I have a feeling I'm missing something very obvious 🙁 Could someone lindly enlighten me?