notdonemywebsite/make.php

42 lines
1.2 KiB
PHP
Raw Normal View History

2015-08-27 00:56:14 +01:00
<?php
$sname = $_POST['sname'];
$surl = $_POST['surl'];
$devname = $_POST['devname'];
$pcolour = $_POST['pcolour'];
$scolour = $_POST['scolour'];
$template = fopen("template/template.html", "r+"); // Change this if you have a custom template filename
$tempContents = fread($template, filesize("template/template.html")); //Read frin tge file
2015-08-27 00:56:14 +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 00:56:14 +01:00
$contents = str_replace($keywords, $replacement, $tempContents); // Replace the contents of the variable
2015-08-27 00:56:14 +01:00
fclose($template);
/* Debug stuff
2015-08-27 00:56:14 +01:00
echo "$sname ";
echo "$surl ";
echo "$devname ";
echo "$pcolour ";
echo "$scolour ";
*/
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
header('Content-Type: text/plain');
header('Content-Disposition: attachment; filename=index.html');
readfile("index.html"); // Make the client download the file as a .html :)
2015-08-27 00:56:14 +01:00
?>