<?php
if(count($_POST) > 0)
{
$stringVal = '';
$directory = "saved/";
$filename = $_POST['title']."_".date('Y-m-d').".html";
$filePath = $directory.$filename;
if(!file_exists($filename))
{
$stringVal = '<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>A Web Quest For '.stripslashes(trim($_POST['name'])).'</title>
<meta name="description" content="Just choose the problem type and print answers and math worksheets in seconds.  Includes: Addition, Subtraction, Multiplication, Division, Place Value, Rounding, Order of Operations, Greater/Less Than, Mixed Problems" />
</head>
<body bgcolor="#ffffff">
<table width="600" align="center" border="0">
<tbody>
<tr>
<td height="836">
<table width="100%" border="0">
<tbody>
<tr>
<td>
<table width="100%" border="0" cellpadding="4">
<tbody>
<tr>
<td width="63%">Name: __________________________</td>
<td width="37%">Subject: <u>'.stripslashes(trim($_POST['subject'])).'</u></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="4">
<tbody>
<tr>
<td width="63%">Teacher Name: <u>'.stripslashes(trim($_POST['name'])).'</u></td>
<td width="37%">Date: ___________________</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>
<p>&nbsp;</p>
<p align="center"><b><font size="5">'.stripslashes(trim($_POST['title'])).'</font></b></p>
<p align="center">&nbsp;</p>
</td>
</tr>
<tr>
<td height="2">
<div align="center">
<img src="'.stripslashes(trim($_POST['pic'])).'" border="0">
</div>
</td>
</tr>
<tr>
<td height="2">
<table width="100%" border="0" cellpadding="4">
<tbody>
<tr>
<td width="27%"><b><font size="3">Introduction:</font></b></td>
<td width="73%">&nbsp;</td>
</tr>
<tr>
<td width="27%">&nbsp;</td>
<td width="73%">
'.stripslashes(trim(nl2br($_POST['intro']))).'
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="4">
<tbody>
<tr>
<td width="27%"><font size="3"><b>Task:</b></font></td>
<td width="73%">&nbsp;</td>
</tr>
<tr>
<td width="27%">&nbsp;</td>
<td width="73%">
'.stripslashes(trim(nl2br($_POST['task']))).'
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="4">
<tbody>
<tr>
<td width="27%"><b>Process:</b></td>
<td width="73%">&nbsp;</td>
</tr>
<tr>
<td width="27%">&nbsp;</td>
<td width="73%">
'.stripslashes(trim(nl2br($_POST['process']))).'
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="4">
<tbody>
<tr>
<td width="27%"><b>Resources:</b></td>
<td width="73%">&nbsp;</td>
</tr>
<tr>
<td width="27%">&nbsp;</td>
<td width="73%">
'.stripslashes(trim(nl2br($_POST['resource']))).'
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="4">
<tbody>
<tr>
<td width="27%"><b>Evaluation:</b></td>
<td width="73%">&nbsp;</td>
</tr>
<tr>
<td width="27%">&nbsp;</td>
<td width="73%">
'.stripslashes(trim(nl2br($_POST['eval']))).'
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="4">
<tbody>
<tr>
<td width="27%"><b>Conclusion:</b></td>
<td width="73%">&nbsp;</td>
</tr>
<tr>
<td width="27%">&nbsp;</td>
<td width="73%">
'.stripslashes(trim(nl2br($_POST['conclusion']))).'
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>
<hr>
<p align="center"><b><font size="2">Powered by- 
TeAch-nology.com- 
The Web Portal For Educators (www.teach-nology.com)</font></b></p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</body>
</html>';
if (!$handle = fopen($filePath, 'w')) 
{
echo "Cannot open file ($filename)";
exit;
}
if (fwrite($handle, $stringVal) === FALSE) 
{
echo "Cannot write to file ($filename)";
exit;
}
fclose($handle);
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>A Web Quest For <?php echo(stripslashes(trim($_POST['name'])));?></title>
<meta NAME="ROBOTS" CONTENT="NOINDEX">
</head>
<body bgcolor="#ffffff">
<table width="600" align="center" border="0">
<tbody>
<tr>
<td height="836">
<table width="100%" border="0">
<tbody>
<tr>
<td>
<table width="100%" border="0" cellpadding="4">
<tbody>
<tr>
<td width="63%">Name: __________________________</td>
<td width="37%">Subject: <u><?php echo(stripslashes(trim($_POST['subject'])));?></u></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="4">
<tbody>
<tr>
<td width="63%">Teacher Name: <u><?php echo(stripslashes(trim($_POST['name'])));?></u></td>
<td width="37%">Date: ___________________</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>
<p>&nbsp;</p>
<p align="center"><b><font size="5"><?php echo(stripslashes(trim($_POST['title'])));?></font></b></p>
<p align="center">&nbsp;</p>
</td>
</tr>
<tr>
<td height="2">
<div align="center">
<img src="<?php echo(stripslashes(trim($_POST['pic'])));?>" border = "0">
</div>
</td>
</tr>
<tr>
<td height="2">
<table width="100%" border="0" cellpadding="4">
<tbody>
<tr>
<td width="27%"><b><font size="3">Introduction:</font></b></td>
<td width="73%">&nbsp;</td>
</tr>
<tr>
<td width="27%">&nbsp;</td>
<td width="73%">
<?php echo(stripslashes(trim(nl2br($_POST['intro']))));?>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="4">
<tbody>
<tr>
<td width="27%"><font size="3"><b>Task:</b></font></td>
<td width="73%">&nbsp;</td>
</tr>
<tr>
<td width="27%">&nbsp;</td>
<td width="73%">
<?php echo(stripslashes(trim(nl2br($_POST['task']))));?>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="4">
<tbody>
<tr>
<td width="27%"><b>Process:</b></td>
<td width="73%">&nbsp;</td>
</tr>
<tr>
<td width="27%">&nbsp;</td>
<td width="73%">
<?php echo(stripslashes(trim(nl2br($_POST['process']))));?>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="4">
<tbody>
<tr>
<td width="27%"><b>Resources:</b></td>
<td width="73%">&nbsp;</td>
</tr>
<tr>
<td width="27%">&nbsp;</td>
<td width="73%">
<?php echo(stripslashes(trim(nl2br($_POST['resource']))));?>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="4">
<tbody>
<tr>
<td width="27%"><b>Evaluation:</b></td>
<td width="73%">&nbsp;</td>
</tr>
<tr>
<td width="27%">&nbsp;</td>
<td width="73%">
<?php echo(stripslashes(trim(nl2br($_POST['eval']))));?>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="4">
<tbody>
<tr>
<td width="27%"><b>Conclusion:</b></td>
<td width="73%">&nbsp;</td>
</tr>
<tr>
<td width="27%">&nbsp;</td>
<td width="73%">
<?php echo(stripslashes(trim(nl2br($_POST['conclusion']))));?>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td>
<hr>
<p align="center"><b><font size="2">Powered by- 
TeAch-nology.com- 
The Web Portal For Educators (www.teach-nology.com)</font></b></p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</body>
</html>
