1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | <? /** * uploadok.php * ------------ * Author: Han Sanghun (http://hangunsworld.com, hanguns@gmail.com) * Kim Eung (http://eung.co.kr/) * Release Version: 1.0.0 * Date Started: 2007/04/01 * Last Modified: 2008/01/04 * * Determines the name of the saved file. * If "newName" is provided, then uses "newName" as the file's name. * Otherwise, uses the original filename("Filedata.name") as the filename. * * If the original name of the file contains 2-byte characters (e.g. Korean characters), IO error occurs. * To avoid this, use "newName" parameter defined in Flash, rather than the "Filedata.name". * It is possible to assigns a new name in PHP code explicitly. */ $newName = trim($_REQUEST["newName"]); if($newName == ""){ // If newName is not defined, uses Filedata.name as the filename. $newName = $HTTP_POST_FILES['Filedata']['name']; } // Creates "images" folder, if not exist. if(!is_dir("./images")){ mkdir("./images",0777); } // Sets the path in which the uploaded image to be stored. $folderPath = $_SERVER['DOCUMENT_ROOT']."/test/images/"; $newPath = $folderPath.$newName; // Moves the temporary file. @move_uploaded_file($HTTP_POST_FILES['Filedata']['tmp_name'], $newPath); // Returns the saved file path. echo "/test/images/".$newName; ?> |
- 접근을 제한하려는 폴더를 생성합니다. (예 admin)
- 텍스트 파일을 만들어 다음 내용을 입력하고, .htaccess라는 이름으로 저장합니다.
AuthName “사용자 인증”
AuthType Basic
AuthUserFile /wwwroot/admin/.htpasswd
AuthGroupFile /dev/null
ErrorDocument 401
require valid-userAuthUserFile의 경로는 서버 설정에 따라 다를 수 있으므로, 웹호스팅 업체에 문의하세요.
- 저장된 .htaccess 파일을 서버의 admin 폴더로 업로드 시킵니다.
- 이제, 텔넷으로 서버에 접속하여 admin 폴더로 이동합니다.
- 다음의 명령어를 사용하여 .htpasswd 파일을 생성합니다.
htpasswd -c .htpasswd 원하는아이디
서버 설정에 따라, 에러가 발생할 수 있습니다. 이 경우에도 호스팅 업체에 문의하면 해결해 주더군요.
- 비밀번호와 비밀번호 확인, 2번에 걸쳐 비밀번호를 입력합니다.
- 이제 브라우저에서 홈페이지의 해당 폴더로 접속하면, 아이디와 비밀번호를 입력해야만 해당 폴더와 부속 페이지들에 접근할 수 있게 됩니다.
5, 6번을 반복하여, 여러 명의 사용자를 추가할 수도 있습니다.
이렇게 폴더에 대한 접근을 제한함으로서, 중요한 정보가 들어 있는 페이지들을 보호할 수 있습니다.
핫링킹이란 다른 사람의 서버상에 있는 이미지, 스크립트 및 미디어 등의 파일을 허락없이 자신의 홈페이지에 직접 링크를 걸어 사용하는 것으로, 다른 사람의 대역폭(bandwidth)를 훔치는 것으로도 말할 수 있습니다.
(해당 파일의 복사본을 만들어 자신의 서버에 올려서 사용하는 것은 핫링킹에 해당하지 않습니다. 단, 저작권에 대한 문제는 별개죠.)
.htaccess 파일을 수정하면 이런 핫링킹을 방지할 수 있다네요.
sa 비밀번호를 변경하려면
1 어드민 계정으로 윈도우에 로그인
2 SQL 서버를 실행하고 윈도우 인증을 통해서 로그인
3 새로운 쿼리 윈도우를 열고 다음 내용을 입력
sp_password @new = ‘new_password’, @loginame = ‘sa’
4 Security > Logins > sa 더블클릭 또는 프로퍼티 선택
5 Status로 이동해서 Login이 비활성되어 있는경우 활성화합니다.
Recent Comments