Advertisement
tjromano

mail.php

Sep 12th, 2012
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.96 KB | None | 0 0
  1. <?php
  2.  
  3. session_cache_limiter();
  4. session_start();
  5.  
  6. //require config and functions files
  7. require('config.php');
  8. require('functions.php');
  9.  
  10. //check for administrative rights
  11. if (allow_access(Administrators) != "yes")
  12. {
  13.     include ('no_access.html');
  14.     exit;
  15. }
  16.  
  17. //make the dbase query selecting only email address
  18. $sql ="SELECT * FROM `authorize` WHERE `email` <>";
  19. $result = @mysql_query($sql,$connection) or die(mysql_error());
  20. echo mysql_error();
  21.  
  22. echo "Your Message Has Been Sent to the Following Users:<br><br>";
  23.     while ($sql = mysql_fetch_object($result))
  24.     {
  25.         $e_fn = $sql -> firstname;
  26.         $e_ln = $sql -> lastname;
  27.         $e_addr = $sql -> email;
  28.         $e_user = $sql -> username;
  29.         $subject = $_POST[e_subject];
  30.         $mailheaders = $_POST[e_message];
  31.         mail($e_addr, $subject, $mailheaders, "From: No Reply <$adminemail>\n");
  32.         echo "$e_fn $e_ln<br>";
  33.     }
  34.    
  35. ?>
  36. <html>
  37. <head>
  38. <meta http-equiv="refresh" content="5; url=adminpage.php" />
  39. </head>
  40. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement