function initialize_page() { $post_action = ""; if (isset($_POST['submit'])) { $post_action = $_POST['submit']; } if ($post_action == "Add New List") { $success = ''; $list = MyActiveRecord::Create('NLLists'); $list->display_name = $_POST['name']; $list->name = slug($_POST['name']); $list->template = $_POST['template']; $list->description = $_POST['description']; $list->public = $_POST['public']; $list->save(); $success .= "Mailing List Created"; $emails = explode(",", str_replace(" ", "", $_POST['emails'])); if (is_array($emails)) { $count = 0; foreach ($emails as $email) { if (!$list->emailLinked($email) && is_validemail($email)) { // Check for an existing match in the system $newAddy = NLEmails::FindByEmail($email); if (!isset($newAddy) and !is_object($newAddy)) { $newAddy = MyActiveRecord::Create('NLEmails'); $newAddy->email = $email; $newAddy->save(); $count++; } // Existing or not, attach that email to this List $query = "INSERT INTO nlemails_nllists VALUES ({$newAddy->id}, {$list->id});"; if (!mysql_query($query, MyActiveRecord::Connection())) { die($query); } } } if ($count > 0) { $success .= " / Emails Added to {$list->display_name}"; } else { $success .= " / All Emails Added or Invalid"; } } setFlash("<h3>" . $success . "</h3>"); } }
<?php require_once 'conn.php'; date_default_timezone_set('Asia/Chongqing'); $name = $_POST['name']; $name = clean($name); $mail = $_POST['mail']; $mail = clean($mail); $id = $_POST['id']; $id = clean($id); $content = $_POST['content']; $content = clean($content); $time = date('Y-m-d'); if (is_validemail($mail) == 1 && $name) { $sql = "insert into comment(aid,name,mail,content,time) values ('{$id}','{$name}','{$mail}','{$content}','{$time}')"; // echo $sql; $re = mysqli_query($link, $sql); //执行sql语句 //echo $re; if ($re) { // 更新评论数目 $sql = "select * from article where id={$id}"; $com = mysqli_query($link, $sql); foreach ($com as $row) { $comnum = $row['comments'] + 1; $sql = "update article set comments ='{$comnum}' where id ={$id}"; mysqli_query($link, $sql); } echo "<script>alert('感谢您的评论!');</script>"; echo "<script>location.href='../pages/article-pages.php?id=" . $id . "';</script>"; } else {