1 頁 (共 1 頁)

[問題]關於教學文件庫的[教學]禁止訪客的權限(之二)

發表於 : 2004-11-30 18:45
leifmc
就是這一篇

關於這一段\r
jiminkao 寫:1. 會員資料
打開 profile.php
找到

代碼: 選擇全部

    if ( $mode == 'viewprofile' )
   { 
換成

代碼: 選擇全部

       if ( !$userdata['session_logged_in'] && $mode == 'viewprofile' )
      {
         redirect(append_sid("login.$phpEx?redirect=profile.$phpEx&mode=viewprofile", true));
      } 
我照著做的話\r
會出現
錯誤代碼 寫:Parse error: parse error, unexpected '}' in /home/dotedqyf/public_html/phpbb/profile.php on line 131
於是我把換成哪邊的程式碼最後的}刪掉...
雖然不會出現錯誤但是卻還是無法看會員資料...

最後我把

代碼: 選擇全部

	if ( $mode == 'viewprofile' )
	{
		include($phpbb_root_path . 'includes/usercp_viewprofile.'.$phpEx);
		exit;
	}
整個替換為\r

代碼: 選擇全部

       if ( !$userdata['session_logged_in'] && $mode == 'viewprofile' )
      {
         redirect(append_sid("login.$phpEx?redirect=profile.$phpEx&mode=viewprofile", true));
      } 
就可以正常使用了...
不知道這樣是不是正確的呢? :?:

我是使用在竹貓首頁公告的phpBB2.011版
小竹子 寫:2004/11/19 UPDATE(更新)
>>phpBB2.011+正體中文按鈕+正體中文語系<<

發表於 : 2004-11-30 22:45
shihchieh
沒錯,你這樣的修改是正確的
上述的修改會造成if判斷式多了一個}而造成程式錯誤

發表於 : 2004-12-01 01:01
leifmc
嗯嗯...感謝你唷... :mrgreen:

發表於 : 2004-12-02 01:54
leifmc
唉阿~之前哪個修改還是有問題...
會造成無法進入個人資料的樣子...
我又稍微更改了一下大概是這樣...

原本\r

代碼: 選擇全部

	if ( $mode == 'viewprofile' )
	{
		include($phpbb_root_path . 'includes/usercp_viewprofile.'.$phpEx);
		exit;
	}
替換為\r

代碼: 選擇全部

    if ( $mode == 'viewprofile' )
	{
	  if ( !$userdata['session_logged_in'] )
      {
         redirect(append_sid("login.$phpEx?redirect=profile.$phpEx&mode=viewprofile", true));
      } 
		include($phpbb_root_path . 'includes/usercp_viewprofile.'.$phpEx);
		exit;
	}
所以教學文件庫哪應該不是換成...
而是在此之後加入吧... :roll:
若有錯誤還請各位前輩多多指教
謝謝...