当前位置: 首页>>代码示例>>PHP>>正文


PHP post函数代码示例

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


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

示例1: add_or_edit_link

function add_or_edit_link()
{
    global $smarty, $lang;
    $lin_id = post('lin_id');
    $lin_word = post('lin_word');
    $lin_url = post('lin_url');
    $lin_img = post('lin_img');
    $lin_title = post('lin_title');
    if ($lin_img == 'http://' || $lin_img == '') {
        $lin_img = 'none';
    }
    $obj = new link();
    $obj->set_value('lin_word', $lin_word);
    $obj->set_value('lin_url', $lin_url);
    $obj->set_value('lin_img', $lin_img);
    $obj->set_value('lin_title', $lin_title);
    if ($lin_id != '') {
        $obj->set_where("lin_id = {$lin_id}");
        $obj->edit();
        $info_text = '修改友情链接成功';
    } else {
        $obj->set_value('lin_lang', S_LANG);
        $obj->add();
        $info_text = '添加友情链接成功';
    }
    $smarty->assign('info_text', $info_text);
    $smarty->assign('link_text', $lang['return_list']);
    $smarty->assign('link_href', url(array('channel' => 'service', 'mod' => 'link_list')));
}
开发者ID:jechiy,项目名称:xiu-cms,代码行数:29,代码来源:deal.php

示例2: createPayQRcode

function createPayQRcode($url, $data)
{
    header("Content-Type: image/png");
    $img = post($url, $data);
    echo $img;
    exit;
}
开发者ID:playgamelxh,项目名称:lxh,代码行数:7,代码来源:index.php

示例3: onSignup

 public function onSignup()
 {
     $settings = Settings::instance();
     if (!$settings->api_key) {
         throw new ApplicationException('MailChimp API key is not configured.');
     }
     /*
      * Validate input
      */
     $data = post();
     $rules = ['email' => 'required|email|min:2|max:64'];
     $validation = Validator::make($data, $rules);
     if ($validation->fails()) {
         throw new ValidationException($validation);
     }
     /*
      * Sign up to Mailchimp via the API
      */
     require_once plugins_path() . '/rainlab/mailchimp/vendor/MCAPI.class.php';
     $api = new \MCAPI($settings->api_key);
     $this->page['error'] = null;
     $mergeVars = '';
     if (isset($data['merge']) && is_array($data['merge']) && count($data['merge'])) {
         $mergeVars = $data['merge'];
     }
     if ($api->listSubscribe($this->property('list'), post('email'), $mergeVars) !== true) {
         $this->page['error'] = $api->errorMessage;
     }
 }
开发者ID:jhenahan,项目名称:mailchimp-plugin,代码行数:29,代码来源:Signup.php

示例4: onUpdate

 public function onUpdate()
 {
     $filter = post('filter');
     $results = $this->getResults($filter);
     $this->page['results'] = $results;
     return ['#activity-stream' => $this->renderPartial('@default')];
 }
开发者ID:janusnic,项目名称:OctoberFriends,代码行数:7,代码来源:ActivityStream.php

示例5: install

 function install()
 {
     //bind password
     $password = post("adminpassword1");
     //create important vars
     $salt = rand(0, 99999);
     $md5_password = md5($salt . $password);
     DB::query("DROP TABLE IF EXISTS " . DB_PREFIX . "user");
     DB::query("CREATE TABLE " . DB_PREFIX . "user(\r\n                user_id int(11) NOT NULL AUTO_INCREMENT,\r\n                name varchar(90) NOT NULL,\r\n                salt int(5) NOT NULL default '0',\r\n                password varchar(32) NOT NULL default '0',\r\n                email varchar(255) NOT NULL,\r\n                last_ip varchar(255) NOT NULL default '127.0.0.1',\r\n                data_login int(15) NULL,\r\n                status int(1) NOT NULL default 1,\r\n                activation_code varchar(40) NULL,\r\n                lang_id varchar(2) NOT NULL default 'EN',\r\n                PRIMARY KEY (user_id)\r\n                ) ENGINE=MyISAM");
     DB::insert(DB_PREFIX . "user", array("name" => post("adminname"), "salt" => "{$salt}", "password" => "{$md5_password}", "email" => post("adminemail", FILTER_SANITIZE_EMAIL), "status" => 3));
     DB::query("DROP TABLE IF EXISTS " . DB_PREFIX . "user_where_is");
     DB::query("CREATE TABLE " . DB_PREFIX . "user_where_is ( \r\n            user_where_is_id int(11) NOT NULL AUTO_INCREMENT,\r\n            user_id int(11) NOT NULL,\r\n            guest_id int(11) NOT NULL,\r\n            ip varchar(20) NOT NULL default '127.0.0.1',\r\n            name varchar(90) NOT NULL,\r\n            sid varchar(32) NOT NULL,\r\n            url varchar(255) NOT NULL,\r\n            id int(11) NOT NULL,\r\n            file varchar(255) NOT NULL,\r\n            os varchar(255) NOT NULL,\r\n            browser varchar(255) NOT NULL,\r\n            time int(15) NOT NULL , \r\n            time_first_click int(15) NOT NULL,\r\n            country_code varchar(2) NOT NULL,\r\n            country_name varchar(90) NOT NULL,\r\n            region_code varchar(15) NOT NULL,\r\n            region_name varchar(255) NOT NULL,\r\n            city_name varchar(255) NOT NULL,\r\n            zip varchar(20) NOT NULL,\r\n            latitude varchar(55) NOT NULL,\r\n            longitude varchar(55) NOT NULL,\r\n            timezone_name varchar(255) NOT NULL,\r\n            gmt_offset varchar(255) NOT NULL,\r\n            PRIMARY KEY (user_where_is_id)\r\n            ) ENGINE=MyISAM");
     DB::query("DROP TABLE IF EXISTS " . DB_PREFIX . "usergroup");
     DB::query("CREATE TABLE " . DB_PREFIX . "usergroup(\r\n            group_id int(11) NOT NULL AUTO_INCREMENT,\r\n            parent_id int(11) NOT NULL,\r\n            name varchar(255) NOT NULL,\r\n            position int(11) NOT NULL,\r\n            nuser int(11) NOT NULL,\r\n            PRIMARY KEY (group_id)\r\n            ) ENGINE=MyISAM");
     DB::query("DROP TABLE IF EXISTS " . DB_PREFIX . "usergroup_user");
     DB::query("CREATE TABLE " . DB_PREFIX . "usergroup_user(\r\n            group_id int(11) NOT NULL,\r\n            user_id int(11) NOT NULL,\r\n            PRIMARY KEY (group_id , user_id)\r\n            ) ENGINE=MyISAM");
     DB::query("DROP TABLE IF EXISTS " . DB_PREFIX . "user_localization");
     DB::query("CREATE TABLE " . DB_PREFIX . "user_localization(\r\n            user_localization_id int(11) NOT NULL AUTO_INCREMENT,\r\n            ip varchar(20) NOT NULL DEFAULT '127.0.0.1',\r\n            sid varchar(32) NOT NULL,\r\n            user_id int(11) NOT NULL,\r\n            guest_id int(11) NOT NULL,\r\n            name varchar(90) NOT NULL,\r\n            url varchar(255) NOT NULL,\r\n            id int(11) NOT NULL,\r\n            file varchar(255) NOT NULL,\r\n            os varchar(255) NOT NULL,\r\n            browser varchar(255) NOT NULL,\r\n            time int(15) NOT NULL,\r\n            time_first_click int(15) NOT NULL,\r\n            country_code varchar(2) NOT NULL,\r\n            country_name varchar(90) NOT NULL,\r\n            region_code varchar(15) NOT NULL,\r\n            region_name varchar(255) NOT NULL,\r\n            city_name varchar(255) NOT NULL,\r\n            zip varchar(20) NOT NULL,\r\n            latitude varchar(55) NOT NULL,\r\n            longitude varchar(55) NOT NULL,\r\n            timezone_name varchar(255) NOT NULL,\r\n            gmt_offset varchar(255) NOT NULL,\r\n            PRIMARY KEY (user_localization_id)\r\n            )");
     $querys = DB::get_executed_query();
     $html_message = '<br /><strong>Install Complete!!!<br /></strong> Please Delete: <br /><strong>' . CONTROLLERS_DIR . 'install
         </strong><br />Please read next steps in the "Install-notes" <br />';
     if ($querys == 11) {
         echo draw_msg($html_message, INFO, true);
     } else {
         echo draw_msg("ERROR", ERROR, true);
     }
 }
开发者ID:jffuchs,项目名称:rainframework,代码行数:27,代码来源:install.ajax.php

示例6: set_skin

