[ create a new paste ] login | about

Link: http://codepad.org/Kv9GS4CC    [ raw code | fork ]

chrisrasco - PHP, pasted on Oct 4:
<?php
$_COOKIE['user'] = 1;
$poster_id = 1;
$username = 'Chris';
if (isset($_GET['article_id'])) {

include("mySQLcon.inc.php");
$aid = (int)$_GET['article_id'];
$query = "SELECT * FROM front_articles WHERE id = ".$aid;
$sql = mysql_query($query);

}

while ($articles = mysql_fetch_object($sql)) {
?>
<div id="IApage">
<?php
echo '<b>' . $articles->title.'</b>'.'<br>'.
             $articles->message. '<br>';
?>
</div>
<?php
}
if(isset($_COOKIE['user'])){
?>
<div id="article_comment_form">
<form id="arti_com_form" name="article_com_for" method="post" action="article.php?article_id=<?php echo $aid; ?>">
    <textarea name="comment" rows="7" cols="50"></textarea><br>
    <input name="com_submit" type="submit" value="Comment"/>
</form>
</div>
<?php
}
if (isset($_POST['com_submit'])) {
    $comment_message = mysql_real_escape_string($_POST['comment']);
    $comment_query = mysql_query("INSERT INTO front_article_comments (article_id, poster_id, poster_username, message, date) VALUES (".$aid.", ".$poster_id.", '".$username."', '".$comment_message."', NOW())");
}
echo $aid;
?>


Create a new paste based on this one


Comments: