本文整理汇总了PHP中post::add方法的典型用法代码示例。如果您正苦于以下问题:PHP post::add方法的具体用法?PHP post::add怎么用?PHP post::add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类post
的用法示例。
在下文中一共展示了post::add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: post
$dbh_post = new post();
$object_name = 'dbh_post';
require 'components/create_form_data.php';
extract($arr_form_data);
if ($_POST['btn_cancel']) {
log_action('Pressed cancel button', $_SERVER['PHP_SELF']);
redirect("listview_post.php?{$query_string}");
}
if ($_POST['btn_submit']) {
log_action('Pressed submit button', $_SERVER['PHP_SELF']);
$file_upload_control_name = 'attach_file';
require 'components/upload_generic.php';
$message .= $dbh_post->sanitize($arr_form_data)->lst_error;
extract($arr_form_data);
if ($dbh_post->check_uniqueness($arr_form_data)->is_unique) {
//Good, no duplicate in database
} else {
$message = "Record already exists with the same primary identifiers!";
}
if ($message == "") {
$dbh_post->add($arr_form_data);
redirect("listview_post.php?{$query_string}");
}
}
}
require 'subclasses/post_html.php';
$html = new post_html();
$html->draw_header('Add Post', $message, $message_type, TRUE, TRUE);
$html->draw_listview_referrer_info($filter_field_used, $filter_used, $page_from, $filter_sort_asc, $filter_sort_desc);
$html->draw_controls('add');
$html->draw_footer();
示例2: date
<?php
date_default_timezone_set("Asia/Manila");
$date = date('Y-m-d H:i:s');
if (isset($_POST['btnpost'])) {
include_once "post.php";
$param = array("postTitle" => $_POST["title"], "postDesc" => $_POST["desc"], "userID" => $_SESSION['id'], "topicID" => $_GET['topicid'], "datePosted" => $date, "postStatus" => 1, "postLevel" => $_SESSION['level']);
$query = new post();
$query->create("tblpost", $param);
}
if (isset($_POST['btntopic'])) {
include_once "topic.php";
$param = array("topicTitle" => $_POST["title"], "topicDesc" => $_POST["content"], "dateCreated" => $date, "forumCatID" => $_POST["cbocategory"], "topicStatus" => 1);
$query = new topic();
$query->create("tbltopic", $param);
}
if (isset($_POST['btnreply'])) {
include_once "post.php";
$param = array("replyContent" => $_POST["message"], "postID" => $_GET["postid"], "userID" => $_SESSION["id"], "datePosted" => $date, "replyLevel" => $_SESSION["level"], "replyStatus" => 1);
$query = new post();
$query->add("tblreply", $param);
}
示例3: post
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$user_id = $_SESSION['user_id'];
/*echo "<pre>";
print_r($_SESSION);
print_r($_POST);
print_r($_FILES); exit;*/
$post = new post();
$arrData = array();
$arrData['name'] = addslashes(ucwords($_POST['name']));
$arrData['details'] = addslashes($_POST['details']);
$arrData['status'] = addslashes($_POST['status']);
$arrData['category'] = addslashes($_POST['category']);
if (empty($_POST['id'])) {
$arrData['user_id'] = $user_id;
$arrData['added_date'] = date('Y-m-d H:i:s');
$insert = $post->add($arrData);
if ($insert) {
$cover = '';
if ($_FILES['image']['name'] != '') {
$cover = 'post_' . $insert . '.jpg';
saveResizeImage($_FILES['image'], $insert, 'post');
}
$_SESSION['insert_post'] = 'added';
} else {
$_SESSION['insert_post'] = 'insert_faild';
}
} else {
$arrData['id'] = $_POST['id'];
// $arrData['post'] = 'post_' . $_POST['id'] . '.jpg';
if ($_FILES['image']['name'] != '') {
$cover = 'post_' . $arrData['id'] . '.jpg';