ようこそ! このブログは、PHPとMysqlを使って作成したオリジナルプログラムを、QHMに読み込んで表示させています。

archives.php

FrontPage

archives.phpのソースコード

<?
//require('config.php');
require("MySmarty.class.php");
require('Settings.class.php');
require('Categories.class.php');
require('Topic.class.php');
require('Comment.class.php');
$topicid = $_GET['topicid'];
if( $topicid=='' ){ 
     $topicid = $_POST['topicid'];
}
if( $topicid=='' ){ 
     header("Location: index.php" );
     exit;
}
$smarty = new MySmarty();
$settings  = new Settings();
$categories  = new Categories();
$topic  = new Topic();
$com  = new Comment();
$settings->loadSettings();
 $set['maintitle'] = $settings->maintitle;
 $set['subtitle'] = $settings->subtitle;
 $set['maxtopics'] = $settings->maxtopics;
 $set['username'] = $settings->username;
 $set['passwd'] = $settings->passwd;
 $set['mailaddr'] = $settings->mailaddr;
$smarty->assign( "settings", $set );
 $topicv = $topic->getTopic( $topicid );
$smarty->assign( "topic", $topicv );
$template_name="archives.html";
if( $_POST['preview'] != '' ){
     $smarty->assign('comname', $_POST['comname']);
     $smarty->assign('mailaddr', $_POST['mailaddr']);
     $smarty->assign('title', $_POST['title']);
     $smarty->assign('body', $_POST['body']);
     $bodyf = $_POST['body'];
     $bodyf = ereg_replace( "\n","<br>", $bodyf );
     $bodyf = ereg_replace( "<br><br>","</p>\n<p>", $bodyf );
     $bodyf = '<p>' . $bodyf . '</p>';
      $smarty->assign('bodyf', $bodyf);
     $template_name="comment_prev.html";
}
if( $_POST['post'] != '' ){
//		$err_msg = check_input();
		$com->topicid = $_POST['topicid'];
		$com->comname = $_POST['comname'];
		$com->mailaddr = $_POST['mailaddr'];
		$com->title = $_POST['title'];
		$com->body = $_POST['body'];
		$com->saveComment();
		$err_msg = $com->errorm;
}
$smarty->assign( "prvtopicid", 0 );
$smarty->assign( "nxttopicid", 0 );
$comments = $com->getComments( $topicid );
$smarty->assign( "comments", $comments );
$smarty->assign( "err_msg", $err_msg );
$smarty->assign( "topicid", $topicid );
$smarty->display( $template_name );
?>

powered by Quick Homepage Maker 4.25
based on PukiWiki 1.4.7 License is GPL. QHM

最新の更新 RSS  Valid XHTML 1.0 Transitional