• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP isPostRequest函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中isPostRequest函数的典型用法代码示例。如果您正苦于以下问题:PHP isPostRequest函数的具体用法?PHP isPostRequest怎么用?PHP isPostRequest使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了isPostRequest函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: cart_list

function cart_list()
{
    $data = array();
    if (!isset($_SESSION['cart'])) {
        $data['error'] = 'Giỏ trống trơn!';
    } else {
        $data['cart'] = $_SESSION['cart'];
        $fromDB = model('book')->getCartList($data['cart']);
        $merge = array();
        foreach ($data['cart'] as $cart) {
            foreach ($fromDB as $value) {
                if (intval($value['id']) == $cart['book_id']) {
                    $merge[] = array_merge($cart, $value);
                }
            }
        }
        //var_dump($merge);
        $data['merge'] = $merge;
    }
    //Submit cart
    if (isPostRequest()) {
        $postData = postData();
        for ($i = 1; $i <= count($_SESSION['cart']); $i++) {
            foreach ($_SESSION['cart'] as $key => $cart) {
                if ($postData['bookid' . $i] == $cart['book_id']) {
                    $_SESSION['cart'][$key]['quantity'] = $postData['quantity' . $i];
                }
            }
        }
        redirect('index.php?c=bill&m=view');
    }
    $data['template_file'] = 'cart/list.php';
    render('layout.php', $data);
}
开发者ID:huynhtrucquyen0812,项目名称:EntryBlog,代码行数:34,代码来源:cart.php


示例2: bill_detail

function bill_detail()
{
    $data = array();
    $user = adminLogged();
    if (!adminLogged()) {
        redirect('/index.php?c=admin&m=login');
    } else {
        $bill_detail = model('bill')->getBillDetails($_GET['id']);
        $data['total'] = 0;
        foreach ($bill_detail as $key => $b) {
            $book = model('book')->getSingle($b['book_id']);
            $bill_detail[$key]['name'] = $book['name'];
            $bill_detail[$key]['price'] = intval($book['price']);
            $bill_detail[$key]['total'] = $book['price'] * $b['quantity'];
            $bill_detail[$key]['image'] = $book['image'];
            $data['total'] += $book['price'] * $b['quantity'];
        }
        $data['bill_detail'] = $bill_detail;
    }
    $data['statuses'] = array('Chờ duyệt', 'Đang giao hàng', 'Đã giao hàng', 'Hủy');
    $data['stt'] = model('bill')->getOneBy($_GET['id'], null)['status'];
    if (isPostRequest()) {
        $postData = postData();
        db_update('bills', $postData, 'id=' . $_GET['id']);
        $data['stt'] = $postData['status'];
        $data['error'] = 'Tình trạng đơn hàng update thành công.';
    }
    $data['user'] = model('user')->getOneBy(model('bill')->getOneBy($_GET['id'], null)['user_id'], null);
    $data['template_file'] = 'bill/detail.php';
    render('layout.php', $data);
}
开发者ID:huynhtrucquyen0812,项目名称:EntryBlog,代码行数:31,代码来源:bill.php


示例3: user_signup

function user_signup()
{
    if (isPostRequest()) {
        $arr_user = array('user_name' => $_POST['user_name'], 'name' => $_POST['name'], 'password' => md5($_POST['password']));
        model('user')->signup($arr_user);
        redirect('index.php');
    }
    $data['template_file'] = 'user/signup.php';
    render('layout.php', $data);
}
开发者ID:quyen91,项目名称:simple-mvc,代码行数:10,代码来源:user.php


示例4: news_add

function news_add()
{
    $data = array();
    if (isPostRequest()) {
        $postData = postData();
        $currentUser = isLogged();
        if (model('news')->addToUser($postData, $currentUser['id'])) {
            redirect('index.php?c=news&m=list.php');
        }
    }
    $data['template_file'] = 'news/add.php';
    render('layout.php', $data);
}
开发者ID:softwareEngineer4444,项目名称:khuyennong,代码行数:13,代码来源:news.php


示例5: test_feedback

function test_feedback()
{
    $data = array();
    if (isPostRequest()) {
        $postData = postData();
        $currentUser = isLogged();
        // echo "<pre>";;var_dump($postData);die();
        if (model('question')->addToUser($postData, $currentUser['id'])) {
            redirect('index.php?c=test&m=list');
        }
    }
    $data['template_file'] = 'test/feedback.php';
    render('test.php', $data);
}
开发者ID:softwareEngineer4444,项目名称:khuyennong,代码行数:14,代码来源:test.php


