The following PHP code is the code to save an image, which is uploaded using FileReference or is encoded using ByteArray in a Flash movie. The uploadok.php file can handle all the files, uploaded using FileReference, ByteArray or a file form in an HTML document.
다음 코드는 플래시에서 FileReference를 사용한 업로드 또는 ByteArray로 인코딩된 파일을 저장하기 위한 PHP 코드입니다. 이 uploadok.php 파일 하나로 플래시의 FileReference, ByteArray는 물론 HTML문서의 파일 양식을 통한 업로드도 모두 처리가 가능합니다.
Sorry, Japanese translation is not yet available.
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;
?>
Special thanks to Kim Eung. He devised the draft of the PHP and AS3 codes. Furthermore, he allowed me to open them to the public.
이 PHP와 AS3 코드의 기틀을 만들고, 이 소스를 공개하는데 흔쾌히 동의하신, 김응 실장님에게 진심으로 감사드립니다.
 
  1. 접근을 제한하려는 폴더를 생성합니다. (예 admin)
  2. 텍스트 파일을 만들어 다음 내용을 입력하고, .htaccess라는 이름으로 저장합니다.

    AuthName “사용자 인증”
    AuthType Basic
    AuthUserFile /wwwroot/admin/.htpasswd
    AuthGroupFile /dev/null
    ErrorDocument 401
    require valid-user

    AuthUserFile의 경로는 서버 설정에 따라 다를 수 있으므로, 웹호스팅 업체에 문의하세요.

  3. 저장된 .htaccess 파일을 서버의 admin 폴더로 업로드 시킵니다.
  4. 이제, 텔넷으로 서버에 접속하여 admin 폴더로 이동합니다.
  5. 다음의 명령어를 사용하여 .htpasswd 파일을 생성합니다.

    htpasswd -c .htpasswd 원하는아이디

    서버 설정에 따라, 에러가 발생할 수 있습니다. 이 경우에도 호스팅 업체에 문의하면 해결해 주더군요.

  6. 비밀번호와 비밀번호 확인, 2번에 걸쳐 비밀번호를 입력합니다.
  7. 이제 브라우저에서 홈페이지의 해당 폴더로 접속하면, 아이디와 비밀번호를 입력해야만 해당 폴더와 부속 페이지들에 접근할 수 있게 됩니다.

5, 6번을 반복하여, 여러 명의 사용자를 추가할 수도 있습니다.
이렇게 폴더에 대한 접근을 제한함으로서, 중요한 정보가 들어 있는 페이지들을 보호할 수 있습니다.

 

Comprehensive guide to .htaccess

 

핫링킹이란 다른 사람의 서버상에 있는 이미지, 스크립트 및 미디어 등의 파일을 허락없이 자신의 홈페이지에 직접 링크를 걸어 사용하는 것으로, 다른 사람의 대역폭(bandwidth)를 훔치는 것으로도 말할 수 있습니다.
(해당 파일의 복사본을 만들어 자신의 서버에 올려서 사용하는 것은 핫링킹에 해당하지 않습니다. 단, 저작권에 대한 문제는 별개죠.)

.htaccess 파일을 수정하면 이런 핫링킹을 방지할 수 있다네요.

Brajeshwar | Prevent HotLinking with .htaccess

 

sa 비밀번호를 변경하려면
1 어드민 계정으로 윈도우에 로그인
2 SQL 서버를 실행하고 윈도우 인증을 통해서 로그인
3 새로운 쿼리 윈도우를 열고 다음 내용을 입력
sp_password @new = ‘new_password’, @loginame = ‘sa’
4 Security > Logins > sa 더블클릭 또는 프로퍼티 선택
5 Status로 이동해서 Login이 비활성되어 있는경우 활성화합니다.

출처: Media Division Developer’ Blog

© 2011 Hangun's World - Blog Suffusion theme by Sayontan Sinha