本館粉絲專頁

使用者:Kaoru/Kaoru's工作日誌/200512

分享此網頁到Facebook
分享此網頁到Plurk
分享此網頁到百度搜藏
分享此網頁到Twitter
分享此網頁到Del.icio.us
最近作者:Kaoru 2005年12月21日 (星期三)04:03
台灣棒球維基館
跳轉到: 導覽搜尋

目次

[編輯] 1212

[編輯] Wiki

  • 試著改程式紀錄使用者註冊日
  • 先去找SpecialUserlogin.php,找不到Insert的SQL,找到下面這個Function,覺得好像可以試試
	/**
	 * Actually add a user to the database.
	 * Give it a User object that has been initialised with a name.
	 *
	 * @param User $u
	 * @return User
	 * @access private
	 */
	function &initUser( &$u ) {
		$u->addToDatabase();
		$u->setPassword( $this->mPassword );
		$u->setEmail( $this->mEmail );
		$u->setRealName( $this->mRealName );
		$u->setToken();
		$u->setregDate($date("Y-m-d"));    →加了這句
	         $u->setregTime($date("H:i:s"));    →與這句...

		global $wgAuth;
		$wgAuth->initUser( $u );

		if ( $this->mRemember ) { $r = 1; }
		else { $r = 0; }
		$u->setOption( 'rememberpassword', $r );
		
		return $u;
	}
  • 結果:新增使用者後一面白,使用者有寫入,但user_touched、user_email兩欄位為空,日期寫入失敗。
  • 繼續試著找User.php程式測試,找到了有Insert的SQL碼
	/**
	 * Add user object to the database
	 */
	function addToDatabase() {
		$fname = 'User::addToDatabase';
		$dbw =& wfGetDB( DB_MASTER );
		$seqVal = $dbw->nextSequenceValue( 'user_user_id_seq' );
		$dbw->insert( 'user',
			array(
				'user_id' => $seqVal,
				'user_name' => $this->mName,
				'user_password' => $this->mPassword,
				'user_newpassword' => $this->mNewpassword,
				'user_email' => $this->mEmail,
				'user_real_name' => $this->mRealName,
				'user_options' => $this->encodeOptions(),
				'user_token' => $this->mToken,
				'user_regDate' => $date("Y-m-d"),         →加了這句
				'user_regTime' => $date("H:i:s")          →與這句...
			), $fname
		);
		$this->mId = $dbw->insertId();
		$dbw->insert( 'user_rights',
			array(
				'ur_user' => $this->mId,
				'ur_rights' => implode( ',', $this->mRights )
			), $fname
		);
	}
  • 結果:整個站都一面白,無法創建使用者。
  • 心得:我跟php真的很不熟T_T,連裝熟都...唉...
Line1.gif

[編輯] NDAP

  • 增加瀏覽計數器。

[編輯] 1213

[編輯] NDAP

→ 目前可以依歸屬度排序,依日期排序就會TimeOut,=_=;;;
  • 撰寫SearchLog檔,後端寫入資料表Searchlog,紀錄使用者IP。測試頁面
→ 因為檢索程式是JSP,試著寫JSP可怎改都有錯誤T_T,所以還是改寫ASP版,目前已OK,可以紀錄,但轉向JSP失敗。檢索紀錄
→ 可能要與新版ASP程式一起上線吧。*汗*

[編輯] 1220

[編輯] NDAP