<table id="content" width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr> 
                      <td> 
    <?php require_once 'fprotect.php'; ?>
           
    <?php 
	if  (isset($_POST['submit'])) {
    $name=safe($name);
    $toname=safe($toname); 
    $tomail=safe($tomail); 
    $email=safe($email); 
    $comments=safe($comments); 
    $code1=safe($code1); 
	?>
	
   	<?php
if (preg_match("/a href/i", "$comments")) {
?> 
<?php } else { ?>

<?php if ($data==$_POST['code1']) { ?>

            <?php	
			$to="$tomail";
			$from="$email";
			$reply="$email";
			$headers="MIME-Version: 1.0\r\n";
            $headers .="Content-type: text/plain; charset=utf-8\r\n";
			$headers .= "From: $email<$email>\r\n";
			$subject="E-card from $domain";
			$message='
			
<html>
<head>
<title>E-card</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" link="#996699" vlink="#996699" alink="#996699">
<table width="100%" border="0" cellspacing="0" cellpadding="0" align="center">
  <tr> 
    <td> 
      <div align="center"> <font size="4" color="#666666">Dear '.$toname.' 
        , greetings from '.$company1.' - '.$name.' </font></div>
    </td>
  </tr>
  <tr> 
    <td>&nbsp;</td>
  </tr>
  <tr> 
    <td> 
      <div align="center"> <font face="Arial, Helvetica, sans-serif" size="3">Message: 
        '.$comments.'</font></div>
    </td>
  </tr>
  <tr>
    <td height="6"></td>
  </tr>
  <tr> 
    <td> 
      <table border="0" cellspacing="3" cellpadding="4" align="center" bgcolor="#CCCCCC">
        <tr> 
          <td bgcolor="#CCCCCC"><img src="http://www.'.$domain.'/photos/'.$rbphoto.'.jpg"></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr> 
    <td></td>
  </tr>
  <tr> 
    <td valign="bottom">&nbsp; </td>
  </tr>
</table>
</body>
</html>

';
$headers  = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=utf-8\r\n";
$headers .= "From: ".$name."<".$email.">\r\n";
$to  = $toemail ;
mail ($to, $subject, $message, $headers);
?>

                      </td>
                    </tr>
                    <tr> 
                      <td>
                      <?php echo $ftext1 ?>
                      </td>
                    </tr>
                    <tr> 
                      <td><hr></td>
                    </tr>
                    <tr> 
                      <td> 
   <table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr valign="top">
    <td width="150">
From <br>
To<br>

<?php echo $field6 ?>
    </td>
    <td> 
<?php echo $name ?> - <?php echo $email ?><br>
<?php echo $toname ?> - <?php echo $toemail ?><br>

<?php echo $comments ?>
</td>
  </tr>
</table></td>
                    </tr>
                    <tr> 
                      <td>&nbsp;</td>
                    </tr>
                    <tr> 
                      <td> 
                        <?php } else { ?>
                      </td>
                    </tr>
                    <tr> 
                      <td>
                   <a href="card.php"><?php echo $ftext2 ?></a> 
                      </td>
                    </tr>
                    <tr> 
                      <td> 
                        <?php } ?>
                        <?php } ?>
                        <?php } else { ?>
                      </td>
                    </tr>
                    <tr> 
                    
                        <td> 
                        <form name="forma" method="post" action="">	
     
        <?php
			$sql1 = "SELECT * FROM photos WHERE room_id='0' AND info_id='0' ORDER BY priority LIMIT 6";
			$result1 = mysql_query($sql1);
       	    $countph=0;
			while ($myrow=mysql_fetch_array($result1)) {
			$countph++;
			$photoid=$myrow['id'];
			$photo=$myrow['name_en'];
			$ppriority=$myrow['priority'];
?>
              <?php if ($photo=='') { 
$photo=$company1;
}?>
 <div style="float:left; width:80px; margin:5px">
<img src="/photos/thumbs/<?php echo $photoid ?>.jpg" width="80" height="53" alt="<?php echo $photo ?>" title="<?php echo $photo ?>"> <input name="rbphoto" type="radio" value="<?php echo $photoid ?>">
</div>
              <?php } ?>
        <div style="clear:both"> </div>
<table width="100%" border="0" cellpadding="0" cellspacing="2">
<tr valign="top">
                              <td><span class="titles">From</span></td>
                              <td>&nbsp;</td>
                              <td><span class="titles">To</span></td>
                              <td>&nbsp;</td>
                            </tr>
                            <tr valign="top">
                              <td colspan="4"><hr></td>
                            </tr>
                            <tr valign="top"> 
                              <td>
               <?php echo $field1 ?></td>
                              <td><input type="text" name="name" id="name" class="forms" size="30" maxlength="50"></td>
                              <td><?php echo $field1 ?></td>
                              <td><input type="text" name="toname" id="toname" class="forms" size="30" maxlength="50"></td>
                            </tr>
                            <tr valign="top">
                              <td>E-mail</td>
                              <td><input type="text" name="email" id="email" class="forms" size="30" maxlength="60"></td>
                              <td>E-mail*</td>
                              <td><input type="text" name="toemail" id="toemail" class="forms" size="30" maxlength="60"></td>
                            </tr>
                            <tr valign="top"> 
                              <td colspan="4"><hr></td>
                            </tr>
                            <tr valign="top">
                            <td>
               <?php echo $field6 ?>                            
                            </td>
                              <td colspan="3"><textarea name="comments" id="comments" class="forms" rows="3" cols="50"></textarea></td>
                            </tr>
                            <tr valign="top">
                              <td>
 <?php echo $ftext3 ?>
 <?
global $data;
$data = mt_rand(100000,1000000);
?>
    <input type="hidden" name="code1" value="<?php echo $code1 ?>">
    <input type="hidden" name="data" value="<?php echo $data ?>">                             

                              </td>
                              <td colspan="3">
                                <img src="/includes/dynamicimage.php?dt=<? global $data; echo base64_encode($data);?>" alt="">                                
                              <input type="text" name="code1" id="code1" size="16" class="forms" maxlength="6"></td>
                            </tr>
                            <tr valign="top">
                              <td>
              * <?php echo $fieldr ?>
                              </td>
                              <td colspan="3">
                                <input name="submit" type="submit" class="button" onClick="MM_validateForm('email','','NisEmail','toemail','','RisEmail');return document.MM_returnValue" value="<?php echo $button1 ?>">
                                
                              </td>
                            </tr>
</table>
						  </form>
                      </td>
                    </tr>
                    <tr> 
                      <td> 
              <?php } ?>
                </td>
                    </tr>
                  </table>