<?php
require('include/header.php');
$today = date("2018-03-04");
//read out the faqs
?>

<script>
	function goBack()
	{
		window.history.back()
	}
</script>


<table class="table" width="640">
	<tr class="table_header">
		<th class="table_header" colspan="2">
		<p align="left">Add a link</th>
	</tr>
	<tr>
		<td class="cell_content">
<?php
//read out the faqs


if ($_POST[website_name] == "") {
	echo "<br><center><font color='#FF0000'>You have to select a website name.</font><br><br>";
	?><input type="button" value="<-- Back" onclick="goBack()" /></center><br><?php

} elseif ($_POST[website_url] == "") {
	echo "<br><center><font color='#FF0000'>You have to fill in a website adress.</font><br><br>";
	?><input type="button" value="<-- Back" onclick="goBack()" /></center><br><?php

} elseif ($_POST[email] == "") {
	echo "<br><center><font color='#FF0000'>You have to fill in a email adress.</font><br><br>";
	?><input type="button" value="<-- Back" onclick="goBack()" /></center><br><?php



} else {


$url = $_POST[website_url];
$parse = parse_url($url);
$website_domain = $parse['host'];


	$sql="INSERT INTO ".$prefix."websites (website_name, website_url, website_description, email, date, website_domain)
	 VALUES
	 ('$_POST[website_name]','$_POST[website_url]','$_POST[website_description]','$_POST[email]','$today','$website_domain')";
 
	if (!mysql_query($sql))
	   {
	   die('Error: ' . mysql_error());
	   }
	 echo "Congratulation! Your link has been added successfully. Target-Hits4u
.";

}

?>
		</span></td>
	</tr>
	</table>
<?php
//end read out the faqs
 

require('include/footer.php');

 ?>
