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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
<?php // Database configuration $servername = "localhost"; $username = "admin"; $password = "mscmks71s11f132n"; $dbname = "niki";
// Create connection $conn = new mysqli($servername, $username, $password, $dbname);
// Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); }
// Process AJAX request if (isset($_GET['action']) && $_GET['action'] == 'get_emails') { $emails = array(); $sql = "SELECT u_email FROM users"; $result = $conn->query($sql); if ($result->num_rows > 0) { while($row = $result->fetch_assoc()) { $emails[] = $row['u_email']; } } echo implode("\n", $emails); exit; } ?>
<!DOCTYPE html> <html> <head> <title>GRID TIP Mass Mailer</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script> function loadEmails() { var xhr = new XMLHttpRequest(); xhr.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { document.getElementById("emailList").value = this.responseText; } }; xhr.open("GET", "<?php echo $_SERVER['PHP_SELF']; ?>?action=get_emails", true); xhr.send(); } </script>
<script src="tinymce/tinymce.min.js"></script>
<script> tinymce.init({ selector: '#myTextarea', menubar: false, toolbar: 'undo redo bold italic underline h1 h2 h3 h4 h5 h6 hr', statusbar: false }); </script>
</head>
<body bgcolor='#1c7cd6'>
<?php
echo "<BR><BR><div align=left><font face='Arial, Helvetica, sans-serif' size='6' color='#ffffff'> <b>GRID TIP Mass Mailer</b></font></div><BR><BR>";
echo "<form method=post action='send.php' enctype='multipart/form-data'>";
echo "<table cellpadding='5'><tr><td><font face='Arial, Helvetica, sans-serif' size='4' color='#ffffff'>From (Email Address):</font></td><td><input type='email' name='from' size='61' maxlength='60' value='admin.gridtip@gridtip.net' required></td></tr>";
echo "<tr><td valign='top'><font face='Arial, Helvetica, sans-serif' size='4' color='#ffffff'>From (Name):</font></td><td><input type='text' name='who' size='61' maxlength='60' value='GRID TIP Admin' required></td></tr>";
echo "<tr><td valign='top'><font face='Arial, Helvetica, sans-serif' size='4' color='#ffffff'>To (Recipients):</font><BR><font face='Arial, Helvetica, sans-serif' size='2' color='#ffffff'>Separate recipients by line feeds</font></td><td><textarea name='to' id='emailList' cols='60' rows='10' required></textarea></td></tr>";
echo "<tr><td> </td><td><button onclick='loadEmails()'>Load Email Addresses of GRID TIP Users</button>";
echo "<tr><td valign='top'><font face='Arial, Helvetica, sans-serif' size='4' color='#ffffff'>Email Subject:</font></td><td><input type='text' name='subject' size='61' maxlength='60' required></td></tr>";
echo "<tr><td valign='top'><font face='Arial, Helvetica, sans-serif' size='4' color='#ffffff'>Message Text:</font></td><td><textarea id='myTextarea' name='message' cols='60' rows='15'></textarea></td></tr>";
/* //upload images $max_no_img=15; // Maximum number of images value to be set here //echo "<form method=post action='attach.php' enctype='multipart/form-data'>"; for ($i=1; $i<=$max_no_img; $i++){ echo "<tr><td>File $i: </td><td> <input type=file name='file[]' class='bginput'></td></tr><br>";} //*/
echo "<tr><td> </td><td><input type=file name='userfile[]' class='bginput'>";
echo " <input type='submit' value='Send Email'></td></tr><table>";
echo "</form>";
?>
</body> </html>
|