0) { $user_id_query = mysql_query("SELECT level FROM users_level WHERE id_level=$level")or sqlerr(__FILE__, __LINE__); $user_rank=mysql_fetch_array($user_id_query); $user_level=$user_rank['level']; $user_id_query1 = mysql_query("SELECT level FROM users_level WHERE id_level=$level1")or sqlerr(__FILE__, __LINE__); $user_rank1=mysql_fetch_array($user_id_query1); $user_level1=$user_rank1['level']; if($level1>0 && $level < $level1) { $where = " AND id_level>=$level AND id_level<=$level1"; $usr_lev = "in ".USER_LEVEL."s ($user_level - $user_level1)"; } elseif($level1>0 && $level > $level1) { $where = " AND id_level<=$level AND id_level>=$level1"; $usr_lev = "in ".USER_LEVEL."s ($user_level1 - $user_level)"; } elseif($level>0 && $level1==0 || $level1>0 && $level1 == $level) { $where = " AND id_level=$level"; $usr_lev = "in ".USER_LEVEL." ($user_level)"; } } // this just incase first box is set to all and second is set to a level, setup to PM the one level selected :) elseif($level==0 && $level1>0) { $user_id_query1 = mysql_query("SELECT level FROM users_level WHERE id_level=$level1")or sqlerr(__FILE__, __LINE__); $user_rank1=mysql_fetch_array($user_id_query1); $user_level1=$user_rank1['level']; $where = " AND id_level=$level1"; $usr_lev = "in ".USER_LEVEL." ($user_level1)"; } //no userlevels selected to PM so PM everyone else { $where = ""; $usr_lev = "in all ".USER_LEVEL."s"; } // do we want to PM users based on ratio? $check_ratio=false; if($ratio>0) { $check_ratio=true; } //add a footer to the message if($footer) $msg = "$msg $footer"; $msg = sqlesc($msg); $i = 0; //do database call $result_id = mysql_query("SELECT * FROM users where id > 1$where") or sqlerr(__FILE__, __LINE__); while ($id_collect = mysql_fetch_array ($result_id)) { if(!$list_users) $l_users ="not listing users as its deactivated"; $user_id = $id_collect['id']; // stop PM to sender added function below to PM sender ;) if($user_id == $CURUSER['uid']) continue; //did we want to PM based on ratio? if($check_ratio) { $downloaded = $id_collect["downloaded"]; $uploaded = $id_collect["uploaded"]; //added in to stop divisons by zero if($downloaded == 0) $downloaded = "0.2"; if($uploaded == 0) $uploaded = "0.1"; $ratio1=number_format($uploaded/$downloaded,2); // if matching ratio if($pick == 0) { $ratio_details = "with a ".RATIO." of ($ratio)"; if($ratio == $ratio1) { if($list_users) $l_users .="".$id_collect['username']." - "; if($pm) mysql_query("INSERT INTO messages (sender, receiver, added, subject, msg) VALUES ($sender,$user_id,UNIX_TIMESTAMP(),$subject,$msg)"); } else continue; } //if ratio X + greater if($pick == 1) { $ratio_details = "with a ".RATIO." of ($ratio) and above"; if($ratio < $ratio1) { if($list_users) $l_users .="".$id_collect['username']." - "; if($pm) mysql_query("INSERT INTO messages (sender, receiver, added, subject, msg) VALUES ($sender,$user_id,UNIX_TIMESTAMP(),$subject,$msg)"); } else continue; } //if ratio X + lower if($pick == 2) { $ratio_details = "with a ".RATIO." of ($ratio) and below"; if($ratio > $ratio1) { if($list_users) $l_users .="".$id_collect['username']." - "; if($pm) mysql_query("INSERT INTO messages (sender, receiver, added, subject, msg) VALUES ($sender,$user_id,UNIX_TIMESTAMP(),$subject,$msg)"); } else continue; } } //otherwise we did not want to pm users based on ratio else { if($list_users) $l_users .="".$id_collect['username']." - "; if($pm) mysql_query("INSERT INTO messages (sender, receiver, added, subject, msg) VALUES ($sender,$user_id,UNIX_TIMESTAMP(),$subject,$msg)"); } $i = $i+ 1; } } // PM sender if true if($pm_sender) mysql_query("INSERT INTO messages (sender, receiver, added, subject, msg) VALUES ($sender,".$CURUSER['uid'].",UNIX_TIMESTAMP(),$subject,$msg)"); //pm sent block block_begin(MASS_SENT); print("\n"); print("\n"); print("\n"); print("\n"); print("\n
".MASS_SENT."
".SUBJECT.":".unesc($subject)."
".BODY.":".format_comment($msg)."
info$i ".USERS_FOUND." $usr_lev $ratio_details !!

".USERS_PMED."
$l_users

Mass PM by vibes
"); print("
"); block_end(); } // no pm set so display the form elseif($action=="write") { block_begin(MASS_PM); //error? if($error=="return") echo"".MASS_PM_ERROR.""; print("\n
"); print(""); print(""); print(""); print(""); print(""); print("\n"); print("\n
".WHO_PM."
From ".USER_LEVEL.":
To ".USER_LEVEL.":
".RATIO.":
".RATIO.":
".SUBJECT.":
".textbbcode("masspm","msg","$msg")."
"); print("
"); print("\n"); print("\n"); print("\n
"); print("
"); } else redirect("admincp.php"); ?>