<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Web management</title>
<link rel="stylesheet" href="styles.css" type="text/css">
<?php include 'codes.php';?>
</head>
<body>
<table width="980" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>
    
<div><img src="img/frame-list.png" width="180" height="37" alt=""></div>
<div class="frame">
  <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center"><div class="titles">
        <?php
			$sql = "SELECT * FROM loyalty";
			$result = mysql_query($sql);
			$nu_row = mysql_num_rows($result);
?>
        <?php echo $nu_row  ?> </div></td>
  </tr>
  <tr>
    <td><?php require_once 'navibar.php'; ?>
      <?php  $nav = new navibar; ?>
      <?php
$sql = "SELECT * FROM loyalty ORDER BY active, id desc";
$result = $nav->execute($sql, $db);
$rows = mysql_num_rows($result);
for ($y = 0; $y < $rows; $y++) {
 $count=0;
  while ($myrow=mysql_fetch_array($result)) {
 $count++;
		    $id=$myrow['id'];
		    $name=$myrow['name'];
			$email=$myrow['email'];
			$tel=$myrow['tel'];
			$country=$myrow['country'];
			$address=$myrow['address'];
			$comments=$myrow['comments'];
			$stayed=$myrow['stayed'];
			$ip=$myrow['ip'];
			$active=$myrow['active'];
			$date=$myrow['date'];
	
 ?></td>
  </tr>
  <tr>
    <td>
    <table width="100%" border="0" cellspacing="1" cellpadding="4">
        <tr valign="top" bgcolor="#F2F2F2"> 
          <td width="120"><?php  echo $date?>
          <br>
IP: <?php  echo $ip?>
          </td>
          <td><b> <?php echo $name  ?> </b> <br>
          Address: <?php echo $address  ?> - <?php echo $country  ?>  Tel.: <?php echo $tel  ?> 
            <a href="mailto:<?php echo $email ?>?subject=Message from <?php echo $firma ?> loyalty" class="links"> <?php echo $email ?> </a>
            <hr>
      <?php if ($stayed==1) { ?> 
      <em>This member has already been at the hotel.</em><br>
       <?php } ?> 
       
            <?php  echo $comments?> 
          </td>
          <td width="120" align="center"> 
            <?php if ($active==0) { ?>          
            <?php
if  (isset($_POST['submit'])) {
$sql10="UPDATE loyalty SET active='1' WHERE id='{$_REQUEST['id']}'";
$result10=mysql_query($sql10);	
	
$to="$email";
$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="Loyalty member request from $domain1";
$message="

Dear $name,

Your Loyalty member request for $domain1 has been accepted.

As a member you will enjoy:
- Our special member offers
- Added value extras - get more for your money, with some wonderful little extras 
- Special occasions package deals
and more...

Go to the link $resurl1 and enter your member Promo Code $promocode1 in order to see our special member rates.

www.$domain1 Loyalty Club 
";
mail ($to, $subject, $message, $headers);	
?>
            <meta http-equiv="refresh" content="0"> 
            <?php } ?>       
            <form name="forma" method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" style="margin:0; padding:0">
              <input type="hidden" name="id" value="<?php echo $id ?>">
              <input type="submit" name="submit" id="submit" value="ACTIVATE" class="button"></form>
            <?php }else{?>             
            ACTIVE MEMBER
            <?php } ?>             
          </td>
          <td width="70" align="center">
		  <?php
if  (isset($_POST['deletelmember'])) {
$sql10="DELETE FROM loyalty WHERE id='{$_REQUEST['id']}'";
	$result10=mysql_query($sql10);	
?>
         <meta http-equiv="refresh" content="0">
            <?php } ?>
            <form name="forma" method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" enctype="multipart/form-data" style="margin:0; padding:0">
              <input type="hidden" name="id" value="<?php echo $id ?>">
<input type="submit" name="deletelmember" value="ΔΙΑΓΡΑΦΗ" class="link">
              </form>
              </td>
        </tr>
      </table>
    </td>
  </tr>
  <tr>
    <td><hr>
      <?php } ?><?php } ?></td>
  </tr>
  <tr>
    <td align="center"><a href="mailto:<?php echo $sitemail1 ?>?Bcc=<?php 
			$sql20 = "SELECT * FROM loyalty WHERE id>='$id' AND active='1' ORDER BY id desc";
			$result20 = mysql_query($sql20);
			while ($myrow=mysql_fetch_array($result20)) {
			$id=$myrow['id'];
		   $email=$myrow['email'];?><?php echo $email ?>,<?php }?>&subject=<?php echo $company1 ?>" class="links">&gt;&gt; 
      mail to all</a></td>
  </tr>
  <tr>
    <td align="center"><?php
$links = $nav->getlinks("all", "on");
for ($y = 0; $y < count($links); $y++) {
  echo $links[$y] . "&nbsp;&nbsp;";
}
?></td>
  </tr>
  </table>
</div>

<div align="right">               
 <?php
if  (isset($_POST['submit'])) {
$sql10="DELETE FROM nlmembers WHERE name IS NULL OR comments LIKE ('%http%')";
	$result10=mysql_query($sql10);	
?>
<meta http-equiv="refresh" content="0"> 
 <?php } ?>       
<form name="forma" method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" enctype="multipart/form-data" style="margin:0; padding:0">
 <input type="hidden" name="id" value="<?php echo $id ?>">
           <input type="submit" name="submit" value="Διαγραφή spam" class="link"></form>
           </div>
</td>
  </tr>
</table>
<?php include 'menudown.php';?>
</body>
</html>
