예제 #1
0
<?php

require 'db.inc.php';
require 'output_functions.inc.php';
include 'header.inc.php';
$db = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD) or die('Unable to connect. Check your connection parameters.');
mysql_select_db(MYSQL_DB, $db) or die(mysql_error($db));
$article_id = isset($_GET['article_id']) && ctype_digit($_GET['article_id']) ? $_GET['article_id'] : '';
output_story($db, $article_id);
?>
<h3>Add a comment</h3>
<form method="POST" action="transact_article.php">
	<div>
		<label for="comment_text">Comment:</label><br />
		<textarea id="comment_text" name="comment_text" rows="10" cols="60"></textarea><br />
		<input type="submit" name="action" value="Submit Comment" />
		<input type="hidden" name="article_id" value="<?php 
echo $article_id;
?>
" />
	</div>
</form>
<?php 
show_comments($db, $article_id, FALSE);
include 'footer.inc.php';
예제 #2
0
파일: search.php 프로젝트: ratanparai/enter
<?php

require 'db.inc.php';
require 'output_functions.inc.php';
$db = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD) or die('Unable to connect. Check your connetion parameters.');
mysql_select_db(MYSQL_DB, $db) or die(mysql_error($db));
include 'header.inc.php';
$search = isset($_GET['search']) ? $_GET['search'] : '';
$sql = 'SELECT
		article_id
	FROM
		cms_articles
	WHERE
		MATCH (title, article_text) AGAINST ("' . mysql_real_escape_string($search, $db) . '" IN BOOLEAN MODE)';
$result = mysql_query($sql, $db) or die(mysql_error($db));
if (mysql_num_rows($result) == 0) {
    echo '<p><strong>No articles found that match the search terms.</strong></p>';
} else {
    while ($row = mysql_fetch_assoc($result)) {
        output_story($db, $row['article_id'], TRUE);
    }
}
mysql_free_result($result);
include 'footer.inc.php';
예제 #3
0
파일: index.php 프로젝트: ratanparai/enter
<?php

require 'db.inc.php';
require 'output_functions.inc.php';
$db = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD) or die('Unable to connect. Check your connection parameters.');
mysql_select_db(MYSQL_DB, $db) or die(mysql_error($db));
include 'header.inc.php';
$sql = 'SELECT
		article_id
	FROM
		cms_articles
	WHERE
		is_published = TRUE
	ORDER BY
		publish_date DESC';
$result = mysql_query($sql, $db) or die(mysql_error($db));
if (mysql_num_rows($result) == 0) {
    echo '<p><strong>There are currently no articles to view.</strong></p>';
} else {
    while ($row = mysql_fetch_assoc($result)) {
        output_story($db, $row[article_id], TRUE);
    }
}
mysql_free_result($result);
include 'footer.inc.php';
예제 #4
0
<?php

require 'db.inc.php';
require 'output_functions.inc.php';
$db = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD) or die('Unable to connect. Check your connection parameters.');
mysql_select_db(MYSQL_DB, $db) or die(mysql_error($db));
include 'header.inc.php';
output_story($db, $_GET['article_id']);
show_comments($db, $_GET['article_id'], TRUE);
include 'footer.inc.php';