示例6: admin_login

function admin_login()
{
    $data = array();
    if (isPostRequest()) {
        $postData = postData();
        if (model('admin')->adminLogin($postData)) {
            redirect('/admin/index.php?c=bill&m=list');
        } else {
            $data['error'] = 'Login failed! Please try again!';
        }
    }
    $data['template_file'] = 'admin/login.php';
    render('layout.php', $data);
}
开发者ID:huynhtrucquyen0812,项目名称:EntryBlog,代码行数:14,代码来源:admin.php


示例7: auth_register

function auth_register()
{
    $data = array();
    $data['template_file'] = 'auth/register.php';
    if (isPostRequest()) {
        $postData = postData();
        if (model('user')->authRegister($postData)) {
            redirect('index.php?c=payment&m=list');
        } else {
            $data['error'] = 'Register failed ! Email exists ! Please try again !';
            $data['postData'] = $postData;
        }
    }
    render('layout.php', $data);
}
开发者ID:softwareEngineer4444,项目名称:khuyennong,代码行数:15,代码来源:auth.php


示例8: auth_register

function auth_register()
{
    sleep(1);
    $data = array();
    if (isPostRequest()) {
        $postData = postData();
        if (model('user')->aut_register($postData)) {
            redirect('/blogtaolao_MVC_/index.php');
        } else {
            $data['error'] = 'Email đã tồn tại ';
        }
    }
    $data['template_file'] = 'auth/register.php';
    render('layout.php', $data);
}
开发者ID:nguyenquang2302,项目名称:BlogTaoLao,代码行数:15,代码来源:auth.php


示例9: blog_detail

function blog_detail()
{
    $id = $_GET['id'];
    if (isPostRequest()) {
        $postData = postData();
        $currentUser = isLogged();
        if (model('blog')->addComment($postData, $id)) {
            redirect('/index.php?c=blog&m=detail&id=' . $id);
        }
    }
    $data['blog_content'] = model('blog')->getOneBlog($id);
    $data['blog_comment'] = model('blog')->getAllComment($id);
    //var_dump($data);die;
    $data['template_file'] = 'blog/viewBlog.php';
    render('layout.php', $data);
}
开发者ID:nguyenlevietphi,项目名称:MyBlog,代码行数:16,代码来源:blog.php


示例10: blog_update

function blog_update()
{
    $data = array();
    if (isPostRequest()) {
        $postData = postData();
        $currentUser = isLogged();
        if ($currentUser && model('entry')->update($postData, $_GET['entry'])) {
            redirect('/index.php?c=blog&m=list');
        }
    } else {
        $data['single'] = model('entry')->getSingle($_GET['entry']);
    }
    $data['title'] = 'Chỉnh sửa bài viết';
    $data['template_file'] = 'entry/add.php';
    render('layout.php', $data);
}
开发者ID:huynhtrucquyen0812,项目名称:EntryBlog,代码行数:16,代码来源:blog.php


示例11: auth_change_info

function auth_change_info()
{
    $logged = isLogged();
    $email = $logged['email'];
    $role = $logged['role'];
    if (isPostRequest()) {
        $postData = postData();
        //var_dump($postData);die;
        if (model('user')->authChangeInfo($postData, $email, $role)) {
            redirect('/index.php?c=blog&m=list');
        }
    }
    $data['user_info'] = model('user')->authGetInfo($email);
    //var_dump($data);die;
    $data['template_file'] = 'auth/change_info.php';
    render('layout.php', $data);
}
开发者ID:nguyenlevietphi,项目名称:MyBlog,代码行数:17,代码来源:auth.php


示例12: book_list

