적수보드 ->제로보드 디비 컨버트
페이지 정보
작성자 MintState 댓글 0건 조회 14,051회 작성일 08-11-03 10:19본문
적수보드 ->제로보드 디비 컨버트
이미 있을지도 모르지만 제가 못찾아서 삽질을 해보았습니다.
하나의 디비에 두개의 테이블이 있어야 합니다.
free(적수보드) -> nfree(제로보드) 변환 입니다.
대충 만들었습니다. 적당한 부분수정해주세요.
http://localhost/convert_nalabi.php 하세요
소스 -------------------->
이미 있을지도 모르지만 제가 못찾아서 삽질을 해보았습니다.
하나의 디비에 두개의 테이블이 있어야 합니다.
free(적수보드) -> nfree(제로보드) 변환 입니다.
대충 만들었습니다. 적당한 부분수정해주세요.
http://localhost/convert_nalabi.php 하세요
소스 -------------------->
<?
#require "config.php";
// Configuration Variables; // 수정 요망
$host = "localhost";
$user = "root";
$passwd = "";
$db = "nalabi";
// zero board name
$id = "nfree"; // 아래 URL에 맞도록 수정해주세요
// db connection
$connect = @mysql_connect( $host, $user, $passwd ) or die( "db connection error!" );
@mysql_select_db( $db, $connect ) or die( "db selection error!");
$head_no = 0;
$total = 0;
// 적수 보드 테이블을 쿼리 한다.
$query = "SELECT * FROM free ORDER BY idx asc";
$query_result = mysql_query( $query );
print "no, num, idx, date, host, name, passwd, email, url, title, refer, reyn, reno, rede, reto, html, moder<br>";
while($hash = mysql_fetch_array( $query_result ))
{
$ListNumber = $total;
$prev_no = $ListNumber + 1 + 1;
$next_no = $ListNumber + 1 - 1;
$headnum = -$ListNumber;
// 적수 보드의 내용을 가져온다.
//print "$hash[no], $hash[num], $hash[idx], $hash[date], $hash[host], $hash[name], $hash[passwd], $hash[email], $hash[url], $hash[title], $hash[refer], $hash[reyn], $hash[reno], $hash[rede], $hash[reto], $hash[html], $hash[moder]<br>";
// 특수문자 변환, '
$title_string=eregi_replace("'","'", $hash[title]);
if($title_string) print "$title_string<br>";
else $title_string = $hash[title];
$text_string=eregi_replace("'","'", $hash[text]);
if($text_string) print "aaaa<br>";
else $title_string = $hash[title];
// 제로보드에 추가한다.
$query = "insert into zetyx_board_$id (headnum, prev_no, next_no, memo,ip, name,homepage,email,subject,use_html,hit,reg_date,depth) values ($headnum, $prev_no, $next_no, '$text_string','$hash[host]','$hash[name]','$hash[url]','$hash[email]','$title_string','1','$hash[refer]','$hash[date]','$hash[rede]' )";
//print $query."<br><br><br>";
//mysql_query( $query ) or die("Invalid query: <br><br>" . mysql_error());
mysql_query( $query );
//print "$ListNumber, $hash[name], $hash[reyn], $hash[reno], $hash[reto]<br>";
$total = $total + 1;
}
// update headnum
$query = "select headnum from zetyx_board_$id where no='1'";
$query_result = mysql_query( $query );
$temp = mysql_fetch_array( $query_result );
$head_offset = -$temp[0] - 1;
$query = "update zetyx_board_$id set headnum = headnum + $head_offset";
mysql_query( $query );
// update total articles
$query = "update zetyx_admin_table set total_article='$total' where name='$id'";
mysql_query( $query );
// update division
$query = "update zetyx_division_$id set num='$total' where no='1'";
mysql_query( $query );
?>|
|
댓글목록
등록된 댓글이 없습니다.





적수보드 ->제로보드 디비 컨버트