help in bann

Started on the old forum in May 2009 · view the original in the archive · old links redirect here

6 replies · 418 views · started 17 years ago · 2 min read

3 participants
godzilla Developer · 119 posts #1

anybody please give me coding like if another owner trying to bann another owner then it says u can't bann other owner.

i m using wapdesire script.

here is my action

else if($action=="ipban")
{
  $who = $_POST["who"];
  $pres = $_POST["pres"];
  $pds = $_POST["pds"];
  $phr = $_POST["phr"];
  $pmn = $_POST["pmn"];
  $psc = $_POST["psc"];
  $user = getnick_uid($who);
  echo "<head>";
  echo "<title>Owner Tools</title>";
  echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
  echo "</head>";
  echo "<body>";
  echo "<p align=\"center\">";

  $uid = getuid_sid($sid);
  $perm = mysql_fetch_array(mysql_query("SELECT perm FROM ibwf_users WHERE id='".$uid."'"));
  $trgtperm = mysql_fetch_array(mysql_query("SELECT perm FROM ibwf_users WHERE name='".$user."'"));

  if($trgtperm>$perm){ 
  echo "<b><img src=\"../images/notok.gif\" alt=\"x\"/><br/>Error!!!<br/>Permission Denied...</b><br/>";
  echo "<br/>U Cannot Ip-ban $user<br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p>";
  }else{
  echo "<br/>";
  if(trim($pres)=="")
  {
  echo "<img src=\"../images/notok.gif\" alt=\"X\"/>You must Specify a reson for punishing the user";
  }else{
  $timeto = $pds*24*60*60;
  $timeto += $phr*60*60;
  $timeto += $pmn*60;
  $timeto += $psc;
  $ptime = $timeto + time();
  $uip = getip_uid($who);
  $ubr = getbr_uid($who);
  $res = mysql_query("INSERT INTO ibwf_penalties SET uid='".$who."', penalty='2', exid='".getuid_sid($sid)."', timeto='".$ptime."', pnreas='".mysql_escape_string($pres)."', ipadd='".$uip."', browserm='".$ubr."'");
  if($res)
  {
  $pmsg[1]="Ip-banned";
  mysql_query("UPDATE ibwf_users SET lastpnreas='".$pmsg[1].": ".mysql_escape_string($pres)."' WHERE id='".$who."'");
  mysql_query("INSERT INTO ibwf_mlog SET action='ipbanned', details='<b>".getnick_uid(getuid_sid($sid))."</b> Ip-banned The user <b>".$user."</b> For ".gettimemsg($timeto)."', actdt='".time()."'");
  echo "<img src=\"../images/ok.gif\" alt=\"O\"/>$user ip-banned successfully";
  }else{
  echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Error ip-banning $user";
  }
  }
  echo "<br/><br/><b>8 </b><a accesskey=\"8\" href=\"index.php?action=viewuser&who=$who&sid=$sid\">$user's Profile</a><br/>";
  echo "<b>9 </b><a accesskey=\"9\" href=\"ownercp.php?action=ownercp&sid=$sid\"><img src=\"../images/admn.gif\" alt=\"\"/>Owner Tools</a><br/>";
  echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p>";
  }
  echo "</body>";
}
else if($action=="ban")
{
  $who = $_POST["who"];
  $pres = $_POST["pres"];
  $pds = $_POST["pds"];
  $phr = $_POST["phr"];
  $pmn = $_POST["pmn"];
  $psc = $_POST["psc"];
  $user = getnick_uid($who);
  echo "<head>";
  echo "<title>Owner Tools</title>";
  echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
  echo "</head>";
  echo "<body>";
  echo "<p align=\"center\">";
  $uid = getuid_sid($sid);
  $perm = mysql_fetch_array(mysql_query("SELECT perm FROM ibwf_users WHERE id='".$uid."'"));
  $trgtperm = mysql_fetch_array(mysql_query("SELECT perm FROM ibwf_users WHERE name='".$user."'"));

  if($trgtperm>$perm){ 
  echo "<b><img src=\"../images/notok.gif\" alt=\"x\"/><br/>Error!!!<br/>Permission Denied...</b><br/>";
  echo "<br/>U Cannot Ban $user<br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p>";
  }else{
  echo "<br/>";
  if(trim($pres)=="")
  {
  echo "<img src=\"../images/notok.gif\" alt=\"X\"/>You must Specify a reson for punishing the user";
  }else{
  $timeto = $pds*24*60*60;
  $timeto += $phr*60*60;
  $timeto += $pmn*60;
  $timeto += $psc;
  $ptime = $timeto + time();
  $res = mysql_query("INSERT INTO ibwf_penalties SET uid='".$who."', penalty='1', exid='".getuid_sid($sid)."', timeto='".$ptime."', pnreas='".mysql_escape_string($pres)."', ipadd='', browserm=''");
  if($res)
  {
  $pmsg[1]="Banned";
  mysql_query("UPDATE ibwf_users SET lastpnreas='".$pmsg[1].": ".mysql_escape_string($pres)."' WHERE id='".$who."'");
  mysql_query("INSERT INTO ibwf_mlog SET action='banned', details='<b>".getnick_uid(getuid_sid($sid))."</b> Banned The user <b>".$user."</b> For ".gettimemsg($timeto)."', actdt='".time()."'");
  echo "<img src=\"../images/ok.gif\" alt=\"O\"/>$user banned successfully";
  }else{
  echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Error banning $user";
  }
  }
  echo "<br/><br/><b>8 </b><a accesskey=\"8\" href=\"index.php?action=viewuser&who=$who&sid=$sid\">$user's Profile</a><br/>";
  echo "<b>9 </b><a accesskey=\"9\" href=\"ownercp.php?action=ownercp&sid=$sid\"><img src=\"../images/admn.gif\" alt=\"\"/>Owner Tools</a><br/>";
  echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p>";
  }
  echo "</body>";
}
Spook Newbie · 1 posts #2

godzilla wrote: anybody please give me coding like if another owner trying to bann another owner then it says u can't bann other owner.

i m using wapdesire script.

here is my action

else if($action=="ipban")
{
  $who = $_POST["who"];
  $pres = $_POST["pres"];
  $pds = $_POST["pds"];
  $phr = $_POST["phr"];
  $pmn = $_POST["pmn"];
  $psc = $_POST["psc"];
  $user = getnick_uid($who);
  echo "<head>";
  echo "<title>Owner Tools</title>";
  echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
  echo "</head>";
  echo "<body>";
  echo "<p align=\"center\">";


  $uid = getuid_sid($sid);
  $perm = mysql_fetch_array(mysql_query("SELECT perm FROM ibwf_users WHERE id='".$uid."'"));
  $trgtperm = mysql_fetch_array(mysql_query("SELECT perm FROM ibwf_users WHERE name='".$user."'"));

  if($trgtperm>$perm){ 
  echo "<b><img src=\"../images/notok.gif\" alt=\"x\"/><br/>Error!!!<br/>Permission Denied...</b><br/>";
  echo "<br/>U Cannot Ip-ban $user<br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p>";
  }else{
  echo "<br/>";
  if(trim($pres)=="")
  {
  echo "<img src=\"../images/notok.gif\" alt=\"X\"/>You must Specify a reson for punishing the user";
  }else{
  $timeto = $pds*24*60*60;
  $timeto += $phr*60*60;
  $timeto += $pmn*60;
  $timeto += $psc;
  $ptime = $timeto + time();
  $uip = getip_uid($who);
  $ubr = getbr_uid($who);
  $res = mysql_query("INSERT INTO ibwf_penalties SET uid='".$who."', penalty='2', exid='".getuid_sid($sid)."', timeto='".$ptime."', pnreas='".mysql_escape_string($pres)."', ipadd='".$uip."', browserm='".$ubr."'");
  if($res)
  {
  $pmsg[1]="Ip-banned";
  mysql_query("UPDATE ibwf_users SET lastpnreas='".$pmsg[1].": ".mysql_escape_string($pres)."' WHERE id='".$who."'");
  mysql_query("INSERT INTO ibwf_mlog SET action='ipbanned', details='<b>".getnick_uid(getuid_sid($sid))."</b> Ip-banned The user <b>".$user."</b> For ".gettimemsg($timeto)."', actdt='".time()."'");
  echo "<img src=\"../images/ok.gif\" alt=\"O\"/>$user ip-banned successfully";
  }else{
  echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Error ip-banning $user";
  }
  }
  echo "<br/><br/><b>8 </b><a accesskey=\"8\" href=\"index.php?action=viewuser&who=$who&sid=$sid\">$user's Profile</a><br/>";
  echo "<b>9 </b><a accesskey=\"9\" href=\"ownercp.php?action=ownercp&sid=$sid\"><img src=\"../images/admn.gif\" alt=\"\"/>Owner Tools</a><br/>";
  echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p>";
  }
  echo "</body>";
}
else if($action=="ban")
{
  $who = $_POST["who"];
  $pres = $_POST["pres"];
  $pds = $_POST["pds"];
  $phr = $_POST["phr"];
  $pmn = $_POST["pmn"];
  $psc = $_POST["psc"];
  $user = getnick_uid($who);
  echo "<head>";
  echo "<title>Owner Tools</title>";
  echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
  echo "</head>";
  echo "<body>";
  echo "<p align=\"center\">";
  $uid = getuid_sid($sid);
  $perm = mysql_fetch_array(mysql_query("SELECT perm FROM ibwf_users WHERE id='".$uid."'"));
  $trgtperm = mysql_fetch_array(mysql_query("SELECT perm FROM ibwf_users WHERE name='".$user."'"));

  if($trgtperm>$perm){ 
  echo "<b><img src=\"../images/notok.gif\" alt=\"x\"/><br/>Error!!!<br/>Permission Denied...</b><br/>";
  echo "<br/>U Cannot Ban $user<br/>";
  echo "<a href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p>";
  }else{
  echo "<br/>";
  if(trim($pres)=="")
  {
  echo "<img src=\"../images/notok.gif\" alt=\"X\"/>You must Specify a reson for punishing the user";
  }else{
  $timeto = $pds*24*60*60;
  $timeto += $phr*60*60;
  $timeto += $pmn*60;
  $timeto += $psc;
  $ptime = $timeto + time();
  $res = mysql_query("INSERT INTO ibwf_penalties SET uid='".$who."', penalty='1', exid='".getuid_sid($sid)."', timeto='".$ptime."', pnreas='".mysql_escape_string($pres)."', ipadd='', browserm=''");
  if($res)
  {
  $pmsg[1]="Banned";
  mysql_query("UPDATE ibwf_users SET lastpnreas='".$pmsg[1].": ".mysql_escape_string($pres)."' WHERE id='".$who."'");
  mysql_query("INSERT INTO ibwf_mlog SET action='banned', details='<b>".getnick_uid(getuid_sid($sid))."</b> Banned The user <b>".$user."</b> For ".gettimemsg($timeto)."', actdt='".time()."'");
  echo "<img src=\"../images/ok.gif\" alt=\"O\"/>$user banned successfully";
  }else{
  echo "<img src=\"../images/notok.gif\" alt=\"X\"/>Error banning $user";
  }
  }
  echo "<br/><br/><b>8 </b><a accesskey=\"8\" href=\"index.php?action=viewuser&who=$who&sid=$sid\">$user's Profile</a><br/>";
  echo "<b>9 </b><a accesskey=\"9\" href=\"ownercp.php?action=ownercp&sid=$sid\"><img src=\"../images/admn.gif\" alt=\"\"/>Owner Tools</a><br/>";
  echo "<b>0 </b><a accesskey=\"0\" href=\"index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
  echo "</p>";
  }
  echo "</body>";
}

