show code js

2010年11月20日 星期六

PHP取得使用者ip

在php中要取得瀏覽者的ip可以使用下述方式進行取得

$user = new user();
$user->userip();
$user->user_ip; // 取得ip

當瀏覽者正在觀看你的網站時,ip位置主要由SERVER全區域變數中的(未使用proxy)REMOTE_ADDR(字串)及(使用proxy)HTTP_X_FORWARDED_FOR(陣列,連入方式由0至最未到達之ip)存放,可使用判別後取出即可

class user
{ public function userip()
{
if( empty($_SERVER['HTTP_X_FORWARDED_FOR']) )
{
$this->user_ip = $_SERVER['REMOTE_ADDR'];
}
else
{
$user_ip = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
$this->user_ip = $user_ip[0];
}
return $this->user_ip;
}
}

phpmyadmin

  • 至官方網站下載套件 phpmyadmin.net
  • 下載後解壓縮並移至web root下,建議改為較易記名稱如 phpmyadmin
  • 開啟瀏覽器 輸入 http://localhost/phpmyadmin/ 後即可輸入帳號(root)、密碼登入
  • 訊息:若出現 mcrypt模組未載入,請開啟php.ini將php_mcrypt.dll模組載入即可
  • 訊息: 若出現 設定檔案現在需要密碼 (passphrase) (blowfish_secret)

  1. 請將phpmyadmin目錄下的config.sample.ini.php改為config.ini.php
  2. 開啟config.ini.php後修改 $cfg['blowfish_secret'] 後設為你 phpmyadmin 入口網址
  3. 修改 $cfg['Servers'][$i]['auth_type'] 後為 http 即可

  • 另外若本機有啟動mysqli模組可將 $cfg['Servers'][$i]['extension'] 後修改為 mysqli
  • 訊息: 若出現 Your PHP MySQL library version 5.0.19 differs from your MySQL server version 6.0.9. This may cause unpredictable behavior.則為php 的mysql lib函式,尚未支援此mysql的版本,有可能會發生不預期的問題,通常裝mysql6的都會有這個訊息

沒有聲音

檢查項目
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\AudioSrv]
"DependOnService"=hex(7):50,00,6c,00,75,00,67,00,50,00,6c,00,61,00,79,00,00,00,\
52,00,70,00,63,00,53,00,73,00,00,00,00,00
"Description"="管理基于 Windows 的程序的音频设备。如果此服务被终止,音频设备及其音效将不能正常工作。如果此服务被禁用,任何依赖它的服务将无法启动。"
"DisplayName"="Windows Audio"
"ErrorControl"=dword:00000001
"Group"="AudioGroup"
"ImagePath"=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,\
74,00,25,00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,73,\
00,76,00,63,00,68,00,6f,00,73,00,74,00,2e,00,65,00,78,00,65,00,20,00,2d,00,\
6b,00,20,00,6e,00,65,00,74,00,73,00,76,00,63,00,73,00,00,00
"ObjectName"="LocalSystem"
"Start"=dword:00000002
"Type"=dword:00000020

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\AudioSrv\Parameters]
"ServiceDll"=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,\
00,74,00,25,00,5c,00,53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,\
61,00,75,00,64,00,69,00,6f,00,73,00,72,00,76,00,2e,00,64,00,6c,00,6c,00,00,\
00
"ServiceDllUnloadOnStop"=dword:00000001

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\AudioSrv\Enum]
"0"="Root\\LEGACY_AUDIOSRV\\0000"
"Count"=dword:00000001
"NextInstance"=dword:00000001

入侵處理重點

  • 查看執行序,把可疑程式關閉
  • 查看事件檢事器,列出IP
  • 清理帳戶、重設權限及密碼
  • 開啟防火牆、重設例外、PORT及規則
  • 檢查安全性原則,配置帳戶原則(防猜、密碼複雜度)、清除入侵原則及設置封IP原則
  • 清除不明軟體、系統資料夾、個人文件夾、清理COOKIE、暫存目錄
  • 其他帳戶清理、權限及密碼重設
  • 關閉及清理不明服務
  • 開啟工作管理器員,停止所有(背景)程式運作,查看CPU使用率是否一直無法降至0
  • 開啟「我的電腦」點選功能列的「工具」的「資料夾選項」,點選「檢視」標籤,將「隱藏已知檔案類型的副檔名」與「隱藏保護的作業系統檔案(建議使用)」都取消鉤選,在「隱藏檔案和資料夾」選擇「顯示所有檔案與資料夾」,點選「套用」再點選確「確定」,然後看看各磁碟機槽及路徑%WINDIR%及路徑%WINDIR%\system32下是否有異常檔案
  • 建置硬體防火牆、配置VPN+防火牆
  • 密碼原則使用英文字母、數字及特殊字元混合並達8碼以上組成
  • 查看工作管理員及系統目錄檔案
  • 並強化密碼混合及複雜度

2010年11月6日 星期六

SQL Server 2008 Develop Edition in W7X64PRO

1.run setup
2.click [new installation or add features to an existing installation] and [ok]
3.keyin [product key] and [next]
4.checkbox [i accept the license terms] and [next]
5.click [install]
6.problem scan [performance counter registry hive consistency] see http://support.microsoft.com/kb/300956
a.run regedit and goto [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Perflib\]
b.[009] use [export] to 009.reg
c.[0404] rename to [0404-1]
d.open 009.reg and modify [009] to [0404], double-click 009.reg after save and close
e.[re-run]
f.if you haven`t installed [sql server 2005 express tools] or remove before click [next]
7.[setup role] click [next]
8.[feature selection] click [select all] and [next]
9.[installation rules] click [next]
10.[instance configuration] select [default instance] or not and click [next]
11.[disk space requirements] click [next]
12.[server configuration] settting [account name(use system) / password] click [next]
13.[database engine configuration] select [mixed mode ...] and setting [password], [add current user] before click [next]
14.[analysis services configuration] click [add current user] before click [next]
15.[reporting services configuration] select [install the native mode default configuration] click [next]
16.[error reporting] click [next]
17.[installation configuration rules] click [next]
18.[ready to install] click [next]
19.[installation progress] click [close]
20.install service pack sp2 x64 and x86