HELP: Message to all member (Lavalair)
Started on the old forum in October 2010 · view the original in the archive · old links redirect here
hey mate, there is a special lavalair forum here in coding forum lol... u shud really try to look first before posting
Hey this is the code you want as above its posted a few times but saves looking here ya go 🙂
[B]This is the Form action add it in index or anywhere you would like its set to index[/B]
echo "<form action=\"index.php?action=multipleinbox&sid=$sid\" method=\"post\">";
echo "<p align=\"center\">";
echo "PM:<input name=\"pmtou\" maxlength=\"1000\"/><br/>";
echo "TO:<select name=\"who\">";
echo "<option value=\"online\">Online members</option>";
echo "<option value=\"males\">males</option>";
echo "<option value=\"females\">females</option>";
echo "<option value=\"staff\">staff</option>";
echo "<option value=\"all\">all members</option>";
echo "</select><br/>";
echo "<input type=\"submit\" value=\"Update\"/>";
echo "</form>";
[B]Add this aswell into index[/B]
/////////////////////////inbox all
else if($action=="multipleinbox")
{
addonline(getuid_sid($sid),"Sending PM to everyone","index.php?action=$action");
$pmtou = $_POST["pmtou"];
$who = $_POST["who"];
$byuid = getuid_sid($sid);
echo "<head>";
echo "<title>send inbox to all</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body>";
echo "<p>";
$tm = time();
if($who=="all"){
$lastpm = mysql_fetch_array(mysql_query("SELECT MAX(timesent) FROM ibwf_private WHERE byuid='".$byuid."'"));
echo "<p align=\"center\">";
echo "All members has been sent this PM<br/>";
$pms = mysql_query("SELECT id, name FROM ibwf_users WHERE lastact>'".$tm24."'");
$tm = time();
while($pm=mysql_fetch_array($pms))
{
mysql_query("INSERT INTO ibwf_private SET text='[b]PM to all members[/b][br/]".$pmtou."[br/][i]This message was sent to all the members[/i]', byuid='".$byuid."', touid='".$pm[0]."', timesent='".$tm."'");
}
}else if($who=="staff"){
$lastpm = mysql_fetch_array(mysql_query("SELECT MAX(timesent) FROM ibwf_private WHERE byuid='".$byuid."'"));
echo "<p align=\"center\">";
echo "All Staff where sent this pm<br/>";
$pms = mysql_query("SELECT id, name FROM ibwf_users WHERE perm>0");
$tm = time();
while($pm=mysql_fetch_array($pms))
{
mysql_query("INSERT INTO ibwf_private SET text='[b]Public Anouncment:[/b][br/]".$pmtou."[br/][i]This message was sent to Staff only[/i]', byuid='".$byuid."', touid='".$pm[0]."', timesent='".$tm."'");
}
}else if($who=="online"){
$lastpm = mysql_fetch_array(mysql_query("SELECT MAX(timesent) FROM ibwf_private WHERE byuid='".$byuid."'"));
echo "<p align=\"center\">";
echo "All online members were sent this pm<br/>";
$pms = mysql_query("SELECT userid FROM ibwf_online");
$tm = time();
while($pm=mysql_fetch_array($pms))
{
mysql_query("INSERT INTO ibwf_private SET text='[b]Public Anouncment:[/b][br/]".$pmtou."[br/][i]This message was sent to online members at this moment in time[/i]', byuid='".$byuid."', touid='".$pm[0]."', timesent='".$tm."'");
}
}else if($who=="males"){
$lastpm = mysql_fetch_array(mysql_query("SELECT MAX(timesent) FROM ibwf_private WHERE byuid='".$byuid."'"));
echo "All Males has been send a pm<br/>";
$pms = mysql_query("SELECT id, name FROM ibwf_users WHERE sex='M'");
$tm = time();
while($pm=mysql_fetch_array($pms))
{
mysql_query("INSERT INTO ibwf_private SET text='[b]Public Anouncment:[/b][br/]".$pmtou."[br/][i]This message was sent to all male members[/i]', byuid='".$byuid."', touid='".$pm[0]."', timesent='".$tm."'");
}
}else if($who=="females"){
$lastpm = mysql_fetch_array(mysql_query("SELECT MAX(timesent) FROM ibwf_private WHERE byuid='".$byuid."'"));
echo "All Females has been send a pm<br/>";
$pms = mysql_query("SELECT id, name FROM ibwf_users WHERE sex='F'");
$tm = time();
while($pm=mysql_fetch_array($pms))
{
mysql_query("INSERT INTO ibwf_private SET text='[b]Public Anouncment:[/b][br/]".$pmtou."[br/][i]This message was sent to all female members[/i]', byuid='".$byuid."', touid='".$pm[0]."', timesent='".$tm."'");
}
}
echo "<p align=\"center\">";
echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"images/home.gif\" alt=\"*\"/>";
echo "<b>Home</a></b>";
echo "</p>";
echo "</body>";
echo "</html>";
exit();
}
All done it works perfect Please Say thanks if its helpfull
Hi im Antione Tony Thanks to all for the help everyone has giving me on coding-talk, im here almost everyday Here to code/create and learn new stuff , If I can help I will but please say thanks and friends on the way is a total bonus as we all have something in common we love creating new stuff 🙂