728x90
반응형
728x90
반응형

IIS PHP 메일발송

$sendMailServer = "localhost"; 
$senderMail = "blackberry@mprd.co.kr"; 
$senderName = "Webmaster";

ini_set("SMTP",$sendMailServer ); 
ini_set(sendmail_from,$senderMail);   //php.ini 설정 필요



php.ini

SMTP
SENDMAIL 부분을 수정하고 이렇게 쓰면 메일이 갑니다~잘가요~

이미지 파일 속성

getimagesize

[0] => 68
[1] => 100
[2] => 2
[3] => width="68" height="100"
[bits] => 8
[channels] => 3
[mime] => image/jpeg

등의 정보가 나온다.

파일 업로드 용량 설정

Maximum allowed size for uploaded files.
upload_max_filesize = 10M

php.ini 파일에서 설정을 변경한다.
10M는 서버에 과부하를 줄 수 있으니 소스상에서 적당히 조절하자!!

iframe내 쿠키생성/유지 문제

@header(P3P: CP="NOI CURa ADMa DEVa TAIa OUR DELa BUS IND PHY ONL UNI COM NAV INT DEM PRE");

iframe내에서 쿠키 생성이 제한되어 있을때
맨위에 써주면 해결

MY-SQL connection

<?
$mysql_host = localhost;
$mysql_user = 유저이름;
$mysql_password = 비밀번호;
$mysql_db = db명;
function my_connect($host,$id,$pass,$db)
{
 $connect=mysql_connect($host,$id,$pass);
 mysql_select_db($db);
 return $connect;
}

$connect = my_connect($mysql_host,$mysql_user,$mysql_password,$mysql_db);
?>
728x90
반응형

'back-end > ASP & PHP' 카테고리의 다른 글

[PHP] 유용한 코드1  (0) 2023.06.19
[ASP] 버블소트  (0) 2023.06.19
[ASP] 글자수 제한 .... 붙여리턴  (0) 2023.06.19
[ASP] 날짜/주/월 더한 날 구하기  (0) 2023.06.19
[ASP] 랜덤값 생성  (0) 2023.06.19
728x90
반응형

폴더내 파일 검색

$dir = $_SERVER[DOCUMENT_ROOT]."/upload/";

$files = scandir($dir);

foreach($files as $i => $value) {

  if (substr($value, 0, 1) == .) {
    unset($files[$i]);
  }
}

메일발송

<?
header("Content-Type: text/html; charset=utf-8");
function mailto($MAIL_FROM_NAME,$MAIL_FROM,$MAIL_TO,$MAIL_SUBJ,$body)
{
    $mailheaders = "Return-Path: <$MAIL_FROM> \r\n";
    $mailheaders .= "From: =?utf-8?B?".base64_encode($MAIL_FROM_NAME)."?=  <{$MAIL_FROM}>\r\n";
    $mailheaders .= "X-Mailer: JOYNET Interface\r\n";

    $boundary = "--------" . uniqid("part");

    $mailheaders .= "MIME-Version: 1.0\r\n";
    $mailheaders .= "Content-Type: multipart/alternative; boundary=\"=_NextPart_$boundary\"";

    $bodytext  = "This is a multi-part message in MIME format.\r\n\r\n";
    $bodytext .= "--=_NextPart_$boundary\r\n";
    $bodytext .= "Content-Type: text/plain; charset=utf-8\r\n";
    $bodytext .= "Content-Transfer-Encoding: base64\r\n\r\n";
    $bodytext .= ereg_replace("(.{80})","\\1\r\n",base64_encode(strip_tags($body))) . "\r\n\r\n";

    $bodytext .= "--=_NextPart_$boundary\r\n";
    $bodytext .= "Content-Type: text/html; charset=utf-8\r\n";
    $bodytext .= "Content-Transfer-Encoding: base64\r\n\r\n";

    $bodytext .= ereg_replace("(.{80})","\\1\r\n",base64_encode(stripslashes($body)));
    $bodytext .= "\r\n\r\n--=_NextPart_$boundary--\r\n";
    $result = mail($MAIL_TO, =?utf-8?B? . base64_encode($MAIL_SUBJ) . ?=,$bodytext,$mailheaders);

    return $result;
}


$from_name = "ts";
$from = "eldkqhdl@ts.co.kr";
$to = "eldkqhdl@naver.com";
$subject = "이건 될려나?";
$body = "대충 내용 들어가는칸";

if(mailto($from_name, $from, $to, $subject, $body)) {
 echo "<script type=text/javascript>alert(발송성공);location.href=index.php;</script>";
} else {
 echo "<script type=text/javascript>alert(발송실패);location.href=index.php;</script>";
}
?>

$HTTP_POST_FILES 와 $_FILES 설정

$HTTP_POST_FILES =& $_FILES;

or

$_FILES =& $HTTP_POST_FILES;

=& 의 기호는 우측의 내용을 좌측에 포함한다는 뜻