function set_skin($username, $password, $skin)
{
    $login_url = "https://minecraft.net/login";
    $skin_url = "https://minecraft.net/profile/skin";
    //first, login to Minecraft.net
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $login_url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_COOKIEJAR, "/dev/null");
    curl_setopt($ch, CURLOPT_HEADER, true);
    $fields = array("username" => urlencode($username), "password" => urlencode($password));
    post($ch, $fields);
    curl_exec($ch);
    //Then, load the profile page to retrieve authenticityToken
    curl_setopt($ch, CURLOPT_URL, $skin_url);
    $result = curl_exec($ch);
    $token = get_string_between($result, 'name="authenticityToken" value="', '">');
    //finally, post the skin update
    $headers = array("Content-Type:multipart/form-data");
    // cURL headers for file uploading
    $fields = array("model" => "steve", "skin" => "@{$skin}", "authenticityToken" => $token);
    $options = array(CURLOPT_URL => $skin_url, CURLOPT_HEADER => true, CURLOPT_POST => 1, CURLOPT_HTTPHEADER => $headers, CURLOPT_POSTFIELDS => $fields, CURLOPT_RETURNTRANSFER => true);
    // cURL options
    curl_setopt_array($ch, $options);
    $result = urldecode(curl_exec($ch));
    curl_close($ch);
    if (strlen(strstr($result, "success=Your skin has been changed! It will take a couple of seconds for it to update.")) > 0) {
        return true;
    } else {
        return false;
    }
}
开发者ID:adamjdev,项目名称:Mineskull,代码行数:33,代码来源:change_skin.php

示例7: testPostWithinMockedEnvironment

 public function testPostWithinMockedEnvironment()
 {
     $posted = post('some_post_field');
     $this->assertEquals('Bob', $posted);
     $default = post('blah_doesnt_exist', 7777);
     $this->assertEquals(7777, $default);
 }
开发者ID:NinjaWars,项目名称:ninjawars,代码行数:7,代码来源:environment_test.php

示例8: aksi

 function aksi($id)
 {
     // Add
     if (post('add')) {
         $data = array('title_posting' => post('title_posting'), 'content_posting' => post('content_posting'), 'date_posting' => date('Y-m-d'));
         $this->db->insert('posting', $data);
         $this->all->setMsg('success', 'Berhasil tambah posting');
         $_POST = '';
     }
     // Edit
     if (post('edit')) {
         $data = array('title_posting' => post('title_posting'), 'content_posting' => post('content_posting'), 'date_posting' => date('Y-m-d'));
         $this->db->where('id_posting', $id);
         $this->db->update('posting', $data);
         $this->all->setMsg('success', 'Berhasil edit posting');
     }
     // Status
     if (post('status')) {
         $this->db->where('id_siswa', post('id'));
         $this->db->update('siswa', array('status' => post('status')));
     }
     // Delete
     if (post('delete')) {
         $this->db->where('id_posting', post('id'));
         $this->db->delete(post('delete'));
     }
 }
开发者ID:rochimeiji96,项目名称:hubin,代码行数:27,代码来源:alumni.php

示例9: _check

 private function _check()
 {
     if (!array_diff(array_keys($args = array_intersect_key(post(), array_flip(func_get_args()))), func_get_args())) {
         return $args;
     }
     throw new Exception(NeoFrag::UNFOUND);
 }
开发者ID:agreements,项目名称:neofrag-cms,代码行数:7,代码来源:ajax_checker.php

示例10: save

 /**
  * Create a comment
  *
  **/
 function save()
 {
     $out = array();
     // Sanitize
     $serial_number = post('serial_number');
     $section = post('section');
     $text = post('text');
     $html = post('html');
     if ($serial_number and $section and $text) {
         if (authorized_for_serial($serial_number)) {
             $comment = new Comment_model();
             $comment->retrieve_record($serial_number, 'section=?', array($section));
             $comment->serial_number = $serial_number;
             $comment->section = $section;
             $comment->text = $text;
             $comment->html = $html;
             $comment->user = $_SESSION['user'];
             $comment->timestamp = time();
             $comment->save();
             $out['status'] = 'saved';
         } else {
             $out['status'] = 'error';
             $out['msg'] = 'Not authorized for this serial';
         }
     } else {
         $out['status'] = 'error';
         $out['msg'] = 'Missing data';
     }
     $obj = new View();
     $obj->view('json', array('msg' => $out));
 }
