| 1 | <?php |
|---|
| 2 | /* |
|---|
| 3 | $Id: adm_email.php,v 1.1 2005/09/05 10:55:48 arnodu59 Exp $ |
|---|
| 4 | ---------------------------------------------------------------------- |
|---|
| 5 | AlternC - Web Hosting System |
|---|
| 6 | Copyright (C) 2005 by the AlternC Development Team. |
|---|
| 7 | http://alternc.org/ |
|---|
| 8 | ---------------------------------------------------------------------- |
|---|
| 9 | Based on: |
|---|
| 10 | Valentin Lacambre's web hosting softwares: http://altern.org/ |
|---|
| 11 | ---------------------------------------------------------------------- |
|---|
| 12 | LICENSE |
|---|
| 13 | |
|---|
| 14 | This program is free software; you can redistribute it and/or |
|---|
| 15 | modify it under the terms of the GNU General Public License (GPL) |
|---|
| 16 | as published by the Free Software Foundation; either version 2 |
|---|
| 17 | of the License, or (at your option) any later version. |
|---|
| 18 | |
|---|
| 19 | This program is distributed in the hope that it will be useful, |
|---|
| 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 22 | GNU General Public License for more details. |
|---|
| 23 | |
|---|
| 24 | To read the license please visit http://www.gnu.org/copyleft/gpl.html |
|---|
| 25 | ---------------------------------------------------------------------- |
|---|
| 26 | Original Author of file: Benjamin Sonntag |
|---|
| 27 | Purpose of file: Show a form to edit a member |
|---|
| 28 | ---------------------------------------------------------------------- |
|---|
| 29 | */ |
|---|
| 30 | require_once("../class/config.php"); |
|---|
| 31 | |
|---|
| 32 | if (!$admin->enabled) { |
|---|
| 33 | __("This page is restricted to authorized staff"); |
|---|
| 34 | exit(); |
|---|
| 35 | } |
|---|
| 36 | |
|---|
| 37 | include("head.php"); |
|---|
| 38 | ?> |
|---|
| 39 | </head> |
|---|
| 40 | <body> |
|---|
| 41 | <h3>Envoye d'email à tous les comptes</h3> |
|---|
| 42 | <?php |
|---|
| 43 | @set_time_limit(1200); |
|---|
| 44 | |
|---|
| 45 | $message = ''; |
|---|
| 46 | $subject = ''; |
|---|
| 47 | |
|---|
| 48 | if ( isset($_POST['submit']) ) |
|---|
| 49 | { |
|---|
| 50 | $subject = stripslashes(trim($_POST['subject'])); |
|---|
| 51 | $message = stripslashes(trim($_POST['message'])); |
|---|
| 52 | |
|---|
| 53 | $error = FALSE; |
|---|
| 54 | $error_msg = ''; |
|---|
| 55 | |
|---|
| 56 | if ( empty($subject) ) |
|---|
| 57 | { |
|---|
| 58 | $error = true; |
|---|
| 59 | $error_msg .= ( !empty($error_msg) ) ? '<br /><p class="error">Vous devez spécifié un sujet pour le mail !</p>' : '<p class="error">vous devez spécifié un sujet pour le mail !</p>'; |
|---|
| 60 | } |
|---|
| 61 | |
|---|
| 62 | if ( empty($message) ) |
|---|
| 63 | { |
|---|
| 64 | $error = true; |
|---|
| 65 | $error_msg .= ( !empty($error_msg) ) ? '<br /><p class="error">Votre mail doit contenir un message !</p>' : '<p class="error">Votre mail doit contenir un message !</p>'; |
|---|
| 66 | } |
|---|
| 67 | |
|---|
| 68 | $sql = "SELECT mail FROM membres WHERE uid <> 2000"; |
|---|
| 69 | $resultat = mysql_query($sql); |
|---|
| 70 | if ( $row = @mysql_fetch_array($resultat) ) |
|---|
| 71 | { |
|---|
| 72 | do |
|---|
| 73 | { |
|---|
| 74 | $headers = 'From: root@' . $_SERVER['HTTP_HOST'] . "\r\n"; |
|---|
| 75 | |
|---|
| 76 | mail($row['mail'], $subject, $message, $headers); |
|---|
| 77 | } |
|---|
| 78 | while ( $row = @mysql_fetch_array($resultat) ); |
|---|
| 79 | @mysql_free_result($resultat); |
|---|
| 80 | } |
|---|
| 81 | $error = true; |
|---|
| 82 | $error_msg .= '<p class="error">envoyé avec succès.</p>'; |
|---|
| 83 | } |
|---|
| 84 | |
|---|
| 85 | if ($error) |
|---|
| 86 | { |
|---|
| 87 | echo "$error_msg"; |
|---|
| 88 | } |
|---|
| 89 | ?> |
|---|
| 90 | <form method="post" action="adm_email.php"> |
|---|
| 91 | |
|---|
| 92 | <table cellspacing="1" cellpadding="4" border="0" align="center"> |
|---|
| 93 | <tr> |
|---|
| 94 | <th colspan="2">Envoye d'un mail à tous les utilisateurs</th> |
|---|
| 95 | </tr> |
|---|
| 96 | <tr> |
|---|
| 97 | <td align="right"><b>Sujet</b></td> |
|---|
| 98 | <td><span><input type="text" name="subject" size="45" maxlength="100" tabindex="2" value="" /></span></td> |
|---|
| 99 | </tr> |
|---|
| 100 | <tr> |
|---|
| 101 | <td align="right" valign="top"> <span><b>Message</b></span> |
|---|
| 102 | <td><span> <textarea name="message" rows="15" cols="35" wrap="virtual" style="width:450px" tabindex="3"></textarea></span> |
|---|
| 103 | </tr> |
|---|
| 104 | <tr> |
|---|
| 105 | <td class="catBottom" align="center" colspan="2"><input type="submit" value="Envoyer le mail" name="submit" /></td> |
|---|
| 106 | </tr> |
|---|
| 107 | </table> |
|---|
| 108 | |
|---|
| 109 | </form> |
|---|
| 110 | |
|---|
| 111 | </body> |
|---|
| 112 | </html> |
|---|