Update of /cvsroot/comoblog/comoblog
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25808
Modified Files:
add_comment.php
Log Message:
RFE: 1280298 - Cookie's now store users name and email address when they enter a comment. Patched based off patch provided by Iamdecal
Index: add_comment.php
===================================================================
RCS file: /cvsroot/comoblog/comoblog/add_comment.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- add_comment.php 16 Aug 2005 05:49:43 -0000 1.1.1.1
+++ add_comment.php 4 Oct 2005 11:26:56 -0000 1.2
@@ -43,6 +43,13 @@
$comment = $form;
$comment = comment_add ($comment);
+
+ $cookie_period = 60*60*24*365;
+ $domain = parse_url(CFG_SITE_URL);
+ $domain = $domain['host'];
+ setcookie("comment-name", $form['comment_author'], time() + $cookie_period, "/", $domain, 0);
+ setcookie("comment-email", $form['comment_author_email'], time() + $cookie_period, "/", $domain, 0);
+
Header ("Location: list_comments.php?i=".$comment['post_id']);
exit();
}
@@ -60,6 +67,12 @@
$tpl->assign("ACTION", basename($_SERVER['PHP_SELF']));
+
+if (isset($_COOKIE['comment-name']))
+ $form['comment_author'] = $_COOKIE['comment-name'];
+if (isset($_COOKIE['comment-email']))
+ $form['comment_author_email'] = $_COOKIE['comment-email'];
+
$tpl->assign("FORM", $form);
@@ -69,4 +82,4 @@
// close db connection
mysql_close ();
-?>
\ No newline at end of file
+?>
|