C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\movieDB\web\mlist.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<? 
require("inc/menu.php");
require(
"inc/html.php");
require(
"inc/common.php");

$config=getconfig();

$output="";
$rows="";
$cells="";

if (
$admin==FALSE) {
        
header("Location: index.php");
        die();
}

$action=$_POST["action"];

if (!
saneempty($action)) {
    if (
saneempty($_POST["subject"])) $error="Please specify a subject.<BR />\n";
    if (
saneempty($_POST["note"])) $error="Please enter a message.<BR />\n";

    if (!
saneempty($error)) {
        
$output.="The following errors occured. Please return and correct them:<BR /><BR />\n";
        
$output.=$error;
    } else {
        
$result=mysql_query("select fname,email from user where enabled=1");

        while (
$row=mysql_fetch_row($result)){
            
$to=$row[1];
            
$message="Dear ".$row[0].",\n\n".ungreatescape($_POST["note"]);
            
$headers "From: ".$config["siteemail"];
            
mail($to,$_POST["subject"],$message,$headers);
            
$output.="Mail sent to <B>".$to."</B><BR />\n";
        }
    }
} else {
    
$output.="<P>\nThis form will send an email out to every active user of the DVD database. Use it with care.<BR /><BR />\n";
    
$output.=form_begin("mlist.php","POST");
    
$output.=input_hidden("action","mailout");

    
$rows.=tr(td("Subject: ","","","RIGHT").td(input_text("subject",40,255),"","","LEFT"));
    
$rows.=tr(td("Message: ","","","RIGHT","TOP").td(textarea("note","",20,40),"","","LEFT"));
    
$rows.=tr(td(submit("Send Mail"),"","","CENTER","",2));

    
$output.=table($rows,0,2,0,"100%");
}

$content["body"] =& $output;
dopage($content);

?>