本文整理汇总了PHP中CRUD::dataInsert方法的典型用法代码示例。如果您正苦于以下问题:PHP CRUD::dataInsert方法的具体用法?PHP CRUD::dataInsert怎么用?PHP CRUD::dataInsert使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRUD
的用法示例。
在下文中一共展示了CRUD::dataInsert方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: subject_replace
private static function subject_replace()
{
if (is_array($_POST['id'])) {
foreach ($_POST['id'] as $key => $ID) {
$newArgs = array('subject' => $_POST['subject'][$key], 'sort' => $_POST['sort'][$key], 'email' => $_POST['email'][$key], 'id' => $ID);
CRUD::dataUpdate('contact_subject', $newArgs);
if (!empty(DB::$error)) {
break;
}
}
$msg = self::$lang["modify_done"];
} else {
CHECK::is_must($_POST['subject']);
if (CHECK::is_pass()) {
CRUD::dataInsert('contact_subject', $_POST, true);
$msg = self::$lang["modify_done"];
} else {
$msg = self::$lang["no_args"];
}
}
if (!empty(DB::$error)) {
$msg = DB::$error;
}
CORE::msg($msg, CORE::$manage . 'contact/subject/');
}
示例2: add
public static function add($tb_name, $id, array $args)
{
if (!empty($args["filename"])) {
$args["filename"] = self::filename_check(false, $args["filename"]);
}
CRUD::dataInsert('seo', $args);
$seo_id = DB::get_id();
DB::update(CORE::$prefix . "_" . $tb_name, array('seo_id' => $seo_id, 'id' => $id));
}
示例3: add
private static function add($m_id = false)
{
$recaptcha = self::recaptcha();
CHECK::is_must($_POST["name"], $_POST["tel"], $_POST["content"]);
CHECK::is_email($_POST["email"]);
if ($recaptcha && CHECK::is_pass()) {
$args = array('m_id' => !empty($m_id) ? $m_id : "null", 'content' => htmlspecialchars($_POST["content"], ENT_NOQUOTES));
$args = array_merge($_POST, $args);
CRUD::dataInsert('contact', $args);
if (!empty(DB::$error)) {
$msg = DB::$error;
} else {
foreach ($_POST as $field => $var) {
switch ($field) {
case "subject":
$subjectmail = self::subjectFetch($var, 'email');
$var = self::subjectFetch($var, 'subject');
break;
case "gender":
$var = empty($var) ? CORE::$lang["female"] : CORE::$lang["male"];
break;
}
VIEW::assignGlobal('VALUE_' . strtoupper($field), $var);
}
$msg = CORE::$lang["submit_done"];
$mail_temp = 'ogs-mail-contact-tpl.html';
# 信件樣板
new VIEW($mail_temp, false, true, false);
$fromMail = !empty($subjectmail) ? $subjectmail : SYSTEM::$setting["email"];
CORE::mail_handle($_POST["email"], $fromMail, VIEW::$output, CORE::$lang["contact_mail"], SYSTEM::$setting["name"]);
# 寄出認證信
$rs = true;
}
} else {
$msg = CHECK::$alert;
if (empty($recaptcha)) {
$msg = '請勾選驗證';
}
CRUD::args_output();
}
if ($rs) {
RESPONSE::register($_POST, CORE::$root . 'contact/thankyou/');
exit;
} else {
CORE::msg($msg, CORE::$root . 'contact/');
}
}
示例4: replace
private static function replace()
{
CHECK::is_email($_POST["email"]);
CHECK::is_must($_POST["callback"]);
if (CHECK::is_pass()) {
$systemExist = CRUD::dataFetch('system', array('id' => '1'));
$args = array_merge($_POST, array('id' => '1'));
if ($systemExist) {
CRUD::dataUpdate('system', $args);
} else {
CRUD::dataInsert('system', $args);
}
if (!empty(DB::$error)) {
$msg = array(DB::$error, CORE::$manage . 'system/');
} else {
$msg = array(self::$lang["modify_done"], CORE::$manage . 'system/');
}
} else {
$msg = array(CHECK::$alert, CORE::$manage . 'system/');
}
CORE::msg($msg);
}
示例5: finish
private static function finish()
{
self::car();
#$account_check = CRUD::dataFetch('member',array('account' => $_POST["account"]));
CHECK::is_must($_POST["name"], $_POST["tel"], $_POST["cell"], $_POST["add_name"], $_POST["add_tel"], $_POST["add_address"]);
if (!empty($_POST["first"])) {
# 未登入
/*
CHECK::is_email($_POST["account"]);
CHECK::is_password($_POST["password"]);
CHECK::is_same($_POST["password"],$_POST["match_password"]);
$pass = CHECK::is_pass();
if($pass && empty($account_check)){
$new_member_rs = self::new_member();
}else{
CORE::msg(CORE::$lang["account_exist"].'或'.CORE::$lang["args_error"],CORE::$root);
}
*/
} else {
# 已登入
$pass = CHECK::is_pass();
}
if ($pass) {
$serial = self::new_serial();
#$email = (empty($_POST["first"]))?$_POST["email"]:$_POST["account"];
$email = $_POST["email"];
$name = $_POST["name"];
$order = array('m_id' => self::$id, 'serial' => $serial, 'status' => !empty($_POST["first"]) ? 11 : 0, 'createdate' => date("Y-m-d H:i:s"), 'subtotal' => self::$subtotal, 'ship' => self::$ship, 'total' => self::$total, 'email' => $email);
$order = array_merge($order, $_POST);
CRUD::dataInsert('order', $order);
$o_id = DB::get_id();
if (empty(DB::$error)) {
$cartRow = SESS::get('cart');
foreach ($cartRow as $id => $cart) {
$item = array('serial' => $serial, 'p_id' => $cart["p_id"], 'name' => $cart["name"], 'amount' => $cart["amount"], 'price' => $cart["price"]);
CRUD::dataInsert('order_item', $item);
if (!empty(DB::$error)) {
break;
}
}
}
if (empty(DB::$error)) {
# 訂購確認信
foreach ($order as $field => $var) {
VIEW::assignGlobal("VALUE_" . strtoupper($field), $var);
}
new VIEW('ogs-mail-cart-tpl.html', false, true, false);
CORE::mail_handle(SYSTEM::$setting["email"], $email, VIEW::$output, CORE::$lang["cart_mail"], SYSTEM::$setting["name"]);
CORE::mail_handle($email, SYSTEM::$setting["email"], VIEW::$output, CORE::$lang["cart_mail"], $name);
# 會員認證信
/*
VIEW::assignGlobal('VALUE_VERIFY_PATH',self::$verify);
new VIEW('ogs-mail-verify-tpl.html',false,true,false);
CORE::mail_handle(SYSTEM::$setting["email"],$email,VIEW::$output,CORE::$lang["regist_mail"],SYSTEM::$setting["name"]);
*/
SESS::del('cart');
CORE::msg(CORE::$lang["cart_done"], CORE::$root . "member/order/{$o_id}/");
} else {
# 發生錯誤
CORE::msg(DB::$error, CORE::$root);
}
} else {
if (!$pass || empty($_POST["first"])) {
CORE::msg(CHECK::$alert, CORE::$root);
}
}
}
示例6: insert
private static function insert()
{
CHECK::is_must($_POST["callback"], $_POST["subject"], $_POST["cateID"]);
if (CHECK::is_pass()) {
CRUD::dataInsert('ad', $_POST, true, false, true);
if (!empty(DB::$error)) {
CRUD::args_output();
$msg = DB::$error;
$path = CORE::$manage . 'ad/add/';
} else {
$msg = self::$lang["modify_done"];
$path = CORE::$manage . 'ad/';
}
} else {
CRUD::args_output();
$msg = CHECK::$alert;
$path = CORE::$manage . 'ad/add/';
}
CORE::msg($msg, $path);
}
示例7: modify
public static function modify(array $args, $tb_name = false, $related = false)
{
foreach ($args["id"] as $key => $id) {
list($width, $height) = IMAGES::size($args["path"][$key]);
$images = array('id' => $id, 'path' => $args["path"][$key], 'alt' => $args["alt"][$key], 'title' => $args["title"][$key], 'width_o' => $width, 'height_o' => $height, 'width' => $args['width'][$key], 'height' => $args['height'][$key], 'width_m' => $args['width_m'][$key], 'height_m' => $args['height_m'][$key], 'info' => $args['info'][$key]);
if (empty($id)) {
$images = array_merge($images, array('sheet' => $tb_name, 'related' => $related));
CRUD::dataInsert('images', $images);
$ID = CRUD::$id;
} else {
CRUD::dataUpdate('images', $images);
$ID = $images['id'];
}
$rsnum = CRUD::dataFetch('images', array('id' => $id));
if (!empty($rsnum)) {
list($imgRow) = CRUD::$data;
}
self::crop($ID, $images['path'], $images['width'], $images['height'], $images['width_m'], $images['height_m'], $imgRow['crop'], $imgRow['crop_m']);
}
}
示例8: grant
private static function grant()
{
if (is_array($_POST["id"])) {
foreach ($_POST["id"] as $m_id) {
CRUD::dataInsert('grant', array('m_id' => $m_id, 'granted' => SALE::bonus($m_id), 'date' => date("Y-m-d H:i:s")));
if (!empty(DB::$error)) {
$msg = DB::$error;
break;
}
}
if (empty($msg)) {
$msg = self::$lang["modify_done"];
}
} else {
$msg = self::$lang["no_args"];
}
CORE::msg($msg, CORE::$manage . 'sale/bonus/');
}
示例9: login
private static function login()
{
CHECK::is_email($_POST["account"]);
CHECK::is_password($_POST["password"]);
if (CHECK::is_pass()) {
$rsnum = CRUD::dataFetch('manager', array('ban' => '0', 'status' => '1', 'account' => $_POST["account"], 'password' => md5($_POST["password"])));
if ($rsnum == 1) {
list($manager) = CRUD::$data;
$pass = true;
}
}
if (!$pass) {
$fail_count = SESS::get('LOGIN_FAIL');
SESS::write('LOGIN_FAIL', ++$fail_count);
if ($fail_count <= 3) {
CORE::msg(self::$lang["login_error"], CORE::$manage . 'manager/login/');
} else {
# 失敗超過三次禁止登入
session_destroy();
CRUD::dataInsert('ban', array('ip' => CORE::getIP()));
CORE::msg(self::$lang["login_ban"], CORE::$root);
}
} else {
if (!empty($_POST["cookie"])) {
$path = CORE::$manage . 'manager/reverify/';
} else {
$path = CORE::$manage;
}
SESS::write("MANAGER", $manager);
CORE::msg(self::$lang["login_success"], $path);
}
}