function book_list()
{
    $data = array();
    if (isset($_GET['pagenum'])) {
        $pagenum = $_GET['pagenum'];
    } else {
        $pagenum = 0;
    }
    $data['books'] = model('book')->get12($pagenum);
    if (model('book')->getCount() % 12 === 0) {
        $data['pages'] = intval(model('book')->getCount()) / 12;
    } else {
        $data['pages'] = intval(model('book')->getCount() / 12) + 1;
    }
    $data['pagenum'] = $pagenum;
    //Thêm vào giỏ hàng:
    if (isPostRequest()) {
        $postData = postData();
        $id = intval($postData['aidi']);
        $quantity = intval($postData['quantity']);
        if ($quantity <= 0) {
            $data['info'] = 'Số lượng không đúng!';
        } else {
            if (!isset($_SESSION['cart'])) {
                $_SESSION['cart'][0] = array('book_id' => $id, 'quantity' => $quantity);
            } else {
                $flag = false;
                foreach ($_SESSION['cart'] as $cart) {
                    if ($cart['book_id'] === $id) {
                        //$cart['quantity'] += $quantity;
                        $flag = true;
                        $data['info'] = 'Sách này đã có trong giỏ hàng!';
                        break;
                    }
                }
                if ($flag == false) {
                    $_SESSION['cart'][] = array('book_id' => $id, 'quantity' => $quantity);
                    $data['info'] = 'Thêm sách vào giỏ hàng thành công!';
                }
            }
        }
    }
    //var_dump($_SESSION['cart']);
    $data['template_file'] = 'book/list.php';
    render('layout.php', $data);
}
开发者ID:huynhtrucquyen0812,项目名称:EntryBlog,代码行数:46,代码来源:book.php


示例13: book_update

function book_update()
{
    $data = array();
    if (isPostRequest()) {
        $postData = postData();
        $currentUser = adminLogged();
        if ($currentUser && model('book')->update($postData, $_GET['bookid'], $_SERVER['DOCUMENT_ROOT'] . '/images/') === 'success') {
            redirect('/admin/index.php?c=book&m=list');
        } else {
            $data['error'] = model('book')->update($postData, $_GET['bookid'], $_SERVER['DOCUMENT_ROOT'] . '/images/');
            $data['single'] = model('book')->getSingle($_GET['bookid']);
        }
    } else {
        $data['single'] = model('book')->getSingle($_GET['bookid']);
        $_SESSION['oldImage'] = $data['single']['image'];
    }
    $data['title'] = 'Chỉnh sửa sách';
    $data['template_file'] = 'book/add.php';
    render('layout.php', $data);
}
开发者ID:huynhtrucquyen0812,项目名称:EntryBlog,代码行数:20,代码来源:book.php


示例14: product_add

function product_add()
{
    if (isPostRequest()) {
        $postData = postData();
        $postData['image'] = uploadImage();
        $currentUser = isLogged();
        //var_dump($postData);die;
        if ($postData['image'] == 0) {
            echo "Không upload được hình ảnh";
        } else {
            if (model('product')->addProduct($postData)) {
                redirect('/index.php?c=product&m=list');
            } else {
                echo "<script>alert('" . "Không thêm vào được CSDL!" . "')</script>";
            }
        }
    }
    $data['template_file'] = 'product/add.php';
    render('layout.php', $data);
}
开发者ID:nguyenlevietphi,项目名称:MyBlog,代码行数:20,代码来源:product.php


示例15: bill_view

function bill_view()
{
    $data = array();
    if (!isset($_SESSION['cart'])) {
        redirect('index.php?c=cart&m=list');
    } else {
        $data['cart'] = $_SESSION['cart'];
        $fromDB = model('book')->getCartList($data['cart']);
        $merge = array();
        foreach ($data['cart'] as $cart) {
            foreach ($fromDB as $value) {
                if (intval($value['id']) == $cart['book_id']) {
                    $merge[] = array_merge($cart, $value);
                }
            }
        }
        $total = 0;
        foreach ($merge as $m) {
            $total += $m['quantity'] * $m['price'];
        }
        $data['total'] = $total;
    }
    if (isLogged()) {
        $data['user'] = $_SESSION['logged'];
    }
    if (isset($_GET['update'])) {
        $data['update'] = 1;
    }
    if (isPostRequest()) {
        $postData = postData();
        if (model('user')->update($postData, $postData['email'])) {
            $data['user'] = model('user')->getOneBy($postData['email'], 'email');
            unset($data['user']['password']);
            $_SESSION['logged'] = $data['user'];
            unset($_GET['update']);
            redirect('index.php?c=bill&m=view');
        }
    }
    $data['template_file'] = 'bill/view.php';
    render('layout.php', $data);
}
开发者ID:huynhtrucquyen0812,项目名称:EntryBlog,代码行数:41,代码来源:bill.php