开发者ID:GarethMakgetla,项目名称:munkireport-php,代码行数:35,代码来源:comment_controller.php

示例11: indexAction

 /**
  * Creates the options admin page and manages the update of options.
  * 
  * This is the default Action
  *
  * @return void
  */
 function indexAction()
 {
     if (post('action') == 'index') {
         $options = get_option('HerissonOptions');
         $new_options = array();
         foreach ($this->allowedoptions as $option) {
             $new_options[$option] = post($option);
         }
         $complete_options = array_merge($options, $new_options);
         if (!array_key_exists('privateKey', $complete_options)) {
             $encryption = Encryption::i()->generateKeyPairs();
             $complete_options['publicKey'] = $encryption->public;
             $complete_options['privateKey'] = $encryption->private;
             Message::i()->addError("<b>Warning</b> : public/private keys have been regenerated");
         }
         update_option('HerissonOptions', $complete_options);
     }
     // Check binaries paths
     $binaryTools = array('convert', 'wget', 'du', 'mv', 'uname');
     sort($binaryTools);
     $this->view->binaries = array();
     foreach ($binaryTools as $binary) {
         $this->view->binaries[$binary] = Shell::getPath($binary);
     }
     $this->view->platform = Shell::shellExec('uname', '-a');
     $this->view->screenshots = WpHerissonScreenshotsTable::getAll();
     $this->view->options = get_option('HerissonOptions');
 }
开发者ID:Wilkins,项目名称:herisson-wordpress,代码行数:35,代码来源:Option.php

示例12: onSubscribe

 public function onSubscribe()
 {
     if (!($user = Auth::getUser())) {
         return;
     }
     $user->subscription(post('subscriptionType'))->withCoupon('code')->create(post('stripeToken'), ['email' => $user->email, 'metadata' => array_only($user->attributes, ['name', 'surname', 'phone', 'company', 'street_addr', 'city', 'zip'])]);
 }
开发者ID:chrisvidal,项目名称:oc-cashier-plugin,代码行数:7,代码来源:SubscriptionForm.php

示例13: onSignup

 public function onSignup()
 {
     /*
      * Validate input
      */
     $data = ['email' => post('email'), 'first_name' => post('first_name'), 'last_name' => post('last_name')];
     $rules = ['email' => 'required|email|min:2|max:64'];
     $validation = Validator::make($data, $rules);
     if ($validation->fails()) {
         throw new ValidationException($validation);
     }
     try {
         /*
          * Create and add the subscriber
          */
         $isThrottled = $this->checkThrottle();
         if (!$isThrottled) {
             $subscriber = $this->listSubscribe($data);
             $requireConfirmation = !$subscriber->confirmed_at;
         } else {
             $requireConfirmation = null;
         }
         $this->page['error'] = null;
         $this->page['isThrottled'] = $isThrottled;
         $this->page['requireConfirmation'] = $requireConfirmation;
     } catch (Exception $ex) {
         $this->page['error'] = $ex->getMessage();
     }
 }
开发者ID:aydancoskun,项目名称:octobercms,代码行数:29,代码来源:Signup.php

示例14: action

 /**
  * Renders form for sending messages.
  * Sends message content to selected user.
  * If message is sent, user is notified.
  */
 public function action()
 {
     checkUnauthorizedAccess();
     $main = new Main();
     $body = new \templates\SendMessage();
     echo $main->setPageTitle("Send Message")->setBody($body);
     if (post('send')) {
         $senderID = UserRepository::getIdByUsername($_SESSION['username']);
         $recipientID = getIdFromURL();
         $content = htmlentities(trim(post('content')));
         //stvaranje poruke
         $message = new Message();
         $message->setSenderID($senderID);
         $message->setRecipientID($recipientID);
         $message->setContent($content);
         $message->setCreated(date('Y-m-d H:i:s'));
         try {
             //slanje poruke
             MessageRepository::sendMessage($message);
             ?>
             <script src="/TwitterApp/assets/js/messageSent.js"></script>
             <?php 
         } catch (\PDOException $e) {
             $e->getMessage();
         }
     }
 }
开发者ID:chiiiro,项目名称:SSP-TwitterApp,代码行数:32,代码来源:Messages.php

示例15: _get

 public static function _get()
 {
     if (!self::$inst) {
         self::$inst = new static(post('request'), post('data'));
     }
     return self::$inst;
 }
开发者ID:openlss,项目名称:lib-xport,代码行数:7,代码来源:Response.php


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