Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
[ADDON]CP Level Acces
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / v2.08 / v2 Only Mods Complete

Unknown User
2009-02-04 10:52:22
This mod allow you to give access levels to access the admin CP for your Groups.

Run this Query in PHPMyAdmin

ALTER TABLE `groups` ADD `cp_level` tinyint(3) unsigned NOT NULL default '0';





edit admincp.php



Find:



print("<td class=table_head>View CP</td>\n");





Add After:



//////////////////////Level controle by Nightmare////////////////////////////

print("<td class=table_head>CP Level Access</td>\n");

////////////////////////////////////////////////////////////////////////////





Find:



print("<td class=table_col2>".$level["control_panel"]."</td>\n");





Add After:



//////////////////Level control by Nightmare/////////////////////////////

 print("<td class=table_col2>".$level["cp_level"]."</td>\n");

/////////////////////////////////////////////////////////////////////////





Find:



<tr><td>Can View CP:</td><td>  <?php echo YES;?> <input type="radio" name="admincp" value="yes" <?php if ($level["control_panel"]=="yes") echo "checked" ?> />&nbsp;&nbsp; <?php echo NO;?> <input type="radio" name="admincp" value="no" <?php if ($level["control_panel"]=="no") echo "checked" ?> /></td></tr>





Add After:



<!----------------------------------------Access cp level by Nightmare--------------------------------------->

<tr><td>Acces Cp Level:</td><td><input type="text" name="cplevel" value="<?php echo $level["cp_level"];?>" size="5" /> <b>- 0 to 5 where 0 = Cant view nothing</b></td></tr>

<!----------------------------------------------------------------------------------------------------------->





Find:



$update[]="control_panel='".$_POST["admincp"]."'";





Add After:



$update[]="cp_level='".$_POST["cplevel"]."'";





Find:



$update[]="control_panel='".$level["control_panel"]."'";





Add After:



$update[]="cp_level='".$level["cplevel"]."'";





Now Edit your group and add a numeric value 0 to 5 (or whatever you want) where 0 is the lowest level.



How it work?



Find in admincp.php the part of code where all links are declared:



exemple:



<TR>

<td align="center"><a href=admincp.php?action=avatars><img src="images/admin/avatar.gif" border=0 width=32 height=32><br>Avatar Log</a><BR></td>

<td align="center"><a href=admincp.php?action=backups><img src="images/admin/database.png" border=0 width=32 height=32><br>Backups</a><BR></td>

<td align="center"><a href=admincp.php?action=bannedtorrents><img src="images/admin/bannedtorrents.gif" border=0 width=32 height=32><br>Banned Torrents</a><BR></td>

<td align="center"><a href=admincp.php?action=blocks&do=view><img src="images/admin/banners.gif" border=0 width=32 height=32><br>Blocks</a><BR></td>

<td align="center"><a href=admincp.php?action=cheats><img src="images/admin/blocked.gif" border=0 width=32 height=32><br>Detect Possible Cheaters</a><BR></td>

</tr>





Now we have to order this links by levels, so make lines with all your levels like this:



For 5 Levels:





if ($CURUSER["cp_level"] == 0) {

PUT HERE THE LINKS THAT THIS USER LEVEL CAN ACCESS, for exemple:



<td align="center"><a href=admincp.php?action=avatars><img src="images/admin/avatar.gif" border=0 width=32 height=32><br>Avatar Log</a><BR></td>

<td align="center"><a href=admincp.php?action=blocks&do=view><img src="images/admin/banners.gif" border=0 width=32 height=32><br>Blocks</a><BR></td>

}



if ($CURUSER["cp_level"] == 1) {

PUT HERE THE LINKS THAT THIS USER LEVEL CAN ACCESS, for exemple:

}



if ($CURUSER["cp_level"] == 2) {

PUT HERE THE LINKS THAT THIS USER LEVEL CAN ACCESS, for exemple:

}



if ($CURUSER["cp_level"] == 3) {

PUT HERE THE LINKS THAT THIS USER LEVEL CAN ACCESS, for exemple:

}



if ($CURUSER["cp_level"] == 4) {

PUT HERE THE LINKS THAT THIS USER LEVEL CAN ACCESS, for exemple:

}



