?><?php 

require_once('includes/config/paths.php');
require_once(
TOP_PATH.'includes/config/sessions.php');
require_once(
TOP_PATH.'includes/config/connections.php'); 
require_once(
TOP_PATH.'includes/config/seo.php'); 
require_once(
TOP_PATH.'includes/config/settings.php');
require_once(
TOP_PATH.'includes/classes/wowimailer.php');
require_once(
TOP_PATH.'securimage/securimage.php');


if (isset(
$_POST['send'])) {
    
$hasError false;  
    
$comments sql_safe($_POST['comments']);
    
$firstName sql_safe($_POST['name']);
    
$email sql_safe($_POST['email']);
    
$phone sql_safe($_POST['phone']);
    
    
$img = new Securimage();
    
$valid $img->check($_POST['code']);

    if (!
$valid) {
        
$errMsg "<p>Please can you enter the correct security code</p>";
        
$hasError true;  
    }
    else if (empty(
$comments) || empty($firstName) || empty($email)) { 
         
$errMsg "<p>Please can you complete all the required fields fully and correctly</p>";    
         
$hasError true;   
    }
    else if (!
is_valid_email($email)) {
        
$errMsg "<p>Please can you enter a valid email</p>";
        
$hasError true;  
    }
    else {
        
        
# Email setup
        
$emailSubject Busniess_Name." contact form";
        
$emailTextBody "Name : ".$firstName."\n";
        
$emailTextBody .= "Email : ".$email."\n";
        
$emailTextBody .= "Phone : ".$phone."\n\n";
        
$emailTextBody .= "Message : \n\n".$comments;
        
        
$emailHTMLBody .= "Name : ".$firstName."<br />";
        
$emailHTMLBody .= "Email : ".$email."<br />";
        
$emailHTMLBody .= "Phone : ".$phone."<br /><br />";
        
$emailHTMLBody .= "Message : <br /><br />".nl2br($comments);

        
# Wowi mailer wrapper for swift mailer
        
$mailer = new wowiMailer('single');
        
$mailer->admin_fromemail $email// The email address that appears in the "from" field
        
$mailer->mail_toaddress SUPPORT_EMAIL// who the email is going to
        
$mailer->mail_subject $emailSubject// subject
        
$mailer->mail_html_body $emailHTMLBody// html email
        
$mailer->mail_txt_body $emailTextBody// text email
        
$mailer->send();
        
        
header("Location: contact-us.php?sent=yes"); // REDIRECT TO A PAGE THAT SAYS THANKS FOR YOUR COMMUNICATION
        
exit;
    }
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/main.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title><?php echo($page_title); ?> - Contact Our Games and Competitions Team</title>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php include(TOP_PATH.'includes/layout/public-header.php'); ?>
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
</head>

<body>
<div id="container"> 
    <div id="header">
        <div class="header-links">
            <?php require_once(TOP_PATH.'includes/layout/public-top-nav.php'); ?>
        </div>
    </div>
    <div id="inner-container">
        <div id="content">
            <div id="main">
                <div id="left"><?php include(TOP_PATH.'includes/layout/public-menu.php'); ?></div>
                <div id="content-area">
                    <!-- InstanceBeginEditable name="Content" -->
                
                <?php if ($_GET['sent']=='yes') { ?>
                <div id="success"><p>Thank you for contacting us</p></div>
                <p>&nbsp;</p>
                <?php ?>
                
                <?php if ($hasError) { ?>
                <div id="warning"><?php echo($errMsg); ?></div>
                <p>&nbsp;</p>
                <?php ?>
                
                <div id='cbox' style='margin-top: 20px;'>
                    <img class='c-icon1' src='pics/layout/design2/content-icon-5.jpg' alt='' />
                    <div class='c-top'></div> 
                    <div class='c-title'><h1>Contact Our Online Competitions Team</h1></div>
                    <div class='c-middle'>
                        <div class='c-inner-middle'>
                            <div class='c-text'>
                            <p>Got questions or feedback? We'd love to hear from you....</p>
                            <p>&nbsp;</p>
                            <h2>Questions or Feedback</h2>
                                <form action="contact-us.php" enctype="multipart/form-data" method="post">
                                    <fieldset>            
                                        <p><label><span>Name</span>
                                        <input name="name" value="<?php echo $_POST['name']; ?>" type="text" style='width: 250px;' /></label></p>
                                            
                                        <p><label><span>Email</span>
                                        <input name="email" value="<?php echo $_POST['email']; ?>" type="text" style='width: 250px;' /></label></p>
                                            
                                        <p><label><span>Phone</span>
                                        <input name="phone" value="<?php echo $_POST['phone']; ?>" type="text" style='width: 250px;' /></label></p>
                                        
                                        <p><label><span>Comments</span>
                                        <textarea name="comments" style='width: 250px; height: 100px;'><?php echo $_POST['comments']; ?></textarea></label></p>
                                        
                                        <p><label><span>Security</span>
                                        <img src='securimage/securimage_show.php?sid=<?php echo md5(uniqid(time())); ?>'></label></p>
                                        <p><label><span>&nbsp;</span> <input name='code' type='text' style='width: 250px;' /></label></p>
                                        
                                        <p><label><span>&nbsp;</span>
                                        <input name="send" value="send" type="submit" class="button"/></label></p>
                                        
                                        <p>&nbsp;</p>
                                        <p style="margin-top: 10px;"><label><span>&nbsp;</span>We always keep your information secure - see our <a href="privacy.php" title="View our 1-page policy">privacy policy</a></label></p>
                                        </fieldset>
                                    </form>
                                    <p>&nbsp;</p>
                                    <h2 style='font-weight: bold;'>Our contact details</h2>
                                    <br />
                                    <?php if ($domain->getLocation() == 'uk') { ?>
                                    <p>Phone: +44 207 193 2144</p>
                                    <br />
                                    <?php ?>
                                    
                                    <?php if ($domain->getLocation() == 'usa') { ?>
                                    <p>Phone: +1 954 821 3293</p>
                                    <p>For other countries call +44 207 193 2144 </p>
                                    <br />
                                    <?php ?>
                                    
                                    <?php if ($domain->getLocation() == 'aus') { ?>
                                    <p>Phone: +61 2 8003 7020</p>
                                    <p>For other countries call +44 207 193 2144 </p>
                                    <br />
                                    <?php ?>
                                    
                                    <h3>Registered Head Office :</h3>
                                    <?php if ($domain->getLocation() == 'uk') { ?>
                                    <p>UK</p>
                                    <p>1 Berkeley Street,</p> 
                                    <p>LONDON,</p> 
                                    <p>WIJ 8DJ</p> 
                                    <p>UNITED KINGDOM</p>
                                    <br />
                                    <?php ?>
                                    <?php if ($domain->getLocation() == 'usa') { ?>
                                    <p>USA</p>
                                    <p>429 Lenox Avenue,</p> 
                                    <p>Miami,</p> 
                                    <p>Florida 33139</p> 
                                    <p>United States of America</p>
                                    <br />
                                    <?php ?>
                                    <?php if ($domain->getLocation() == 'aus') { ?>
                                    <p>AUS</p>
                                    <p>Level 29 Chifley Square,</p> 
                                    <p>Sydney,</p> 
                                    <p>NSW 2000</p> 
                                    <p>Australia</p>
                                    <br />
                                    <?php ?>    
                            </div>
                        </div>
                    </div>
                    <div class='c-bottom'></div>                    
                </div>
                
                <div class='clear'><p>&nbsp;</p></div>
                            
        <!-- InstanceEndEditable -->
                </div>
                <div class="clear"></div>
            </div>
        </div>
    </div>
    <div id="footer"><?php include(TOP_PATH.'includes/layout/public-footer.php'); ?></div>
</div>
</body>
<!-- InstanceEnd --></html>