原作:ckm
http://phpbb-tw.net/phpbb/viewtopic.php?t=10823
代碼: 選擇全部
############################################################## ## MOD Title: Restrict Memberlist / Usergroup Pages ## MOD Author: Flipper <Flipper@pogoworld.co.uk> http://php.pogoworld.co.uk ## MOD Description: Allows only registered users view Memberlist and/or Usergroups pages. ## MOD Version: 1.0.0 ## ## Installation Level: Easy ## Installation Time: 2 Minutes ## Files To Edit: memberlist.php, groupcp.php ## Included Files: n/a ############################################################## ## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the ## latest version of this MOD. Downloading this MOD from other sites could cause malicious code ## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered ## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/ ############################################################## ## Author Notes: If a user is not logged in and they wish to view the memberlist and/or Usergroup pages they will simply be redirected to the login page. If log in is successful, they will be redirected back to Memberlist and/or Usergroup pages. Instructions are given on how to apply this mod to both Memberlist and Usergroups, however you can install it to just the Memberlist or Grouplist page if you wish. ############################################################## ## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD ############################################################## # #-----[ OPEN ]------------------------------------------ # memberlist.php # #-----[ FIND ]------------------------------------------ # // // End session management // # #-----[ AFTER, ADD ]------------------------------------------ # // Begin 'Restrict Memberlist/Grouplist' MOD if ( !$userdata['session_logged_in'] ) { $header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: "; header($header_location . append_sid("login.$phpEx?redirect=memberlist.php", true)); exit; } // End 'Restrict Memberlist/Grouplist' MOD #-----[ OPEN ]------------------------------------------ # groupcp.php # #-----[ FIND ]------------------------------------------ # // // End session management // # #-----[ AFTER, ADD ]------------------------------------------ # // Begin 'Restrict Memberlist/Grouplist' MOD if ( !$userdata['session_logged_in'] ) { $header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: "; header($header_location . append_sid("login.$phpEx?redirect=groupcp.php", true)); exit; } // End 'Restrict Memberlist/Grouplist' MOD # #-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ # # EoM