ACC SHELL

Path : /srv/www/vhosts/profias/inc/admin/
File Upload :
Current File : /srv/www/vhosts/profias/inc/admin/newsletter.php

<?php
  include('fce.php');
  include('forms.php');
  
  $content=''; 
  $http_root='http://greenrestaurant.cz/';       


  

  if (TRUE==isset($_POST['action']))
  {
    $action=$_POST['action'];
  }
  else
  if (TRUE==isset($_GET['action']))
  {
    $action=$_GET['action'];
  }
  else
  {
    $action='';
  }





      if (TRUE==$_GET['offset'])
      {
        $offset=$_GET['offset'];
      }
      else
      {
        $offset=0;
      }

      $query=mysql_query('SELECT DISTINCT *
      FROM newsletter
        WHERE
        active=\'Y\'
       LIMIT
        '.(int)$offset.', '.((int)$offset+10)
      );
      
      
      
      $emails_array=array();
      while($row=mysql_fetch_array($query))
      {
        $emails_array[]=$row;
      }
 
 
      if (0==count($emails_array))
      {
        unlink('/tmp/newsletter_message');
        header('Location: newsletter-write.php?status=ok&offset='.$offset);
        die();
      }

      sleep(3);

      $f=fopen('/tmp/newsletter_message', 'r');
        $message=fread($f, filesize('/tmp/newsletter_message'));
      fclose ($f);
      $f=fopen('/tmp/newsletter_title', 'r');
        $title=fread($f, filesize('/tmp/newsletter_title'));
      fclose ($f);

      $header="From: info@greenrestaurant.cz\n";
      $header.="Content-Type: text/html; charset=windows-1250\n";


       
      $subject="Greenrestaurant.cz - novinka";


        foreach($emails_array AS $email)
        {
          if ( ('Y'==$email['active']) )
          {
            $delete="<hr />\n\nPro zrušení registrace prosím klikněte na (zkopírujte do prohlížeče) tento odkaz: <a href=\"".$GLOBALS['http_root']."newsletter.php?action=delete&email=".addslashes($email['email'])."&key=".addslashes($email['authorized'])."\">".$GLOBALS['http_root']."newsletter.php?action=delete&email=".addslashes($email['email'])."&key=".addslashes($email['authorized'])."</a>";
            mail($email['email'], $subject, $message.$delete, $header);
          }
        }      
      header('Location: newsletter.php?action=send_next&offset='.($offset+10).'&language='.$_GET['language'].'&topic='.$_GET['topic']);
      die();

      



echo $content;
//    echo html($content);
  
  
?>

ACC SHELL 2018