-
Notifications
You must be signed in to change notification settings - Fork 1
/
errorReport.php
27 lines (23 loc) · 806 Bytes
/
errorReport.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<html>
<body>
<?php
function validate_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
};
# Derive the content of issue report form.
$issueContent = validate_input($_POST["issue"]).PHP_EOL;
$address = validate_input($_POST["address"]).PHP_EOL;
$addressNum = explode(", ", $address)[0].PHP_EOL;
$addressSub = explode(", ", $address)[1].PHP_EOL;
# write the issue report content to a txt file on server
$issueDataFile = fopen('errorReportData.txt', "a+");
fwrite($issueDataFile, $issueContent);
fwrite($issueDataFile, $addressNum);
fwrite($issueDataFile, $addressSub);
fclose($issueDataFile);
?>
</body>
</html>