How can i send a pm to users online or all users or staff users
Help me pls
Help me pls
where have to put this? in core i think but give me one erros
uffff

[/b]
function PMtoALL($text){
$sql = @mysql_query("SELECT id FROM ibwf_users");
while ($id = @mysql_fetch_array($sql)){
@mysql_query("INSERT INTO ibwf_private SET byuid = '1', touid = '".$id[0]."', text = '".$text."', timesent = '".time()."'");
}
}
//// this is the id of the owner, if u are the owner put your id here
byuid = '1'
else if ($action=="pmtoall"){
echo '<card id="main" title="Send pm to all">
';
echo 'Send pm to all:
';
echo '<input type="text" name="msg"/>
';
echo '<anchor>send';
echo "<go href=\"adminproc.php?action=pmtoall&sid=$sid\" method=\"post\">";
echo "<postfield name=\"msg\" value=\"$(msg)\"/>";
echo '</go></anchor>';
echo '</p></card>';
}
else if ($action=="pmtoall"){
echo '<card id="main" title="Send pm to all">
';
$msg = $_POST['msg'];
PMtoALL($msg);
echo 'Pm sent to all users!
';
echo "<a href=\"index.php?action=main&sid=$sid\">index</a>";
echo '</p></card>';
}
function PMtoALL($text){
$sql = @mysql_query("SELECT id FROM ibwf_users");
while ($id = @mysql_fetch_array($sql)){
@mysql_query("INSERT INTO ibwf_private SET byuid = '1', touid = '".$id[0]."', text = '".$text."', timesent = '".time()."'");
}
}
//// this is the id of the owner, if u are the owner put your id here
byuid = '1'
else if ($action=="pmtoall"){
echo '<card id="main" title="Send pm to all">
';
echo 'Send pm to all:
';
echo '<input type="text" name="msg"/>
';
echo '<anchor>send';
echo "<go href=\"adminproc.php?action=pmtoall&sid=$sid\" method=\"post\">";
echo "<postfield name=\"msg\" value=\"$(msg)\"/>";
echo '</go></anchor>';
echo '</p></card>';
}
else if ($action=="pmtoall"){
echo '<card id="main" title="Send pm to all">
';
$msg = $_POST['msg'];
PMtoALL($msg);
echo 'Pm sent to all users!
';
echo "<a href=\"index.php?action=main&sid=$sid\">index</a>";
echo '</p></card>';
}
function PMtoALL($text){
$offline = 300;
$sql = @mysql_query("select * from `ibwf_users` WHERE lastvst>'".intval(time()-$offline)."'");
while ($id = @mysql_fetch_array($sql)){
@mysql_query("INSERT INTO ibwf_private SET byuid = '1', touid = '".$id[0]."', text = '".$text."', timesent = '".time()."'");
}
}
function PMtoALL($text){
$offline = 300;
$sql = @mysql_query("select * from `ibwf_users` WHERE lastvst>'".intval(time()-$offline)."'");
while ($id = @mysql_fetch_array($sql)){
@mysql_query("INSERT INTO ibwf_private SET byuid = '1', touid = '".$id[0]."', text = '".$text."', timesent = '".time()."'");
}
}
Comment