<?php
include("config.php");
if(isset($_POST['SUBMIT']))
{
   $name= stripslashes(htmlentities(trim($_POST['cname']),ENT_QUOTES));
	$to=  stripslashes(htmlentities(trim($_POST['cemail']),ENT_QUOTES));
	$subject= strip_tags(stripslashes(trim($_POST['csub'])));
	$mesg= stripslashes(htmlentities(trim($_POST['msg'])));
	$captchacode=$_POST['captchacode'];
	
	if(strtoupper($_SESSION['security_code']) != strtoupper($_POST['captchacode']))
  {
			
   $error1= "You have entered wrong captcha code.";
 }

 if($error1=='') 
 {
 

$header = "From: Spin Half <".$FromEmail.">\n";
$header .= "MIME-Version: 1.0\n"; 
$header .= "Content-Type: text/HTML; charset=ISO-8859-1\n";
$messages= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<table font-size="15px" width="600" cellspacing="0" cellpadding="5" align="center" style="border:4px solid #999999;">
  <tr>
  <td colspan="2"><a href="'.YOURSITE_URL.'" style="font-family:Times New Roman, Times, serif; color: #FFFFFF; font-weight: normal;"><img src="http://spinhalf.softdemo.info/images/logo.jpg" border="0" /></a></td></tr>
  
  
  <tr>
  
    <td height="26"><strong>Dear '.Admin.',</strong></td>
  </tr>
  <tr>
    <td colspan="2"10px" height="51" float="left">Here are the details of the user, which may have some queries or desiring to know about the site.</td>
	
	   
  </tr>
  
  <tr>
  <td width="105"  align="left" style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; color:#000000; font-weight:bold; float:left; margin-left:8px;">Name:</td>
  <td width="274"  align="left" style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; color:#000000;">'.$name.'</td>
  </tr>
  <tr>
  <td width="105"  align="left" style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; color:#000000; font-weight:bold; float:left; margin-left:9px;">Email:</td>
  <td width="274"  align="left" style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; color:#000000;"><a href="mailto:'.$to.'">'.$to.'</a></td>
  </tr>
  
  <tr>
  <td width="105"  align="left" style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; color:#000000; font-weight:bold; float:left; margin-left:12px;">Message:</td>
  <td width="274"  align="left" style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:12px; color:#000000;">'.nl2br(strip_tags(html_entity_decode($mesg))).'</td>
  </tr>

  <tr>
  <td>&nbsp;</td>
  <td>&nbsp;</td>
  </tr>
  
 <tr>
    <td><strong>Support Team
   </strong><br/><a href="'.YOURSITE_URL.'">Spin Half</a>
   </td>
   </tr>
   </table>
</body>
</html>';



// Enter your email address
//$to =AdminEmail();

$send_contact=mail($to,$subject,$messages,$header);

// Check, if message sent to your email 
// display message "We've recived your information"
	if($send_contact)
	{
	$_SESSION['succ_msg'] = "Thank you for contacting with us. One of our representatives will contact you soon.";
	header('location:contact.php');
	exit;
	
	}
	else
	{
    $err_msg = "Error.";
	
	
	
    }
	
	
	
	
}

 
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Spin Half</title>
<script type="text/javascript">
function trim(txt_value) 
{ return (txt_value.replace(/^\s|\s*$/g,"")); }
function isValidEmail( emailField )
{ 
   // var emailregex=/^[\w]+\+?\w*@[\w]+\.[\w.]+\w$/; 
   var emailregex=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-zA-Z]{2,6}(?:\.[a-zA-Z]{2})?)$/i;
    var match=emailField.match( emailregex ); 
    if ( !match ) 
    { 
       return false; 
    }
    else

    {
       return true; 
    }
}

function val_regform()
{
	if(document.regform.cname.value=='' || document.regform.cname.value=='Your Name (required)')
	{
		alert("Please enter first name.");
		document.regform.cname.focus();
		return false;
	}
	
	
	if(document.regform.cemail.value=='' || document.regform.cemail.value=='Your Email (required)')
	{
		alert("Please enter email address.");
		document.regform.cemail.focus();
		return false;
	}
	if(document.regform.cemail.value!='')
	{
		if(!isValidEmail(document.regform.cemail.value))
		{
			alert("Please enter valid email address.");
			document.regform.cemail.focus();
			return false;
		}
		
	}
	
	if(document.regform.captchacode.value=='')
	{
		alert("Please enter captcha code.");
		document.regform.captchacode.focus();
		return false;
	}
}
function twiterbox()
{
	document.getElementById("twiter_box").style.display="block";
}

function twiterboxhide()
{
	document.getElementById("twiter_box").style.display="none";
}

function rssbox()
{
	document.getElementById("rss_box").style.display="block";
}

function rssboxhide()
{
	document.getElementById("rss_box").style.display="none";
}
</script>
<link href="css/style_sheet.css" rel="stylesheet" type="text/css" />
<link href='http://fonts.googleapis.com/css?family=Ubuntu' rel='stylesheet' type='text/css'/>
<link href='http://fonts.googleapis.com/css?family=Ubuntu+Condensed' rel='stylesheet' type='text/css'/>
<link rel="shortcut icon" href="favicon.ico" />
<style type="text/css">
.twtr-widget
{
margin-right:-5px;
}
</style>
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="css/ie7.css" />
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="css/ie8.css" />
<![endif]-->
<!--[if IE 9]>
<link rel="stylesheet" type="text/css" href="css/ie9.css" />
<![endif]--> 
<!-- logo slide effect js -->
</head>
<body class="inner">
<div id="main_wrapper">
  <!--[if !IE]>main_wrapper div start here<![endif]-->
  <div id="inner">
    <!--[if !IE]>inner div start here<![endif]-->
    <?php
	include("includes/header.php");
	?>
    <div id="middle_container" style="min-height:700px;">
   
		    <div class="twtr-widget" id ="rss_box"  style="float:left; position:relative; width:975px; overflow:auto; background-color:#F1F1F1;">
			<?php            
            $news = simplexml_load_file('http://news.google.co.uk/news?pz=1&cf=all&ned=uk&hl=en&as_scoring=r&as_maxm=4&q=web+design&as_qdr=a&as_drrb=q&as_mind=6&as_minm=3&cf=all&as_maxd=5&output=rss');
            
            foreach($news->channel->item as $item) 
            {
				//echo $item->title . "<br>";	
				$description = str_replace('<a class="p"','<a class="p" target="_blank"',$item->description);
				echo $description ."<br>";
            }
            ?>
            </div>
    </div>

</div>
</div>
 <?php
	include("includes/footer.php");
	?>
</div>
<!--[if !IE]>main div end here<![endif]-->
</body>
</html>
