본문 바로가기

전체 글933

PHP 파일 다운로드 $speed = 8.5; // 8,5 kb/s 비율로 다운로드를 받는다. $file=$DOCUMENT_ROOT.$file; if(file_exists($file) && is_file($file)) { header("Cache-control: private"); header("Content-Type: audio/mp3"); header("Content-Length: ".filesize($file)); header("Content-Disposition: filename={$filename}"); flush(); $fp = fopen($file, "r"); while(!feof($fp)) { echo fread($fp, round($speed*1024)); flush(); sleep(1); } fclose (.. 2008. 10. 18.
PHP POST 전송된 첨부파일 확장자 확인 하기 $s_ext=substr($s_name,strrpos($s_name,".")+1); 2008. 10. 18.
PHP W3C P3P 규약설정 // W3C P3P 규약설정 @header ("P3P : CP=\"ALL CURa ADMa DEVa TAIa OUR BUS IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE LOC OTC\""); IE6 부터... 바뀐 쿠키 설정에 따른 설정법 2008. 10. 18.
PHP FTP로 파일 업로드 $ftp_server='kkk.net';//serverip $conn_id = @ftp_connect($ftp_server); // login with username and password $user="kkk"; $passwd="aaa"; $login_result = @ftp_login($conn_id, $user, $passwd); //directorylike /www.velibaba.com/images @ftp_chdir($conn_id, "public_html/report_files"); // upload the file $upload = @ftp_put($conn_id, $filename, $file, FTP_BINARY); // close the FTP stream @ftp_close($con.. 2008. 10. 18.
PHP 간단한... ip 접근 금지 체크 2008. 10. 18.
PHP 플래시 연동 PHP 와 플래시가 값을 주고 받기 테그 on (release) { getURL("javascript-x:void(open('http://sss.co.kr/sss.php?concern="+concern+"','popup','width=280,height=150'))"); } on (release) { getURL("javascript-x:void(alert('오른쪽 소스보기를 클릭해주세요'))"); } 2008. 10. 18.
PHP registart 값 off 후 파일 업로드 @extract($HTTP_SESSION_VARS); @extract($HTTP_COOKIE_VARS); @extract($HTTP_SERVER_VARS); @extract($HTTP_GET_VARS); @extract($HTTP_POST_VARS); @extract($HTTP_ENV_VARS); if($_FILES['file']['name']){ $AllowExt='/\.alz|\.txt|\.psd|\.xls|\.gz|\.zip|\.bmp|\.doc|\.exe|\.dat|\.gif|\.htm?|\.hwp|\.pdf|\.ppt|\.rar|\.jp?g|\.tif|\.png/i'; $rename=date("YmdHis"); $saveDir="$DOCUMENT_ROOT/report_files/".date("Y.. 2008. 10. 18.
PHP registart 값 off 후 세션 에러 php 4.3.4에서 session_start()를 써도 저런 메세지가 나지 않던데요. 물론 에러리포팅은 다 켜 놓았구요. session_register 대신에 $_SESSION['이름'] ="값"; 을 써 보세요. 아마 이것 때문엔거 같은데, 자세한건 저도 잘 모르겠습니다. Warning: Unknown(): Your script-x possibly relies on a session side-effect which existed until PHP 4.2.3. Please be advised that the session extension does not consider global variables as a source of data, unless register_globals is enabled. .. 2008. 10. 18.
PHP mailto() header 값 정의 $xMailer="PHP/".phpversion(); $headers="MIME-Version: 1.0\r\n"; $headers.="Content-Type:text/html;charset=EUC-KR \n"; $headers.="Content-type: text/html; charset=iso-8859-1\r\n"; $headers.="Content-type: text/html; charset=ks_c_5601-1987\r\n"; $headers.="From: $from_name \r\n"; $headers.="Reply-To: \r\n"; $headers.="X-Mailer : $xMailer \n"; 2008. 10. 18.
PHP register_global=Off 상태 라도 변수 먹히게 PHP 소스 상단에 다음과 같이 선언해주면 php.ini에 register_global = OFF 상태여도 POST전송시 변수값이 전송 됩니다. 웹소스를 코딩시 서버 설정을 손대지 못할 경우 유용하게 사용하실 수 있을겁니다. @error_reporting(E_ALL ^ E_NOTICE); @extract($HTTP_GET_VARS); @extract($HTTP_POST_VARS); @extract($HTTP_SERVER_VARS); @extract($HTTP_ENV_VARS); @extract($HTTP_SESSION_VARS); @extract($_FILES); 2008. 10. 18.
PHP 파일 업로드시 권한 설정 if(!is_dir($saveDir)) { $oldumask = umask(0); mkdir($saveDir, 0777); // or even 01777 so you get the sticky bit set umask($oldumask); } 이때... umask란 file이 생성될 때 사용할 file의 권한에 대해 mask를 인코딩하는 system 변수이다. 보통 3자리로 표현이 되며 각각의 자리는 user, group, other의 권한을 나타낸다. umake의 값은 3자리의 8진수의 값이며 각각의 값은 1,2,4의 값은 AND 연산한 결과이다. 0 : 사용자에게 모든 권한을 혀용. 4 : 사용자에게 읽기 권한은 주지 않음. 2 : 사용자에게 쓰기 권한을 주지 않음. 1 : 사용자에게 실행 권한을 주.. 2008. 10. 18.
PHP mktime - 달력 관련 현재달의 1일이 몇번재 요일인지 숫자로 뽑기 blank = date("w",mktime(0,0,0,$month,1,$year)); 해당달의 마지막날 allday = date("t",mktime(0,0,0,$month,1,$year)); 2008. 10. 18.