php가 4.1 버전을 기준으로 이상은 $_FILES 를 사용하고

이하는 $HTTP_POST_FILES 를 사용한다.

부득이하게 사용해야 할 경우 소스와 같은 형태를 취해주면

어떤 모양이든 사용 가능!!

엑셀로 출력하기

<?php
$titledate("Ymd")." 리스트";
header("Content-type: application/vnd.ms-excel");
header("Content-Disposition: attachment; filename".$title.".xls");
header("Content-Description : PHP4 Generated Data ");
?>

php용 페이지 엑셀출력
제일 상단에 적용함.

728x90
반응형

'back-end > ASP & PHP' 카테고리의 다른 글

[PHP] 유용한 코드2  (0) 2023.06.19
[ASP] 버블소트  (0) 2023.06.19
[ASP] 글자수 제한 .... 붙여리턴  (0) 2023.06.19
[ASP] 날짜/주/월 더한 날 구하기  (0) 2023.06.19
[ASP] 랜덤값 생성  (0) 2023.06.19
728x90
반응형
  for i = 0 to UBound(CMT)
        for j = i+1 to UBound(CMT)
         response.write CMT(i) &"보다" &CMT(j) &"가 크다면  swap <br/>"

     if (CMT(i) > CMT(j)) then 
        call swap(i, j)    
     end if
        next
    next


 function swap(i, j)
     valor_1_antigo = CMT(i)
     valor_2_antigo = CMT(j)

     CMT(i) = valor_2_antigo
     CMT(j) = valor_1_antigo

     valor_1_antigo = id(i)
     valor_2_antigo = id(j)

     id(i) = valor_2_antigo
     id(j) = valor_1_antigo

     valor_1_antigo = title(i)
     valor_2_antigo = title(j)

     title(i) = valor_2_antigo
     title(j) = valor_1_antigo


 end Function
728x90
반응형

'back-end > ASP & PHP' 카테고리의 다른 글

[PHP] 유용한 코드2  (0) 2023.06.19
[PHP] 유용한 코드1  (0) 2023.06.19
[ASP] 글자수 제한 .... 붙여리턴  (0) 2023.06.19
[ASP] 날짜/주/월 더한 날 구하기  (0) 2023.06.19
[ASP] 랜덤값 생성  (0) 2023.06.19
728x90
반응형
function stringCut(strMsg,n)


  if len(strMsg)>n then 
   StringCut=Left(strMsg,n)&"..."
  else 
   StringCut=strMsg
  end if

 end Function
728x90
반응형

'back-end > ASP & PHP' 카테고리의 다른 글

[PHP] 유용한 코드2  (0) 2023.06.19
[PHP] 유용한 코드1  (0) 2023.06.19
[ASP] 버블소트  (0) 2023.06.19
[ASP] 날짜/주/월 더한 날 구하기  (0) 2023.06.19
[ASP] 랜덤값 생성  (0) 2023.06.19
728x90
반응형
Function TransAddDay(sdate, is_day)
 If isnull(is_day) or Not isnumeric(is_day) or len(is_day) < 1 Then
  is_day = 0
 End if

 TransEndDate = DATEADD("d",is_day, sdate)
End Function

Function TransAddWeek(sdate, is_day)
 If isnull(is_day) or Not isnumeric(is_day) or len(is_day) < 1 Then
  is_day = 0
 End if

 TransEndDate = DATEADD("w",is_day, sdate)
End Function


Function TransAddMonth(sdate, is_day)
 If isnull(is_day) or Not isnumeric(is_day) or len(is_day) < 1 Then
  is_day = 0
 End if

 TransEndDate = DATEADD("m",is_day, sdate)
End Function
728x90
반응형

'back-end > ASP & PHP' 카테고리의 다른 글

[PHP] 유용한 코드2  (0) 2023.06.19
[PHP] 유용한 코드1  (0) 2023.06.19
[ASP] 버블소트  (0) 2023.06.19
[ASP] 글자수 제한 .... 붙여리턴  (0) 2023.06.19
[ASP] 랜덤값 생성  (0) 2023.06.19
728x90
반응형
dim str,newPw
str = "abcdefghijklmnopqlsntuvwyxz0123456789"
Randomize
for i = 1 to 10 :: 글자수
r = int((36-1+1)*Rnd +1 )
newPw = newPw&mid(str,r,1)
next
for i 0 to 10 > 만들 글자수를 적어줌
728x90
반응형

'back-end > ASP & PHP' 카테고리의 다른 글

[PHP] 유용한 코드2  (0) 2023.06.19
[PHP] 유용한 코드1  (0) 2023.06.19
[ASP] 버블소트  (0) 2023.06.19
[ASP] 글자수 제한 .... 붙여리턴  (0) 2023.06.19
[ASP] 날짜/주/월 더한 날 구하기  (0) 2023.06.19

+ Recent posts

728x90
반응형