if ($CURUSER["cp_level"] == 5) {

PUT HERE THE LINKS THAT THIS USER LEVEL CAN ACCESS, for exemple:

}
Unknown User
2009-02-04 10:59:17
fukin good work  :D
Unknown User
2009-02-04 12:44:21
nice work i will have to check this out. i have one question though. if the user lets say knows the link admincp.php?action=avatars then they can still access it by typing that into the address bar? the reason i ask is because i do like below

if ($action=="groups" && $do=="view"){

if ($CURUSER["class"] < "15"){

show_error_msg("Error","Sorry you do not have the rights to view this page!",1);

}


i put the restriction part at the mod. i will do a few test with yours and see if it is still possible to access the way i was saying.

edit i done a few test and yes the staff still can access it if they know the link which would not be hard to them to find out.
Unknown User
2009-02-04 13:26:09
In this case in the part of code you can put:

($CURUSER["cp_level"] == 4 || $CURUSER["cp_level"] == 3 ) {



CODE



}



else {

show_error_msg("Error","Sorry you do not have the rights to view this page!",1);

}


But no worry about classes :D
Unknown User
2009-02-04 20:29:28
when im making a new class says in block this

Unknown column 'cp_level' in 'field list'
Unknown User
2009-02-04 21:20:26
Oups i forget the SQL

ALTER TABLE `groups` ADD `cp_level` tinyint(3) unsigned NOT NULL default '0';


First post updated!!
Unknown User
2009-02-12 14:47:49
Sorry for probably stupid question, but this don't work

if ($CURUSER["cp_level"] == 0) {



<td align="center"><a href=admincp.php?action=avatars><img src="images/admin/avatar.gif" border=0 width=32 height=32><br>Avatar Log</a><BR></td>

<td align="center"><a href=admincp.php?action=blocks&do=view><img src="images/admin/banners.gif" border=0 width=32 height=32><br>Blocks</a><BR></td>

}
It is possible should look approximately so:


if ($CURUSER["cp_level"] == 0) {

?>

<TR>

<td align="center"><a href=admincp.php?action=avatars><img src="images/admin/avatar.gif" border=0 width=32 height=32><br>Avatar Log</a><BR></td>

<td align="center"><a href=admincp.php?action=blocks&do=view><img src="images/admin/banners.gif" border=0 width=32 height=32><br>Blocks</a><BR></td>

</tr>

<?}





if ($CURUSER["cp_level"] == 1) {

?>

<TR>

<td align="center"><a href=admincp.php?action=emailbans><img src="images/admin/mail.gif" border=0 width=32 height=32><br>Email Bans</a><BR></td>

<td align="center"><a href=faq-manage.php><img src="images/admin/faq.png" border=0 width=32 height=32><br>FAQ</a><BR></td>

</tr>

<?}


?????????

Can you please give an example of a real code?
Unknown User
2009-02-12 15:26:48
"Randy, post: 53696":
Sorry for probably stupid question, but this don't work



if ($CURUSER["cp_level"] == 0) {



<td align="center"><a href=admincp.php?action=avatars><img src="images/admin/avatar.gif" border=0 width=32 height=32><br>Avatar Log</a><BR></td>

<td align="center"><a href=admincp.php?action=blocks&do=view><img src="images/admin/banners.gif" border=0 width=32 height=32><br>Blocks</a><BR></td>

}
It is possible should look approximately so:


if ($CURUSER["cp_level"] == 0) {

?>

<TR>

<td align="center"><a href=admincp.php?action=avatars><img src="images/admin/avatar.gif" border=0 width=32 height=32><br>Avatar Log</a><BR></td>

<td align="center"><a href=admincp.php?action=blocks&do=view><img src="images/admin/banners.gif" border=0 width=32 height=32><br>Blocks</a><BR></td>

</tr>

<?}





if ($CURUSER["cp_level"] == 1) {

?>

<TR>

<td align="center"><a href=admincp.php?action=emailbans><img src="images/admin/mail.gif" border=0 width=32 height=32><br>Email Bans</a><BR></td>

<td align="center"><a href=faq-manage.php><img src="images/admin/faq.png" border=0 width=32 height=32><br>FAQ</a><BR></td>

</tr>

<?}


?????????

Can you please give an example of a real code?


the second way you have it is correct. nightmare just forgot to put the php open and close tags in there.
Unknown User
2012-01-16 02:34:43
i got everything in place in the right spot and i keep getting this error

Parse error: syntax error, unexpected $end in /home/tytorrents/public_html/admincp.php on line 4342
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 9
  • Members: 0
  • Guests online: 9
  • Comments: 3
  • Messages: 1,728