1 頁 (共 1 頁)

[緊急!問題] 關於預設權限問題(已解決)

發表於 : 2005-07-06 00:09
柚姬
●架設主機作業系統:Windows XP Home Edition SP2
●快速架站程式:Appserv 2.3.0
●您的上網方式:ADSL【和信超媒體
●您安裝的程式:Apache + php + MySql
●您的 phpBB2 版本:phpBB 2.0.16
●您的 domain(網域名稱) :zapto.org
●您的 phpBB2 連結網址: http://pcgc.zapto.org/phpbb2/
●錯誤情形:
為什麼只要會員一註冊,預設的權限就是系統管理員呢?
可不可以請大大姐救我一下,麻煩各位大大了!
若訊息不足我很樂意提供!真是不好意思!

發表於 : 2005-07-06 00:32
小竹子

發表於 : 2005-07-06 11:11
動機不明
到你的 phpBB 資料庫裡 (可利用 phpmyadmin)
找到\r

phpbb_users

再到\r

user_level

把預設值的 1 改為 0

1 是管理員\r
0 是一般會員

發表於 : 2005-07-06 11:54
柚姬
呃...
但是預設值原本就是0耶...
但註冊之後預設權限依舊是系統管理員\r
而且也無法設置版面管理員\r
是程式碼本身出問題嗎@@?~
如果要查看程式碼,請點選以下連結打包下載!

http://kaede.zapto.org/Pc/Phpbb2.zip

發表於 : 2005-07-06 23:54
動機不明
請問是什麼時候開始的?
在那之前做了什麼動作?
;-)

-----
我下載後看了一下 usercp_register.php 這個檔案
發現你有裝 性別&生日 外掛
所以可能是這裡出了問題,請仔細檢查吧 ;-)

第 654 行
$sql = "INSERT INTO " . USERS_TABLE . " (user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_sig_bbcode_uid, user_avatar, user_avatar_type, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify, user_notify_pm, user_popup_pm, user_timezone, user_dateformat, user_lang, user_style, user_gender, user_level, user_allow_pm, user_birthday, user_next_birthday_greeting, user_active, user_actkey)
第 655 行
VALUES ($user_id, '" . str_replace("\'", "''", $username) . "', " . time() . ", '" . str_replace("\'", "''", $new_password) . "', '" . str_replace("\'", "''", $email) . "', '" . str_replace("\'", "''", $icq) . "', '" . str_replace("\'", "''", $website) . "', '" . str_replace("\'", "''", $occupation) . "', '" . str_replace("\'", "''", $location) . "', '" . str_replace("\'", "''", $interests) . "', '" . str_replace("\'", "''", $signature) . "', '$signature_bbcode_uid', $avatar_sql, $viewemail, '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', '" . str_replace("\'", "''", $yim) . "', '" . str_replace("\'", "''", $msn) . "', $attachsig, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $popup_pm, $user_timezone, '" . str_replace("\'", "''", $user_dateformat) . "', '" . str_replace("\'", "''", $user_lang) . "', $user_style, 0, 1, '$gender', '$birthday', '$next_birthday_greeting', ";
第 655 行 '$gender' 的位置也不對了喔~ 調換一下吧! (真的不懂我再明講)

發表於 : 2005-07-07 00:47
~倉木麻衣~
剛才發現..birthday 1.5.7安裝文件在usercp_register.php也有問題
原文件內容

代碼: 選擇全部

#
#-----[ FIND ]------------------------------------------------
#
# NOTICE - IMPORTENT SECURITY RISK
#
# If you some how do not preform the following VERY carefully you have the
# potential to compromise your forum SECURITY, your users may easyly get ADMIN access if you make mistake
# meny users do make mistake in the step, so please be very exact, if this fail, then do not run your code on live forum
#
			$sql = "INSERT INTO " . USERS_TABLE . "

#
#-----[ IN-LINE FIND ]----------------------------------------
#
, user_active, user_actkey)

#
#-----[ IN-LINE BEFORE, ADD ]---------------------------------
#
, user_birthday, user_next_birthday_greeting

#
#-----[ FIND ]------------------------------------------------
#
	VALUES ($user_id,

#
#-----[ IN-LINE FIND ]----------------------------------------
#
, ";

#
#-----[ IN-LINE BEFORE, ADD ]---------------------------------
#
, '$birthday', '$next_birthday_greeting'
若真的照這樣子改, 則最後的SQL就會變成像這樣子
$sql = "INSERT INTO " . USERS_TABLE . " (..... , user_birthday, user_next_birthday_greeting, user_active, user_actkey)
VALUES (......., 0, 1, '$birthday', '$next_birthday_greeting', ";
欄位值對應錯誤

發表於 : 2005-07-07 01:14
柚姬
呃......
不大了解@@~
可不可以有修改範例或是更詳細的說明@@
真是不好意思麻煩您了!

發表於 : 2005-07-07 07:53
flower
您應該注意的是順序對應問題 用相同的顏色比對可能比較清楚

usercp_register.php
修正後 寫:$sql = "INSERT INTO " . USERS_TABLE . " (user_id, username, user_regdate, user_password, user_email, user_icq, user_website, user_occ, user_from, user_interests, user_sig, user_sig_bbcode_uid, user_avatar, user_avatar_type, user_viewemail, user_aim, user_yim, user_msnm, user_attachsig, user_allowsmile, user_allowhtml, user_allowbbcode, user_allow_viewonline, user_notify, user_notify_pm, user_popup_pm, user_timezone, user_dateformat, user_lang, user_style, user_level, user_allow_pm, user_gender, user_birthday, user_next_birthday_greeting, user_active, user_actkey)
修正後 寫:VALUES ($user_id, '" . str_replace("\'", "''", $username) . "', " . time() . ", '" . str_replace("\'", "''", $new_password) . "', '" . str_replace("\'", "''", $email) . "', '" . str_replace("\'", "''", $icq) . "', '" . str_replace("\'", "''", $website) . "', '" . str_replace("\'", "''", $occupation) . "', '" . str_replace("\'", "''", $location) . "', '" . str_replace("\\'", "''", $interests) . "', '" . str_replace("\'", "''", $signature) . "', '$signature_bbcode_uid', $avatar_sql, $viewemail, '" . str_replace("\'", "''", str_replace(' ', '+', $aim)) . "', '" . str_replace("\'", "''", $yim) . "', '" . str_replace("\'", "''", $msn) . "', $attachsig, $allowsmilies, $allowhtml, $allowbbcode, $allowviewonline, $notifyreply, $notifypm, $popup_pm, $user_timezone, '" . str_replace("\'", "''", $user_dateformat) . "', '" . str_replace("\'", "''", $user_lang) . "', $user_style, 0, 1, '$gender', '$birthday', '$next_birthday_greeting', ";
未改前的對應:
user_style <-> $user_style
user_gender <-> 0
user_level <-> 1 (註冊後都是管理員身份)
user_allow_pm <-> '$gender'
user_birthday <-> $birthday
user_next_birthday_greeting <-> $next_birthday_greeting

修正後的對應如下:
user_style <-> $user_style
user_level <-> 0 (註冊後才是一般會員)
user_allow_pm <-> 1
user_gender <-> $gender
user_birthday <-> $birthday
user_next_birthday_greeting <-> $next_birthday_greeting

發表於 : 2005-07-07 08:27
柚姬
喔喔@@~
我看懂了!原來是欄位對應錯了
所以輸入到資料庫的值也會對應錯...
user_level的資料自然也就會錯【對到1】
蠻糟糕的說~"~

謝謝各位大大!