codepad
[
create a new paste
]
login
|
about
Language:
C
C++
D
Haskell
Lua
OCaml
PHP
Perl
Plain Text
Python
Ruby
Scheme
Tcl
<?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; ?>
Private
[
?
]
Run code
Submit