2015-08-27 00:56:14 +01:00
|
|
|
<?php
|
2015-09-06 16:45:57 +01:00
|
|
|
|
|
|
|
header('Content-Type: text/plain');
|
|
|
|
header('Content-Disposition: attachment; filename=index.html');
|
|
|
|
|
2015-08-27 00:56:14 +01:00
|
|
|
$sname = $_POST['sname'];
|
|
|
|
$surl = $_POST['surl'];
|
|
|
|
$devname = $_POST['devname'];
|
|
|
|
$pcolour = $_POST['pcolour'];
|
|
|
|
$scolour = $_POST['scolour'];
|
2015-08-28 00:58:14 +01:00
|
|
|
$template = $_POST['template'];
|
2015-08-27 00:56:14 +01:00
|
|
|
|
2015-08-28 00:58:14 +01:00
|
|
|
$tFile = "template/template.html";
|
|
|
|
|
|
|
|
if($template == "The Original"){
|
|
|
|
$tFile = "template/template.html";
|
|
|
|
}
|
|
|
|
if($template == "Forked"){
|
|
|
|
$tFile = "template/template2.html";
|
|
|
|
}
|
|
|
|
|
|
|
|
$template = fopen($tFile, "r+"); // Change this if you have a custom template filename
|
|
|
|
$tempContents = fread($template, filesize($tFile));
|
2015-08-27 00:56:14 +01:00
|
|
|
|
2015-08-27 01:27:52 +01:00
|
|
|
// Keywords for replacement - see README
|
2015-08-27 00:56:14 +01:00
|
|
|
$keywords = array("rep_PCOLOUR", "rep_SCOLOUR", "rep_SNAME", "rep_URL", "rep_DEVNAME");
|
|
|
|
$replacement = array($pcolour, $scolour, $sname, $surl, $devname);
|
2015-08-27 01:27:52 +01:00
|
|
|
// ---
|
2015-08-27 00:56:14 +01:00
|
|
|
|
2015-08-27 01:27:52 +01:00
|
|
|
$contents = str_replace($keywords, $replacement, $tempContents); // Replace the contents of the variable
|
2015-08-27 00:56:14 +01:00
|
|
|
|
|
|
|
fclose($template);
|
|
|
|
|
2015-08-27 01:27:52 +01:00
|
|
|
/* Debug stuff
|
2015-08-27 00:56:14 +01:00
|
|
|
echo "$sname ";
|
|
|
|
echo "$surl ";
|
|
|
|
echo "$devname ";
|
|
|
|
echo "$pcolour ";
|
|
|
|
echo "$scolour ";
|
|
|
|
*/
|
|
|
|
|
2015-08-27 01:27:52 +01:00
|
|
|
echo $contents; // Echo out the generated page
|
|
|
|
|
|
|
|
/* Not actually needed but may need to reuse this code later on
|
|
|
|
*
|
|
|
|
* $indexfile = fopen("index.html", "w");
|
|
|
|
* fwrite($indexfile, NULL);
|
|
|
|
* fclose($indexfile);
|
|
|
|
*
|
|
|
|
*/
|
2015-08-27 00:56:14 +01:00
|
|
|
|
2015-08-27 04:39:44 +01:00
|
|
|
// Make the client download the file as a .html :)
|
2015-08-27 00:56:14 +01:00
|
|
|
|
|
|
|
?>
|