示例16: auth_register

function auth_register()
{
    $data = array();
    $data['template_file'] = 'auth/register.php';
    if (isPostRequest()) {
        $postData = postData();
        if ($postData['status'] == 'on') {
            $postData['status'] = 1;
        } else {
            $postData['status'] = 0;
            exit;
        }
        if (model('user')->authRegister($postData)) {
            redirect('index.php?c=post&m=list');
        } else {
            $data['error'] = 'Register failed ! Email exists ! Please try again !';
            $data['postData'] = $postData;
        }
    }
    $data['category'] = model('category')->getAllBycategory();
    render('layout.php', $data);
}
开发者ID:herotran-nguyenanh,项目名称:webdevelopver,代码行数:22,代码来源:auth.php


示例17: filter_input

        <title>Address Box</title>
        

    </head>
    <body>
        <center>
        <?php 
require_once '/includes/session-start.req-inc';
include_once '/functions/dbconnect.php';
include_once '/functions/login-function.php';
include_once '/functions/signupFunction.php';
include_once '/functions/newContact-function.php';
include_once '/functions/update.php';
include_once '/functions/until.php';
$view = filter_input(INPUT_GET, 'view');
if (isPostRequest()) {
    $email = filter_input(INPUT_POST, 'email');
    $password = filter_input(INPUT_POST, 'pass');
    if (isValidUser($email, $password)) {
        $_SESSION['isValidUser'] = true;
        header('Location: index.php?view=userdefault');
    } else {
        if (!isset($_SESSION['isValidUser']) || $_SESSION['isValidUser'] !== true) {
            $results = 'Invalid Login. Sorry, please try again';
        }
    }
}
?>
        
    <nav>
        <ul>
开发者ID:NWhitaker27,项目名称:PHPClassSummer2015,代码行数:31,代码来源:index.php


示例18: filter_input

include './functions/utils.php';
$results = '';
$link = filter_input(INPUT_POST, 'link');
$errors = '';
$output = '';
/*
 * easy validation
 */
if (isPostRequest()) {
    if (filter_var($link, FILTER_VALIDATE_URL) == false) {
        $errors = 'Not a valid URL.';
    } else {
        $output = getLinks($link);
    }
}
if (isPostRequest() && empty($errors) && count($output) > 0) {
    if (saveSite($link, $output)) {
        $results = 'Data Added';
    } else {
        $errors = "Error. Data not added.";
    }
}
?>


        <h1><?php 
echo $results;
?>
</h1>
        <h1><?php 
echo $errors;
开发者ID:coliver2,项目名称:PHPClassWinter2016,代码行数:31,代码来源:index.php


示例19: filter_input

    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php 
include './functions/until.php';
$email = filter_input(INPUT_POST, 'email');
$isValid = true;
if (filter_var($email, FILTER_VALIDATE_EMAIL) === false) {
    $isValid = false;
}
?>
        
        <?php 
if (isPostRequest() && !$isValid) {
    ?>
        <h1>Email is invalid</h1>
        <?php 
}
?>
        
        <form method="post" action="#">
 
            Email<input type="text" name="email" value="" />
            <input type="submit" value="submit" />
           

            <input type="submit" value="Submit" />
        </form>
        
开发者ID:AbigailRDyer,项目名称:PHPClassSummer2015,代码行数:30,代码来源:email_error.php


示例20: filter_input

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8">
        <title></title>
    </head>
    <body>
        <?php 
require './functions/until.php';
$email = filter_input(INPUT_POST, 'email');
$isValid = true;
if (filter_var($email, FILTER_VALIDATE_EMAIL) === false && isPostRequest()) {
    $isValid = false;
}
?>
        
        <?php 
if (!$isValid) {
    ?>
            <h1>Email is invalid</h1>
        <?php 
}
?>
         <form method="post" action="#">
            Email<input type="text" name="email" value="" />
            <input type="submit" value="Submit" />
            </form>
    </body>
</html>
开发者ID:slasher15987,项目名称:phpclass2015,代码行数:29,代码来源:email-error.php



注:本文中的isPostRequest函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP isPresentRelatedLists函数代码示例发布时间:2022-05-15
下一篇:
PHP isPost函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap