MYSQL HJÆLP 2
jeg skal også bruge en MYSQL maillings liste, men den bruger også MYSQL og det kan jeg ik finde ud af, kan du lave en mysql database til denne maillings liste, den skriver således:Warning: Supplied argument is not a valid MySQL result resource in d:\\home\\test\\www\\tester\\admin.php on line 58
og her er scritp:
<?
// ADMIN AREA
// HER ER DER MULIGHED FOR AT SENDE E-MAILS TIL HELE LISTEN
$sql_host = \"secret\";
$sql_user = \"secret\";
$sql_passwd = \"secret\";
$db = \"systems\";
mysql_connect($sql_host,$sql_user,$sql_passwd);
mysql_select_db($db);
if ($mode == \"send\") {
if ($action == \"on\") {
$res = mysql_query(\"SELECT * FROM mailliste\");
$besked = nl2br($besked);
while ($row = mysql_fetch_array($res)) {
$modtager = $row[\"mail\"];
mail($modtager,$emne,$besked);
}
?>Mail sendt<?
exit;
}
?><form action=\"admin.php?mode=send&action=on\" method=\"post\">
<table cellpadding=\"3\" cellspacing=\"0\" border=\"0\" width=\"350\">
<tr>
<td><font face=\"helvetica\" size=\"2\" color=\"#000000\">Emne: </font></td>
<td><input type=\"text\" name=\"emne\" size=\"30\"></td>
</tr><tr valign=\"top\">
<td><font face=\"helvetica\" size=\"2\" color=\"#000000\">Besked: </font></td>
<td><textarea cols=\"50\" rows=\"10\" name=\"besked\"></textarea></td>
</tr><tr>
<td colspan=\"2\"><input type=\"submit\" value=\"SEND\"></td>
</tr></table></form>
<?
}
if (!$mode) {
// Laver oversigt
?>
<font face=\"helvetica\" size=\"2\" color=\"#000000\"><b><font size=\"+1\">Oversigt:</b></font><br>
Her er en oversigt over, hvilke E-mail adresser der er tilmeldt maillisten.
<br>
<table cellpadding=\"1\" cellspacing=\"2\" border=\"0\" width=\"100%\" bgcolor=\"#FFFFFF\">
<tr>
<td bgcolor=\"#000000\"><center><font face=\"helvetica\" size=\"2\" color=\"#FFFFFF\"><b>#:</B></font></center></td>
<td bgcolor=\"#000000\"><center><font face=\"helvetica\" size=\"2\" color=\"#FFFFFF\"><b>ID:</b></font></center></td>
<td bgcolor=\"#000000\"><center><font face=\"helvetica\" size=\"2\" color=\"#FFFFFF\"><b>IP: </B></Font></Center></Td>
<td bgcolor=\"#000000\"><center><font face=\"helvetica\" size=\"2\" color=\"#FFFFFF\"><b>E-mail: </b></font></center></td>
<td bgcolor=\"black\"><center><font face=\"helvetica\" size=\"2\" color=\"#FFFFFF\"><b>Dato & tid</b></font></center></td>
</Tr>
<?
$result = mysql_query(\"SELECT * FROM mailliste ORDER by tid desc\");
$nummer = 1;
while (list($id, $ip, $mail, $tid) = mysql_fetch_row($result)) {
?>
<tr>
<td bgcolor=\"#EEEEEE\"><font face=\"helvetica\" size=\"2\" color=\"#000000\"><? print $nummer; $nummer++;?></font></td>
<td bgcolor=\"#EEEEEE\"><font face=\"helvetica\" size=\"2\" color=\"#000000\"><? print $id; ?></font></td>
<td bgcolor=\"#EEEEEE\"><font face=\"helvetica\" size=\"2\" color=\"#000000\"><? print $ip; ?></font></td>
<td bgcolor=\"#EEEEEE\"><font face=\"helvetica\" size=\"2\" color=\"#000000\"><? print $mail; ?></font></td>
<td bgcolor=\"#EEEEEE\"><font face=\"helvetica\" size=\"2\" color=\"#000000\"><? print $tid; ?></font></td>
</tr>
<?
}
?>
</table>
<?
}
?>
<br>
<a href=\"admin.php?mode=send\">Send Mail til listen</a>
<br><br>