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


PHP DB_Functions::isUserExisted方法代码示例

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


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

示例1:

         //echo json with error = 1.
         $response["error"] = 1;
         $response["error_msg"] = "Incorrect username or password!";
         echo json_encode($response);
     }
 } else {
     if ($tag == 'register') {
         //Request type is Register new user
         $username = $_POST['username'];
         $password = $_POST['password'];
         $subject = "Registration";
         $message = "Hello {$username},nnYou have sucessfully registered to our service.nnRegards,nAdmin.";
         $from = "balah balah";
         $headers = "From:" . $from;
         //Check if user is already existed
         if ($db->isUserExisted($username)) {
             // user is already existed - error response
             $response["error"] = 2;
             $response["error_msg"] = "User already existed";
             echo json_encode($response);
         } else {
             //Store user
             $user = $db->storeUser($username, $password);
             //print_r($user);
             if ($user) {
                 //user store successfully
                 $response["success"] = 1;
                 $response["user"]["username"] = $user["username"];
                 //$response["user"]["password"] = $user["encrypted_passwd"];
                 $response["user"]["created"] = $user["created"];
                 //mail($email,$subject,$message,$headers);
开发者ID:CSCE499,项目名称:PHPServer,代码行数:31,代码来源:indexSam.php

示例2: array

<?php

require_once 'include/DB_Functions.php';
$db = new DB_Functions();
// json response array
$response = array("error" => FALSE);
if (isset($_POST['name']) && isset($_POST['email']) && isset($_POST['password'])) {
    // receiving the post params
    $name = $_POST['name'];
    $email = $_POST['email'];
    $password = $_POST['password'];
    // check if user is already existed with the same email
    if ($db->isUserExisted($email)) {
        // user already existed
        $response["error"] = TRUE;
        $response["error_msg"] = "User already existed with " . $email;
        echo json_encode($response);
    } else {
        // create a new user
        $user = $db->storeUser($name, $email, $password);
        if ($user) {
            // user stored successfully
            $response["error"] = FALSE;
            $response["uid"] = $user["unique_id"];
            $response["user"]["name"] = $user["name"];
            $response["user"]["email"] = $user["email"];
            $response["user"]["created_at"] = $user["created_at"];
            $response["user"]["updated_at"] = $user["updated_at"];
            echo json_encode($response);
        } else {
            // user failed to store
开发者ID:Ricardo-Costa-Oliveira,项目名称:Vou-Levar-te-Comigo,代码行数:31,代码来源:Register.php

示例3: mail

     $response["success"] = 1;
     $response["points"] = $points;
     echo json_encode($response);
 } else {
     if ($tag == 'chgpass') {
         $email = $_POST['email'];
         $newpassword = $_POST['newpas'];
         $hash = $db->hashSSHA($newpassword);
         $encrypted_password = $hash["encrypted"];
         // encrypted password
         $salt = $hash["salt"];
         $subject = "Change Password Notification";
         $message = "Hello Piggy Rewards Customer,\n\nYour Password has been sucessfully changed.\n\nRegards,\\Piggy Rewards Team.";
         $from = "svetvaz@gmail.com";
         $headers = "From: svetvaz@gmail.com";
         if ($db->isUserExisted($email)) {
             $user = $db->forgotPassword($email, $encrypted_password, $salt);
             if ($user) {
                 $response["success"] = 1;
                 mail($email, $subject, $message, $headers);
                 echo json_encode($response);
             } else {
                 $response["error"] = 1;
                 echo json_encode($response);
             }
             // user is already existed - error response
         } else {
             $response["error"] = 2;
             $response["error_msg"] = "User does not exist";
             echo json_encode($response);
         }
开发者ID:yangmc423,项目名称:AndroidLoginExample,代码行数:31,代码来源:index.php

示例4: isset

         $response["erro_msg"] = "Email ou senha incorretos!";
         echo json_encode($response);
     }
 } else {
     if ($tag == 'insereUsuario') {
         // Request type is Register new user
         $nome = $_POST['nome'];
         $login = $_POST['login'];
         $senha = $_POST['senha'];
         $email = $_POST['email'];
         $telefone = $_POST['telefone'];
         $endereco = $_POST['endereco'];
         $tipoDeUsuario = $_POST['tipoDeUsuario'];
         $admin = isset($_POST['admin']) ? 1 : 0;
         // check if user is already existed
         if ($db->isUserExisted($login)) {
             // user is already existed - error response
             $response["erro"] = TRUE;
             $response["erro_msg"] = "Usuario ja existe";
             echo json_encode($response);
         } else {
             // store user
             $user = $db->salvaUsuario($nome, $login, $senha, $email, $telefone, $endereco, $tipoDeUsuario, $admin);
             if ($user) {
                 // user stored successfully
                 $idUsuario = $user['idUsuario'];
                 $tipoDeUsuario = $user['tipoDeUsuario'];
                 if ($tipoDeUsuario == 1) {
                     // Cadastra Médico
                     $especializacao = $_POST['especializacao'];
                     $medico = $db->salvaMedico($especializacao, $idUsuario, $tipoDeUsuario);
开发者ID:joseAugustoCR,项目名称:TCC_Servidor,代码行数:31,代码来源:index.php

示例5: sendResponse

         $response["{$name}"] = $name;
         $response["{$password}"] = $password;
         $response["error"] = 1;
         $response["error_msg"] = "Incorrect username or password!";
         sendResponse(4030, json_encode($response));
     }
 } else {
     if ($tag == 'register') {
         // Request type is Register new user
         $name = $_POST['name'];
         $email = $_POST['email'];
         $password = $_POST['password'];
         $age = $_POST['age'];
         $sex = $_POST['sex'];
         // check if user is already existed
         if ($db->isUserExisted($name)) {
             // user is already existed - error response
             $responseError = array("error_msg" => "User already existed");
             //			$response["error"] = 2;
             //			$response["error_msg"] = "User already existed";
             sendResponse(4042, json_encode($responseError));
         } else {
             // store user
             $user = $db->storeUser($name, $email, $password, $age, $sex);
             if ($user) {
                 // user stored successfully
                 $response["success"] = 1;
                 $response["username"] = $user["unique_id"];
                 $response["email"] = $user["email"];
                 $response["age"] = $user["age"];
                 $response["sex"] = $user["sex"];
开发者ID:sheepcao,项目名称:dota,代码行数:31,代码来源:upload.php

示例6: elseif

         echo json_encode($response);
     }
     //02. Register
 } elseif ($tag == 'register') {
     // Request Type is new User
     $name = $_POST['name'];
     $email = $_POST['email'];
     $username = $_POST['username'];
     $phone = $_POST['phone'];
     $password = $_POST['password'];
     $subject = "Registration";
     $message = "Hello {$name}.\n\nYou Have SuccessFully Registered into our Service.\n\nRegards,\nIneedAHelp.com Team";
     $from = "support@ineedahelp.com";
     $headers = "From: " . $from;
     // Check User is Already Existed
     if ($db->isUserExisted($phone) && isUserExistedByEmail($email) && isUserExistedByUsername($username)) {
         // User is Already existed - error Response
         $response["error"] = 2;
         $response["error_msg"] = "User Already Existed";
         echo json_encode($response);
     } else {
         // Store User
         $user = $db->storeUser($name, $username, $phone, $email, $password);
         if ($user) {
             // User Stored Successfully
             $response["success"] = 1;
             $response["user"]["name"] = $user["name"];
             $response["user"]["email"] = $user["email"];
             $response["user"]["username"] = $user["username"];
             $response["user"]["phone"] = $user["phone"];
             mail($email, $subject, $message, $headers);
开发者ID:AlaminMahamud,项目名称:LETS-GO-ANDROID,代码行数:31,代码来源:index.php

示例7: array

<?php

require_once 'include/DB_Functions.php';
$db = new DB_Functions();
// json response array
$response = array("error" => 0);
if (isset($_POST['name']) && isset($_POST['email']) && isset($_POST['phoneno']) && isset($_POST['passHash'])) {
    // receiving the post params
    $name = $_POST['name'];
    $passHash = $_POST['passHash'];
    $email = $_POST['email'];
    $phoneno = $_POST['phoneno'];
    if ($db->isUserExisted($phoneno) == true) {
        $response["error"] = 1;
        $response["error_msg"] = "User already exists!";
        echo json_encode($response);
    } else {
        if ($db->addUser($name, $passHash, $phoneno, $email)) {
            $user = $db->getUserDetails($phoneno);
            if ($user != NULL) {
                $response["error"] = 0;
                $response["error_msg"] = "Register successfully done! ";
                echo json_encode($response);
            } else {
                $response["error"] = 2;
                $response["error_msg"] = "User not registered! DB Error!";
                echo json_encode($response);
            }
        }
    }
} else {
开发者ID:co-de-caine,项目名称:mPurse,代码行数:31,代码来源:register.php

示例8: array

<?php

require_once 'include/DB_Functions.php';
$db = new DB_Functions();
// json response array
$response = array("error" => 0);
if (isset($_POST['name']) && isset($_POST['email']) && isset($_POST['username']) && isset($_POST['password']) && isset($_POST['empid']) && isset($_POST['department']) && isset($_POST['designation'])) {
    // receiving the post params
    $name = $_POST['name'];
    $email = $_POST['email'];
    $username = $_POST['username'];
    $password = $_POST['password'];
    $empid = $_POST['empid'];
    $department = $_POST['department'];
    $designation = $_POST['designation'];
    if ($db->isUserExisted($username) == true) {
        $response["error"] = 1;
        $response["error_msg"] = "User already exists!";
        echo '<script language="javascript">';
        echo 'alert("User already exists!")';
        echo '</script>';
        echo "<script>setTimeout(\"location.href = 'registration.html';\",0);</script>";
    } else {
        if ($db->addUser($name, $email, $username, $password, $empid, $department, $designation)) {
            $user = $db->getUserDetails($username);
            if ($user != NULL) {
                $response["error"] = 0;
                $response["error_msg"] = "Register successfully done! ";
                echo '<script language="javascript">';
                echo 'alert("Register done successfully")';
                echo '</script>';
开发者ID:teamdevops,项目名称:MNNIT-DocTrack,代码行数:31,代码来源:register.php

示例9:

 $PAT_CANCER_DETAILS = $_POST['pat_cancer_details'];
 $PAT_OTHER_MED_PROB = $_POST['pat_other_med_prob'];
 $PAT_PAST_SURGERIES_ID = $_POST['pat_past_surgeries_id'];
 $PAT_OTHER_SURGERIES = $_POST['pat_other_surgeries'];
 $PAT_TOBACCO = $_POST['pat_tobacco'];
 $PAT_SMOKING = $_POST['pat_smoking'];
 $PAT_ALCOHOL = $_POST['pat_alcohol'];
 $PAT_FAMILY_MEMBER = $_POST['pat_family_member'];
 $PAT_HISTORY_ID = $_POST['pat_history_id'];
 $Br_id = $_POST['br_id'];
 $Login_uname = $_POST['pat_name'];
 $Login_name = $_POST['pat_email'];
 $Login_password = 'patient';
 $Login_type = 'patient';
 // check if user already exists with the same email
 if ($db->isUserExisted($PAT_EMAIL)) {
     // user already exists
     $response["response"] = 0;
     $response["message"] = $PAT_EMAIL . "already exists";
     echo json_encode($response);
 } else {
     // create a new user$Cust_Name, $Cust_Email, $Cust_Phone,$Cust_Address,$Cust_City,$Cust_State
     $user = $db->insertPatient($BR_ID, $PAT_TITLE, $PAT_TYPE, $PAT_NAME, $PAT_EMAIL, $PAT_GENDER, $PAT_MOBILE, $PAT_ADDR1, $PAT_ADDR2, $PAT_STATE, $PAT_POSTAL_CODE, $PAT_BLOOD_GROUP, $PAT_HEIGHT, $PAT_HEIGHT_UNIT, $PAT_WEIGHT, $PAT_WEIGHT_UNIT, $PAT_MARITAL_STATUS, $PAT_EMP_STATUS, $PAT_RACE, $PAT_ETHNICITY, $PAT_REF_PHYSICIAN, $PAT_REF_PHYSICIAN_NO, $PAT_RELATIVE_NAME, $PAT_RELATION_TO_PATIENT, $PAT_RELATIVE_ADDR, $PAT_RELATIVE_STATE, $PAT_RELATIVE_PINCODE, $PAT_RELATIVE_PHONE, $PAT_INS_NAME, $PAT_INS_COMPANY, $PAT_INS_ID, $PAT_INS_COMPANY_NO, $PAT_POLICY_ID, $PAT_GROUP_NAME, $PAT_INS_PARTY, $PAT_PROOF_NAME, $PAT_PROOF_NO, $PAT_REL_WITH_PARTY, $PAT_HEALTH_HISTORY_ID, $PAT_CANCER_DETAILS, $PAT_OTHER_MED_PROB, $PAT_PAST_SURGERIES_ID, $PAT_OTHER_SURGERIES, $PAT_TOBACCO, $PAT_SMOKING, $PAT_ALCOHOL, $PAT_FAMILY_MEMBER, $PAT_HISTORY_ID);
     if ($user) {
         // user stored successfully
         $response["response"] = 1;
         $user = mysql_query("SELECT * from Patient_master WHERE PAT_EMAIL = '{$PAT_EMAIL}'");
         $user_data = mysql_fetch_array($user);
         $no_rows = mysql_num_rows($user);
         if ($no_rows == 1) {
             // user exists
开发者ID:skillfroprojects,项目名称:HMS-WebService,代码行数:31,代码来源:patient_insert.php

示例10:

         $response["user_email"] = $user["user_email"];
         $response["user_password"] = $user["user_password"];
         $response["user_name"] = $user["user_name"];
         echo json_encode($response);
         error_log("Index Login Json >>" . json_encode($response) . "\r\n", 3, "Log.log");
     } else {
         $response["error"] = "1";
         $response["error_message"] = "ایمیل یا گذرواژه نادرست است.";
         echo json_encode($response);
     }
 } else {
     if ($tag == 'register') {
         $user_email = $_POST['user_email'];
         $user_password = $_POST['user_password'];
         $user_name = $_POST['user_name'];
         if ($db->isUserExisted($user_email)) {
             $response["error"] = "2";
             $response["error_message"] = "این ایمیل قبلا ثبت شده است";
             echo json_encode($response, JSON_FORCE_OBJECT);
         } else {
             $user = $db->register($user_email, $user_password, $user_name, $user_sex);
             if ($user) {
                 // User registered.
                 $response["success"] = "1";
                 $response["user_id"] = $user["id"];
                 $response["user_email"] = $user["user_email"];
                 $response["user_password"] = $user["user_password"];
                 $response["user_name"] = $user["user_name"];
                 error_log("Index Register Json >>" . json_encode($response) . "\r\n", 3, "Log.log");
                 $headers = "From: shabane@1mohammadi.ir\r\n";
                 $headers .= "Reply-To: " . $user_email . "\r\n";
开发者ID:rezakhn,项目名称:Nightly,代码行数:31,代码来源:index.php


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