'PHP'에 해당되는 글 48건

  1. 2011.07.08 [PHP] - 로그아웃 소스
  2. 2011.07.07 [PHP] - 이미지 리스트 나머지 빈이미지 보여주기
  3. 2011.07.01 [PHP] - 한글 문자열 자르기( ex) 공지사항 오늘은... )
  4. 2011.06.30 [PHP] - PHP 프로그래밍중 한가지 팁!!! 2
  5. 2011.06.28 [PHP] - 유효성 날짜구하기
  6. 2011.06.28 [PHP] - Thumbnail 함수
  7. 2011.06.28 [PHP] - Sql 인젝션 공격 방어법
  8. 2011.06.28 [PHP] - Str_replace 함수 사용법

[PHP] - 로그아웃 소스

PHP 2011. 7. 8. 17:21
반응형
<?
  session_start();
  header("content-type:text/html; charset=utf-8");
  session_destroy();
 
  echo("
       <script language='javascript'>
           parent.location.href = '../index.html';
       </script>");
?>

반응형
:

[PHP] - 이미지 리스트 나머지 빈이미지 보여주기

PHP 2011. 7. 7. 12:07
반응형



<?
  while($row = mysql_fetch_array($result)) {
?>
    <td width="300" align="center" style="padding:1px 0;">
       보여지는 이미지
    </td>
<?
  $i = $i + 1;
      }
  $j = 5-($i-1)+1;
?>
<?for ($i=1;$i<$j;$i++) {?>
 <td width="300" align="center" style="padding:1px 0;">
     빈이미지
  </td>
<?}?>

  $j = 5-($i-1)+1;

여기서 숫자 5는 Limit 0, 5와 같다
반응형
:

[PHP] - 한글 문자열 자르기( ex) 공지사항 오늘은... )

PHP 2011. 7. 1. 17:10
반응형
mb_strcut(데이터컬럼명,0,25,'인코딩캐릭터셋')."...";

ex) mb_strcut($row["SUBJECT"],0,25,'utf-8')."...";
반응형
:

[PHP] - PHP 프로그래밍중 한가지 팁!!!

PHP 2011. 6. 30. 16:44
반응형

페이지 하단에

<?
    mysql_free_result($result);
    mysql_close($dbconn); 
?> 

꼭 해줍시다!!!!! 
반응형
:

[PHP] - 유효성 날짜구하기

PHP 2011. 6. 28. 18:47
반응형

[PHP] - 유효성 날짜구하기

$days_count = date(t,mktime(0,0,1,해당 월,1,해당년도)); 


반응형
:

[PHP] - Thumbnail 함수

PHP 2011. 6. 28. 18:13
반응형

[PHP] - Make ThumbNail

################ Thumb Nail ###################

function MakeThumb($file_path, $save_path, $width){

   

    $imginfo = getimagesize($file_path);

//print_r($imginfo);

 //$imginfo[2] = "2";

    if($imginfo[2] != 1 && $imginfo[2] != 2 && $imginfo[2] != 3){

        return "확장자가 jp(e)g/png/gif 가 아닙니다.";

    }

   

    if($imginfo[2] == 1)        $getfile = imagecreatefromgif($file_path);

    else if($imginfo[2] == 2)    $getfile = imagecreatefromjpeg($file_path);

    else if($imginfo[2] == 3)    $getfile = imagecreatefrompng($file_path);

   

    $height = ( $width / $imginfo[0] ) * $imginfo[1];

    $make_img = imagecreatetruecolor($width, $height);

    imagecopyresampled($make_img, $getfile, 0, 0, 0, 0, $width, $height, $imginfo[0], $imginfo[1]);

   

    if($imginfo[2] == 1)        imagegif($make_img, $save_path, 90);    // 1~100

    else if($imginfo[2] == 2)    imagejpeg($make_img, $save_path, 90); // 1~100

    else if($imginfo[2] == 3)    imagepng($make_img, $save_path, 9);  //  1~9

   

    imagedestroy($make_img);

    return true;

}

##### Call #####

   MakeThumb($dir.$real_filename, $thumb."thumb_".$real_filename, $width);

경로 + 파일명//


반응형
:

[PHP] - Sql 인젝션 공격 방어법

PHP 2011. 6. 28. 18:12
반응형

[PHP] - Sql 인젝션 공격 방어법

인젝션 공격 방어

#### View Page ####

 stripslashes($str);

#### Process Page ####

 mysql_real_escape_string($str);

반응형
:

[PHP] - Str_replace 함수 사용법

PHP 2011. 6. 28. 18:11
반응형

[PHP] - Str_replace 함수 사용법

 $loss_hp = str_replace("-","",$loss_hp);

 $loss_hp = str_replace("찾을문자열","치환할문자열","대상문자열");

반응형
: