ChatGPT 테스트 해보았습니다. > 자유게시판

자유게시판

ChatGPT 테스트 해보았습니다. 정보

ChatGPT 테스트 해보았습니다.

본문

먼저, 그누보드기반으로 sitemap 을 만들어 달라고 해보았습니다.

 

입력 : gnuboard5 sitemap generate php code

생성된 코드 


// Connect to the database and get the list of boards
$db = new mysqli('localhost', 'username', 'password', 'database_name');
$result = $db->query('SELECT * FROM g5_board');
// Create a new XML document
$sitemap = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" />');
// Add the homepage URL
$url = $sitemap->addChild('url');
$url->addChild('loc', 'http://example.com/');
$url->addChild('lastmod', date('Y-m-d'));
$url->addChild('changefreq', 'daily');
$url->addChild('priority', '1.0');
// Add the board URLs
while ($row = $result->fetch_assoc()) {
  $url = $sitemap->addChild('url');
  $url->addChild('loc', 'http://example.com/bbs/board.php?bo_table=' . $row['bo_table']);
  $url->addChild('lastmod', date('Y-m-d', strtotime($row['bo_last_date'])));
  $url->addChild('changefreq', 'daily');
  $url->addChild('priority', '0.8');
}
// Close the database connection
$db->close();
// Output the XML document
Header('Content-type: text/xml');
print($sitemap->asXML());

 

도메인이 example.com 이네요.. mydomain.com 으로 만들어야 겠습니다.

입력 : gnuboard5 sitemap generate php code. base url is https://mydomain.com

생성코드


<?php
// Connect to the database and get the list of boards
$db = new mysqli('localhost', 'username', 'password', 'database_name');
$result = $db->query('SELECT * FROM g5_board');
// Create a new XML document
$sitemap = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" />');
// Add the homepage URL
$url = $sitemap->addChild('url');
$url->addChild('loc', 'https://mydomain.com/');
$url->addChild('lastmod', date('Y-m-d'));
$url->addChild('changefreq', 'daily');
$url->addChild('priority', '1.0');
// Add the board URLs
while ($row = $result->fetch_assoc()) {
  $url = $sitemap->addChild('url');
  $url->addChild('loc', 'https://mydomain.com/bbs/board.php?bo_table=' . $row['bo_table']);
  $url->addChild('lastmod', date('Y-m-d', strtotime($row['bo_last_date'])));
  $url->addChild('changefreq', 'daily');
  $url->addChild('priority', '0.8');
}
// Close the database connection
$db->close();
// Output the XML document
Header('Content-type: text/xml');
print($sitemap->asXML());
?>

 

영어를 대충 나열해도 찰떡같이 알아먹고, 제대로 된 코드를 만들어줍니다.

공지사항이랑 이벤트 게시판은 사이트맵에서 제외 해달라고 해봅니다.

 

입력 : gnuboard5 sitemap generate php code. base url is https://mydomain.com. exclude notice, event bo_tables

알아들은 말 : To generate a sitemap for a Gnuboard 5 website using PHP with a base URL of https://mydomain.com and excluding the notice and event board tables, you can use the SimpleXMLElement class to create an XML document and add elements to it. Here's an example of how you can do this:

 

생성 코드


<?php
// Connect to the database and get the list of boards
$db = new mysqli('localhost', 'username', 'password', 'database_name');
$result = $db->query("SELECT * FROM g5_board WHERE bo_table NOT IN ('notice', 'event')");
// Create a new XML document
$sitemap = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" />');
// Add the homepage URL
$url = $sitemap->addChild('url');
$url->addChild('loc', 'https://mydomain.com/');
$url->addChild('lastmod', date('Y-m-d'));
$url->addChild('changefreq', 'daily');
$url->addChild('priority', '1.0');
// Add the board URLs
while ($row = $result->fetch_assoc()) {
  $url = $sitemap->addChild('url');
  $url->addChild('loc', 'https://mydomain.com/bbs/board.php?bo_table=' . $row['bo_table']);
  $url->addChild('lastmod', date('Y-m-d', strtotime($row['bo_last_date'])));
  $url->addChild('changefreq', 'daily');
  $url->addChild('priority', '0.8');
}
// Close the database connection
$db->close();
// Output the XML document
Header('Content-type: text/xml');
print($sitemap->asXML());
?>

 

db 쿼리 함수가 그누보드 함수가 아니네요.. 그누보드용 함수를 쓰라고 써줍니다.

입력 : gnuboard5 sitemap generate php code. base url is https://mydomain.com. exclude notice, event bo_tables. use gnuboard5 db function sql_query(), sql_fetch()

 

결과 코드


<?php
// Connect to the database and get the list of boards
include_once('../common.php');
$result = sql_query("SELECT * FROM g5_board WHERE bo_table NOT IN ('notice', 'event')");
// Create a new XML document
$sitemap = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" />');
// Add the homepage URL
$url = $sitemap->addChild('url');
$url->addChild('loc', 'https://mydomain.com/');
$url->addChild('lastmod', date('Y-m-d'));
$url->addChild('changefreq', 'daily');
$url->addChild('priority', '1.0');
// Add the board URLs
while ($row = sql_fetch_array($result)) {
  $url = $sitemap->addChild('url');
  $url->addChild('loc', 'https://mydomain.com/bbs/board.php?bo_table=' . $row['bo_table']);
  $url->addChild('lastmod', date('Y-m-d', strtotime($row['bo_last_date'])));
  $url->addChild('changefreq', 'daily');
  $url->addChild('priority', '0.8');
}
// Output the XML document
Header('Content-type: text/xml');
print($sitemap->asXML());
?>
 

 

 

이정도면 저보다 코딩 잘하는것 같습니다. 일단 속도가 더 빠르고, 오타가 거의 없습니다.

 

자바스크립트도 해보았는데, 바로 쓸 수 있을 정도의 퀄리티 코드를 뽑아줍니다.

 

세상이 바뀌고 있네요.. 새로운 세상에 적응을 해야 할것 같습니다.

 

 

 

 

최종코드 스샷

1846433120_1671485379.3107.png

 

 

 

 

추천
0

댓글 2개

https://openai.com/ 에서 현재 가입후 무료 사용이 가능합니다.
추후에 유료화 되겠지만, 현재는 무료로 이용 가능합니다.
전체 199,648 |RSS
자유게시판 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT