View file public_html/vipadz/mailall.php

File size: 1.06Kb
<?php
//coded by arshad
//email: arshadwap.com@gmail.com

include '../db.php';
include '../functions.php';

headtag("$SiteName - Mail All Users");

if($adminlog==1){

echo '<div class="title">Mail All Users</div>';

if (isset($_REQUEST['subject']))
//if "subject" is filled out, send email
  {
  //send email
  $subject = $_REQUEST['subject'] ;
  $body = $_REQUEST['message'] ;
$rs = mysql_query('SELECT email from userdata WHERE status="ACTIVE"');
while(list($to) = mysql_fetch_row($rs))
{
// Send Email
Send_Mail($to,$subject,$body);

  echo '<div class="ok"><font color=green>Mail Sent Successfully !</font></div><br/>';
}
  }
else
//if "subject" is not filled out, display the form
  {
  echo "<div class='form'><form method='post' action='mailall.php'>
  Subject:<br /><input name='subject' type='text' /><br />
  Message:<br />
  <textarea name='message' ></textarea><br />
  <input type='submit' value='Mail All Users' />
  </form></div>";
  }
?>
<?php
echo '<a href="index.php"><div class="ua">Home</div></a>';
include '../foot.php';
}
else {header('Location:login.php');}


?>