if($trgtperm>$perm)

change it to if($trgtperm[0]>$perm[0])

godzilla Developer · 119 posts #3

i tried using ur code as u said but it is not working yet.

it is still banning other owner

godzilla Developer · 119 posts #4

i already posted above the all codings.

i want that codings in which other owner can't bann another owner.

when he try to bann another owner then he must get error like u cant bann other owner

godzilla Developer · 119 posts #5

so which code i put here so that u can see?

Anshul Senior · 296 posts #6

change this line

$perm = mysql_fetch_array(mysql_query("SELECT perm FROM ibwf_users WHERE id='".$uid."'"));
$trgtperm = mysql_fetch_array(mysql_query("SELECT perm FROM ibwf_users WHERE name='".$user."'")); 

to

$perm = mysql_fetch_row(mysql_query("SELECT perm FROM ibwf_users WHERE id='".getuid_sid($sid)."'"));
$trgtperm = mysql_fetch_row(mysql_query("SELECT perm FROM ibwf_users WHERE id='".$who."'"));

if($trgtperm[0] >= $perm[0])
{
echo"you cant ban";
break;
}
godzilla Developer · 119 posts #7

thank u bro it is working

$perm = mysql_fetch_row(mysql_query("SELECT perm FROM ibwf_users WHERE id='".getuid_sid($sid)."'")); 
$trgtperm = mysql_fetch_row(mysql_query("SELECT perm FROM ibwf_users WHERE id='".$who."'"));

  if($trgtperm[0] >= $perm[0]){ 
  echo "<b><img src=\"../images/notok.gif\" alt=\"x\"/><br/>Error!!!<br/>Permission Denied...</b><br/>";
  echo "<br/>U Cannot Ban $user<br/>";

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close