PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
// create a variable for the log data
$log_data = "\r\n" . $_GET["name"]."\r\n" . $_GET["comment"];
// change the fwrite() call to use the $log_data variable
if (fwrite($handle, $log_data) === FALSE){
die("Error while writing.");
}
Now all you have to do is set $log_data to whatever you want written to the file and voila.
Thanks! This is taking it one step further. If I wanted to have a file with valid serials in (serials.txt), then each line is compared to $serial until there is a match (otherwise 'echo "Invalid";') then delete that from the list. How could I do that?
Put all of your serial numbers into a textfile and separate them with commas, for example, then create an array from them using code something like this (untested):
<?php
// I gave the paid guy 79EU-IDJH-J09F-UAWE-HRF9 and the other guy 43T7-9H2O-348Y-UVH2-80VN
$serial = $_GET["serial"];
$data = file_get_contents("keys.php");
$elements = explode(',', $data);
if(in_array($serial,$elements)){
echo "Well done!";
}else{
echo "You stuffed it...";
}
?>