diff --git a/application/admin/controllers/DataController.php b/application/admin/controllers/DataController.php index 9e881ed6..eabafd47 100755 --- a/application/admin/controllers/DataController.php +++ b/application/admin/controllers/DataController.php @@ -605,11 +605,14 @@ class Admin_DataController extends Zend_Controller_Action { $user = $auth->getIdentity(); $uid = $user->id; + $email = $user->email; } - $sql = "INSERT INTO comments (uuid,author,reply,userid,content) VALUES (?,?,?,?,?)"; + $ipaddr = $_SERVER['REMOTE_ADDR']; + + $sql = "INSERT INTO comments (uuid,author,reply,userid,content,email,ip) VALUES (?,?,?,?,?,?,?)"; $sth = $this->db->prepare($sql); - $rs = $sth->execute(array($uuid,$user->username,$reply,$uid,$body)); + $rs = $sth->execute(array($uuid,$user->username,$reply,$uid,$body,$email,$ipaddr)); if($rs) { @@ -2932,7 +2935,6 @@ class Admin_DataController extends Zend_Controller_Action return $row; } - /* * 保存XML数据到数据库 */ @@ -2954,4 +2956,3 @@ class Admin_DataController extends Zend_Controller_Action return true; }//jsonexit() 退出并返回json数据 } - diff --git a/application/default/controllers/AuthorController.php b/application/default/controllers/AuthorController.php index 858b4e17..a960c3a5 100644 --- a/application/default/controllers/AuthorController.php +++ b/application/default/controllers/AuthorController.php @@ -1148,6 +1148,7 @@ class AuthorController extends Zend_Controller_Action { $user = $auth->getIdentity(); $uid = $user->id; + $email = $user->email; } $sql = "SELECT md.title,c.id,c.author,c.email,c.url,c.ts_created,c.content FROM comments c @@ -1166,9 +1167,11 @@ class AuthorController extends Zend_Controller_Action return true; } - $sql = "INSERT INTO comments (uuid,author,reply,userid,content) VALUES (?,?,?,?,?)"; + $ipaddr = $_SERVER['REMOTE_ADDR']; + + $sql = "INSERT INTO comments (uuid,author,reply,userid,content,email,ip) VALUES (?,?,?,?,?,?,?)"; $sth = $this->db->prepare($sql); - $rs = $sth->execute(array($uuid,$user->username,$reply,$uid,$body)); + $rs = $sth->execute(array($uuid,$user->username,$reply,$uid,$body,$email,$ipaddr)); if($rs) {