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


PHP DB_Functions::updateUser方法代码示例

本文整理汇总了PHP中DB_Functions::updateUser方法的典型用法代码示例。如果您正苦于以下问题:PHP DB_Functions::updateUser方法的具体用法?PHP DB_Functions::updateUser怎么用?PHP DB_Functions::updateUser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DB_Functions的用法示例。


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

示例1: send_notification

 /**
  * Sending Push Notification
  */
 public function send_notification($registration_ids, $message)
 {
     // include config
     require_once 'config.php';
     // Set POST variables
     $url = 'https://android.googleapis.com/gcm/send';
     $fields = array('registration_ids' => $registration_ids, 'data' => $message);
     $headers = array('Authorization: key=' . GOOGLE_API_KEY, 'Content-Type: application/json');
     // Open connection
     $ch = curl_init();
     // Set the url, number of POST vars, POST data
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_POST, true);
     curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     // Disabling SSL Certificate support temporarly
     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
     curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
     // Execute post
     $result = curl_exec($ch);
     if ($result === FALSE) {
         die('Curl failed: ' . curl_error($ch));
     } else {
         $jsonres = json_decode($result);
         if (!empty($jsonres->results)) {
             require_once 'db_functions.php';
             $db = new DB_Functions();
             for ($i = 0; $i < count($jsonres->results); $i++) {
                 if (isset($jsonres->results[$i]->registration_id)) {
                     $new = $db->updateUser($registration_ids[$i], $jsonres->results[$i]->registration_id);
                 } else {
                     if (isset($jsonres->results[$i]->error)) {
                         if ($jsonres->results[$i]->error == "NotRegistered") {
                             $res = $db->deleteUser($registration_ids[$i]);
                         }
                     }
                 }
             }
             echo $result . "\n";
             $canonical_ids_count = $jsonres->canonical_ids;
             if ($canonical_ids_count) {
                 echo count($canonical_ids_count) . " registrations updated\n";
             }
         }
     }
     // Close connection
     curl_close($ch);
 }
开发者ID:MumbaiHackerspace,项目名称:kzpa,代码行数:51,代码来源:GCM.php

示例2:

     }
     echo json_encode($response);
 } else {
     if ($tag == "storeUser") {
         $userExists = $db->isUserExisting($user_id);
         if (!$userExists) {
             // $hash = password_hash($password, PASSWORD_DEFAULT);
             $bool = $db->storeUser($user_id, $firstname, $lastname);
             if ($bool) {
                 $response["success"] = 1;
             } else {
                 $response["error"] = 1;
                 $response["error_msg"] = "Error, could not register";
             }
         } else {
             $bool = $db->updateUser($user_id, $email, $firstname, $lastname, $debt, $block, $lobare);
             if ($bool) {
                 $response["success"] = 1;
                 $response["tag"] = "updateUser";
             } else {
                 $response["error"] = 1;
                 $response["error_msg"] = "Could not update user";
             }
         }
         echo json_encode($response);
     } else {
         if ($tag == "getItems") {
             $items = $db->getItems();
             if ($items) {
                 $response["success"] = 1;
                 // Loop through all items...
开发者ID:atreus1,项目名称:s3,代码行数:31,代码来源:index.php

示例3: floatval

if (isset($_POST['fullname']) && isset($_POST['username'])) {
    // receiving the post params
    $fullname = $_POST['fullname'];
    $username = $_POST['username'];
    $courseInterest = $_POST['courseInterest'];
    $undergradGpa = floatval($_POST['undergradGpa']);
    $greQuant = floatval($_POST['greQuant']);
    $greVerbal = floatval($_POST['greVerbal']);
    $greAWA = floatval($_POST['greAWA']);
    $engScore = floatval($_POST['engScore']);
    $workExp = floatval($_POST['workExp']);
    $greTotal = floatval($greQuant + $greVerbal);
    // check if user is already existed with the same email
    //if ($db->isUserExisting($username)) {
    // create a new user
    $user = $db->updateUser($fullname, $username, $courseInterest, $undergradGpa, $greQuant, $greVerbal, $greAWA, $greTotal, $engScore, $workExp);
    /*  if ($user) {
        // user stored successfully */
    $response["error"] = FALSE;
    $response["user"]["courseInterest"] = $user["courseInterest"];
    $response["user"]["undergradGpa"] = $user["undergradGpa"];
    $response["user"]["greQuant"] = $user["greQuant"];
    $response["user"]["greVerbal"] = $user["greVerbal"];
    $response["user"]["greAWA"] = $user["greAWA"];
    $response["user"]["greTotal"] = $user["greTotal"];
    $response["user"]["engScore"] = $user["engScore"];
    $response["user"]["workExp"] = $user["workExp"];
    echo json_encode($response);
    /*  } else {
            // user failed to store
            $response["error"] = TRUE;
开发者ID:GradUTeam,项目名称:Grad-School-Recommendation,代码行数:31,代码来源:update.php


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