chrispadfield
02-13-2001, 10:00 PM
Ok my first hack (and very simple)
What it does is lets an admin pm everyone. This is very simple at the moment and could be made more complicated like the email one in later versions. It only pm's people who have set pm to on in their profile.
I have attached the file but this is it:
<?
require("./global.php");
echo "<html><body>";
echo "<h1>Mass PM</h1><br>";
echo "This will send a pm to every user who has set receive pm on.";
echo "<FORM METHOD=\"post\" ACTION=\"$PHP_SELF\">";
echo "Your user number:<br>";
echo "<INPUT type=\"text\" NAME=\"adminuser\" value=\"$adminuser\" SIZE=5></P>";
echo "PM Title:<br>";
echo "<INPUT type=\"text\" NAME=\"title\" SIZE=\"40\"></P>";
echo "Message:<br>";
echo "<textarea name=\"message\" rows=\"8\" cols=\"0\"></textarea><br>";
echo "<INPUT type=\"hidden\" NAME=\"action\" value=\"do\">";
echo "<INPUT type=\"submit\" NAME=\"Submit\">";
echo "<P><P><P>";
if ($action=="do") {
echo "<html><body>";
$forums=$DB_site->query("SELECT userid,username FROM user WHERE receivepm=1 ORDER BY userid");
while ($forum=$DB_site->fetch_array($forums)) {
$sql=$DB_site->query("INSERT INTO privatemessage (privatemessageid, folderid, userid, touserid, fromuserid, title, message, dateline, showsignature, iconid, messageread) VALUES (NULL, '0', '$forum[userid]', '$forum[userid]', '$adminuser', '".addslashes($title)."', '".addslashes($message)."', UNIX_TIMESTAMP(), '1', '1', '0')");
echo "pm sent to $forum[userid] <br>";
}
echo "</body></html>";
}
?>
this is my first mod so i would like comments on what i am doing wrong!
p.s. do i get an award for the first v2.0 mod?
What it does is lets an admin pm everyone. This is very simple at the moment and could be made more complicated like the email one in later versions. It only pm's people who have set pm to on in their profile.
I have attached the file but this is it:
<?
require("./global.php");
echo "<html><body>";
echo "<h1>Mass PM</h1><br>";
echo "This will send a pm to every user who has set receive pm on.";
echo "<FORM METHOD=\"post\" ACTION=\"$PHP_SELF\">";
echo "Your user number:<br>";
echo "<INPUT type=\"text\" NAME=\"adminuser\" value=\"$adminuser\" SIZE=5></P>";
echo "PM Title:<br>";
echo "<INPUT type=\"text\" NAME=\"title\" SIZE=\"40\"></P>";
echo "Message:<br>";
echo "<textarea name=\"message\" rows=\"8\" cols=\"0\"></textarea><br>";
echo "<INPUT type=\"hidden\" NAME=\"action\" value=\"do\">";
echo "<INPUT type=\"submit\" NAME=\"Submit\">";
echo "<P><P><P>";
if ($action=="do") {
echo "<html><body>";
$forums=$DB_site->query("SELECT userid,username FROM user WHERE receivepm=1 ORDER BY userid");
while ($forum=$DB_site->fetch_array($forums)) {
$sql=$DB_site->query("INSERT INTO privatemessage (privatemessageid, folderid, userid, touserid, fromuserid, title, message, dateline, showsignature, iconid, messageread) VALUES (NULL, '0', '$forum[userid]', '$forum[userid]', '$adminuser', '".addslashes($title)."', '".addslashes($message)."', UNIX_TIMESTAMP(), '1', '1', '0')");
echo "pm sent to $forum[userid] <br>";
}
echo "</body></html>";
}
?>
this is my first mod so i would like comments on what i am doing wrong!
p.s. do i get an award for the first v2.0 mod?