connect = mysqli_connect($this -> Host , $this -> Username , $this -> Userpasswd, $this->Dbname); mysqli_query($this -> connect, "set name utf8"); //mysqli_set_charset($this -> connect, "utf8"); } function Close() { mysqli_close($this -> connect); } function popup_msg($msg) { echo(" "); exit; } function popup_msg_close($msg) { echo(" "); exit; } function popup_msg_location($msg,$url) { echo(" "); } function popup_nomsg_location($url) { echo(" "); } function Dbtool($query) { $this->result = mysqli_query($this->connect,$query); //return $this -> result; } function NextRecord() { $this -> Row = mysqli_fetch_assoc($this -> result); } function ResultValue($FieldVal,$Su) { for($j = 0 ; $j < sizeof($FieldVal) ; $j++) { $this->{$FieldVal[$j]} = mysqli_result($this->result,$Su,$FieldVal[$j]); //return $this->{$FieldVal[$j]}; } } } class Split_tool extends Dbconn { function fileopen($filename) { #파일을 연다. $this -> fp = fopen($filename,"r"); #파일의 크기를 구한다. $this -> size = filesize($filename); #파일의 크기만큼 파일을 읽어들인다. $this -> fpread = fread($this -> fp,$this -> size); #htm문서를 분활해서 배열로 저장{한글지원) #$this -> htm_class = split("",$this -> fpread); #htm문서를 분활해서 배열로 저장(영문만지원) $this -> htm_class = explode("<-->",$this -> fpread); fclose($this -> fp); } function StrConvert($HtmlParse,$Target) { while(list($key,$value) = each($Target)) { $pattern = "[".$key."]"; $HtmlParse = str_replace($pattern , $value , $HtmlParse); } print $HtmlParse; } function StrConvertMail($HtmlParse,$Target) { while(list($key,$value) = each($Target)) { $HtmlParse = preg_replace("\{".$key."\}" , $value , $HtmlParse); } return $HtmlParse; } //데이타베이스 쿼리문작성 function DatabaseSelectQuery($Fields,$Tables,$Joguns,$Sorts) { if(!$Joguns) { $query="SELECT ".$Fields." FROM ".$Tables." ".$Sorts.""; } else { $query="SELECT ".$Fields." FROM ".$Tables." WHERE ".$Joguns." ".$Sorts.""; } $this->Dbtool($query); //return $this->result; } function DatabaseInsertQuery($Fields1,$Fields2,$Tables) { $this->query="INSERT INTO ".$Tables."(".$Fields1.") VALUES (".$Fields2.")"; $this->Dbtool($this->query); } //상세정보나타내기 function Description($SelectField,$Tablename,$Jogun,$Field) { $this->query="select ".$SelectField." from ".$Tablename." ".$Jogun.""; $this->Dbtool($this->query); $this->NextRecord(); #셀렉트문에 들어가는 필드명 $this->ArrSelFd=explode(",",$SelectField); #해당 필드에 해당하는 필드이름 $this->ArrFd=explode(",",$Field); echo ""; echo ""; #해당 배열의 개수만큼 배열의 요소를 만든다. for($i=0;$iArrSelFd);$i++) { echo ""; echo ""; echo ""; echo ""; } echo "
".$this->ArrFd[$i]."".$this->Row[$this->ArrSelFd[$i]]."
"; } function UploadFileMethod($SavDir,$UploadFileName,$UploadFile) { $FileErrMsg = "선택하신 파일은 업로드가 금지되어 있습니다.\\n\\n보안상 html,htm,php,phtml,inc,pl,cgi,asp,bmp 파일은\\n\\n업로드를 금지하고 있으니 다른 파일을 선택해주세요.\\n\\n그리고 2메가 이상의 파일은 업로드 하실수 없습니다."; $this->filename = explode(".",$UploadFileName); $this->extention = $this->filename[sizeof($this->filename)-1]; if(!strcmp($this->extention,"php") || !strcmp($this->extention,"phtml") || !strcmp($this->extention,"pl") || !strcmp($this->extention,"cgi") || !strcmp($this->extention,"asp") || !strcmp($this->extention,"bmp") || !strcmp($this->extention,"php3")) { $this -> popup_msg("$FileErrMsg"); } $this->DirHandle = @opendir($SavDir); if(!$this->DirHandle) { if(!@mkdir($SavDir,0777)) { $this -> popup_msg("$SavDir 디렉토리 생성 실패"); } chmod($SavDir,0777); } $this->mend1 = explode(" ",microtime()); $UploadFileName = $this->mend1[1] . "_" . $UploadFileName; $this->FileCheck = $SavDir . "/" . $UploadFileName; $this->ImageFileName = $UploadFileName; if(file_exists($this->FileCheck)) { $this -> popup_msg("같은 이름의 파일이 존재합니다."); } if(!copy($UploadFile,$this->FileCheck)) { $this -> popup_msg("파일저장 실패"); } if(!@unlink($UploadFile)) { $this -> popup_msg("임시파일 삭제 실패"); } } } //한글 문자열 자르기 function str_cut($msg,$cut_size) { if($cut_size > strlen($msg)) return $msg; $ishan1=0; $ishan2=0; for ($i=0;$i127 && $ishan1==0) { $ishan2=0; $ishan1=1; } if($ishan2==1) $ishan1=0; if (($i+1)==$cut_size) { if ($ishan2!=1) break; $temp_str.=$msg[$i]; break; } $temp_str.=$msg[$i]; } $temp_str.="..."; return $temp_str; } /* $conn = New dbconn(DB호스트, DB사용자 계정, DB패스워드, 사용 DB명); $sql = "select * from test"; $data = $conn->fetch_array($sql); for ($i = 0; $i < count($data); $i++) { echo $data[$i]['컬럼명1']; echo $data[$i]['컬럼명2']; echo $data[$i]['컬럼명3']; } */ ?>