View file admincp/globalpm.php

File size: 1.9Kb
<?php
// YANG HACK JANGAN HILANGKAN LISENSI INI
// HTTP://INDWAP.COM
// DAMAI SELALU TAK PERNAH JAIL KARENA TIDAK BISA APA-APA
// SCRIPT BY ULOKI.COM
// REMODIF BY ANTOQ 
// HTTP://FACEBOOK.COM/WWW.INDWAP.ORG


require("../include/init.php");

if($group[$user->groupid]['type'] < 3)
{
forward("index.php");
}

include "../include/header.php";
echo '<div class="phdr">Gobal Pm</div>';
?>

<?php
if(isset($_POST['submit']))
{
$sub=$_POST['sub'];
$msg=$_POST['msg'];

if(strlen($sub) < 1 || strlen($msg) < 1)
{
err_msg("Global PM","Subject or Message was blank.","</td></tr></table><br/><br/>");
}

$sel=0;
foreach($group as $key => $val)
{
if(isset($_POST['g'.$key]))
{
$to[]=$key;
$sel++;
}
}

if($sel==0)
{
err_msg("Global PM","You should select atleast one type of group.","</td></tr></table>");
}

$qu = "";

for($i=0;$i<sizeof($to);$i++)
{
if($i != 0){ $qu .=" OR "; }
$qu .= " groupid='".$to[$i]."'";
}

$u=$db->select("SELECT userid FROM b_users WHERE $qu");

foreach($u as $us)
sendpm($us->userid,$user->userid,$sub,$msg);

err_msg("Global PM","We have sent message successfully.","</td></tr></table><br/><br/>");
}
else
{
?>
<form action="globalpm.php?do=send" method="POST">

<table class="smalltable">
<tr><td valign="top">Send PM To :<br/>
<?php
foreach($group as $key => $val)
{
if($key != "1")
print "<input type=\"checkbox\" name=\"g".$key."\" value=\"1\" /> ".$val['name']." &nbsp;<br/>";
}
print "<br/>";
?>
</td></tr>
<tr><td>Subject : <br/> <input type="text" name="sub" value="Global PM:" /></td></tr>
<tr><td valign="top">Message : <br/><textarea name="msg" cols="30" rows="4"></textarea></td></tr>
<tr><td> <input type="submit" name="submit" value="Send Now" /></td></tr>
</table>



</form>
<?php
}
echo'<div class="phdr"><a href="index.php">Admin Panel</a> | <a href="globalpm.php">Kembali</a></div>';
include "../include/footer.php";
?>