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


PHP addUser函数代码示例

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


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

示例1: clearUser

function clearUser()
{
    if (isset($_POST['user']) && $_POST['user'] !== null && $_POST['user'] !== '') {
        $username = $_POST['user'];
        // lookup userid from db
        //echo "received Username: " . $username;
        if (isset($_POST['pass']) && $_POST['pass'] !== "") {
            // if user/password exists, check it, otherwise add new user
            if (usernameExists($username)) {
                $userId = getUserId($username);
                $pass = getPass($userId);
                // get pass from db
                if ($_POST['pass'] === $pass) {
                    return "user cleared.";
                } else {
                    return "invalid combination.";
                }
            } else {
                if (addUser($username, $_POST['pass'])) {
                    return "user cleared.";
                } else {
                    return "error creating new user.";
                }
            }
        } else {
            return "password cannot be empty.";
        }
    } else {
        return "username cannot be empty.";
    }
}
开发者ID:radiochickenwax,项目名称:gregsList,代码行数:31,代码来源:concierge.php

示例2: processRequest

/**
 * This file is a part of MyWebSQL package
 *
 * @file:      modules/usermanager.php
 * @author     Samnan ur Rehman
 * @copyright  (c) 2008-2014 Samnan ur Rehman
 * @web        http://mywebsql.net
 * @license    http://mywebsql.net/license
 */
function processRequest(&$db)
{
    $action = v($_REQUEST["id"]);
    include BASE_PATH . "/lib/usermanager.php";
    $legacyServer = Session::get('db', 'version') < 5;
    $editor = new userManager($db, $legacyServer);
    $message = '';
    if ($action != '') {
        if ($action == "add") {
            $result = addUser($db, v($_REQUEST["query"]), $editor);
        } else {
            if ($action == "delete") {
                $result = deleteUser($db, v($_REQUEST["query"]), $editor);
            } else {
                if ($action == "update") {
                    $result = updateUser($db, v($_REQUEST["query"]), $editor);
                }
            }
        }
        if ($result) {
            $db->flush('PRIVILEGES', true);
            $message = __('The command executed successfully');
        } else {
            $message = __('Error occurred while executing the query');
        }
    }
    displayUserForm($db, $editor, $message, $action);
}
开发者ID:guohuadeng,项目名称:stampApp,代码行数:37,代码来源:usermanager.php

示例3: __construct

 public function __construct($userName, $userEmail, $userPassword)
 {
     $this->userName = $userName;
     $this->userEmail = $userEmail;
     $this->userPassword = $userPassword;
     addUser($this->userName, $this->userEmail, $this->userPassword, $DBConnect);
 }
开发者ID:DmiKom,项目名称:MeetingEfficiency-,代码行数:7,代码来源:userClass.php

示例4: wsOnMessage

function wsOnMessage($clientID, $message, $messageLength, $binary)
{
    global $users;
    $message = explode(' ', $message);
    $command = array_shift($message);
    if ($command == 'J') {
        if (isUser($clientID)) {
            wsClose($clientID);
            return;
        }
        $name = trim($message[0]);
        if ($name == '') {
            wsClose($clientID);
            return;
        }
        if (nameTaken($name)) {
            wsClose($clientID);
            return;
        }
        addUser($clientID, $name);
    } else {
        if ($messageLength == 0 || !isUser($clientID)) {
            wsClose($clientID);
            return;
        } else {
            if ($command == 'D') {
                $c = $users[$clientID];
                // Update client parameters
                $c->ang = $message[0];
                $c->pos[0] = $message[1];
                $c->pos[1] = $message[2];
                $c->vel[0] = $message[3];
                $c->vel[1] = $message[4];
                // Let other clients know that new data is available
                foreach ($users as $userID => $data) {
                    if ($userID != $clientID) {
                        $users[$userID]->queue[$clientID] = 1;
                    }
                }
                $data = '';
                // Send updates back to the client
                foreach ($c->queue as $userID => $one) {
                    if ($one) {
                        $u = $users[$userID];
                        $data .= ' ' . $u->name . ' ' . $u->ang . ' ' . $u->pos[0] . ' ' . $u->pos[1] . ' ' . $u->vel[0] . ' ' . $u->vel[1];
                        $c->queue[$userID] = 0;
                    }
                }
                wsSend($clientID, 'D' . $data);
            } elseif ($command == 'Q') {
                removeUser($clientID);
            } else {
                wsClose($clientID);
            }
        }
    }
}
开发者ID:Silxik,项目名称:webgl,代码行数:57,代码来源:server.php

示例5: A

function A()
{
    try {
        addUser("wyq");
        UpdateUser("sss");
    } catch (Exception $e) {
        // echo $e->getLine();
        throw $e;
        // echo $e->getMessage();
    }
}
开发者ID:hehekeke,项目名称:test,代码行数:11,代码来源:Exception.php

示例6: newUser

function newUser($ip, $nick, $password, $email, $name, $surname, $age, $gender)
{
    if (strcmp($gender, 'female') != 0 and strcmp($gender, 'male') != 0) {
        $gender = null;
    }
    $hashedPassword = hash("sha256", $password, false);
    if (addUser($nick, $hashedPassword, $email, $name, $surname, $age, $gender)) {
        addAction($nick, $email, $ip, 'register');
        return true;
    }
    return false;
}
开发者ID:jagumiel,项目名称:bigou-Album,代码行数:12,代码来源:user_logic.php

示例7: dropFromSearch

/**
 * drop users from active_users.json
 * @param array &$arr
 * @param array $users
 * @return 
 *
 */
function dropFromSearch(&$arr, $users, $chat)
{
    foreach ($users as $user) {
        $id = $user;
        $obj = new stdClass();
        $obj->mmr = $arr->{$id};
        $obj->chat = $chat;
        $obj->online = true;
        $obj->visited = time();
        addUser($id, $obj);
        unset($arr->{$user});
        $arr->count -= 1;
    }
    return $arr;
}
开发者ID:READYTOMASSACRE,项目名称:cwscript,代码行数:22,代码来源:search.php

示例8: start

function start()
{
    if (!empty($_POST['nom'])) {
        addUser();
        $tableauPeople = getPeople();
        require '../views/list.php';
    } elseif (!isset($_GET['id'])) {
        // charge la page list
        $tableauPeople = getPeople();
        require '../views/list.php';
    } else {
        // avec l'id charge la page show
        $data = loadData();
        require '../views/show.php';
    }
}
开发者ID:medanisL,项目名称:ExoSimplon,代码行数:16,代码来源:functions.php

示例9: addRecordsOfficer

function addRecordsOfficer($db, $credentials)
{
    $limit = $checkDepartmentLimit;
    $role = "";
    $active = "";
    if ($limit == 0) {
        $role = "primary";
        $active = "true";
    } else {
        $role = "back-up";
        $active = "false";
    }
    addUser($db, $credentials);
    $insert = "insert into records_officer(username,role,active) values ('" . $credentials[1] . "','" . $role . "','" . $active . "')";
    $update = $db->query($insert);
}
开发者ID:literarypyro,项目名称:bootstrapped_documenttracking,代码行数:16,代码来源:user+functions.php

示例10: controller_reg_index

function controller_reg_index()
{
    view_reg();
    if (!empty($_POST['login']) and !empty($_POST['passw'])) {
        $name = $_POST['login'];
        $res = mysqli_query(connect(), "SELECT id FROM users WHERE name = '{$name}'");
        $row = mysqli_fetch_row($res);
        $count = $row[0];
        close_bd();
        if (!preg_match("/^[a-zA-Z0-9]+\$/", $_POST['login'])) {
            echo "Логин может состоять только из букв английского алфавита и цифр";
        } elseif (strlen($_POST['login']) < 3 or strlen($_POST['login']) > 30) {
            echo "Логин должен быть не меньше 3-х символов и не больше 30";
        } elseif (!empty($count)) {
            echo "Пользователь с таким логином уже существует в базе данных";
        } else {
            addUser();
        }
    }
}
开发者ID:PushGit,项目名称:companies,代码行数:20,代码来源:controller.php

示例11: start

function start()
{
    if (!empty($_POST)) {
        if (!isset($_POST['id'])) {
            addUser($_POST);
            $fla = flash("Ajout reussie");
        } else {
            editUser($_POST);
            $fla = flash("Edition reussie");
        }
        $people = getPeople();
        require '../views/list.php';
        return;
    }
    if (!isset($_GET['id']) && !isset($_GET['page'])) {
        $people = getPeople();
        return require '../views/list.php';
    }
    if (isset($_GET['page']) && $_GET['page'] === 'add') {
        return require '../views/add.php';
    }
    if (isset($_GET['page']) && $_GET['page'] === 'list') {
        $people = getPeople();
        return require '../views/list.php';
    }
    if (isset($_GET['page']) && $_GET['page'] === 'edit') {
        if (!isset($_GET['id'])) {
            die('Nope, ou est ID ?');
        }
        $id = $_GET['id'];
        $editable = ORM::for_table('users')->find_one($id);
        return require '../views/edit.php';
    }
    if (isset($_GET['id'])) {
        $user = getUser();
        $message = getMessages($_GET['id']);
        require '../views/show.php';
    }
}
开发者ID:nemo75,项目名称:sql,代码行数:39,代码来源:functions.php

示例12: dbQuery

        }
        $result = dbQuery("UPDATE [db]users SET status = -1 WHERE user_id = {$uid}");
        if (!$result) {
            $msg = "Database Error: {$ax['usr_not_deleted']}";
            break;
        }
        $msg = $ax['usr_deleted'];
    } while (false);
    return $msg;
}
//Control logic
if ($privs >= 4) {
    //manager or admin
    $msg = '';
    if (isset($_POST['addExe'])) {
        $msg = addUser();
    } elseif (isset($_POST['updExe'])) {
        $msg = updateUser();
    } elseif (isset($_GET['delExe'])) {
        $msg = deleteUser();
    }
    echo "<p class='error'>{$msg}</p>\n\t\t<div class='scrollBoxAd'>\n\t\t<div class='centerBox'>\n";
    if ($editUser != 'y' or isset($_POST["back"])) {
        showUsers();
    } else {
        editUser($uid);
    }
    echo "</div>\n</div>\n";
} else {
    echo "<p class='error'>{$ax['no_way']}</p>\n";
}
开发者ID:krievley,项目名称:schedule,代码行数:31,代码来源:users.php

示例13: explode

$method = $_SERVER['REQUEST_METHOD'];
//get the path to decide what happens
$path = explode('/', ltrim($_SERVER['PATH_INFO'], "/"));
//gets the data into array
$data = $_REQUEST;
//do relevant stuff with path[1]
switch ($path[0]) {
    case "users":
        switch ($method) {
            case "GET":
                $data["username"] = $path[1];
                $results = getUser($data);
                break;
            case "PUT":
                $data["username"] = $path[1];
                $results = addUser($data);
                break;
            case "PATCH":
                $data["username"] = $path[1];
                $results = editUser($data);
                break;
            default:
                $results["meta"] = methodNotAllowed($method, $path);
        }
        break;
    case "goals":
        switch ($method) {
            case "GET":
                $results = getGoals($data);
                break;
            case "POST":
开发者ID:jahidulpabelislam,项目名称:e-Portfolio,代码行数:31,代码来源:index.php

示例14: resetPDO

}
$dbh = null;
$dbh = resetPDO($dbh);
$method = $_GET['r'];
switch ($method) {
    case 'selectUser':
        echo selectUser();
        break;
    case 'selectMates':
        echo selectMates();
        break;
    case 'selectTop3':
        echo selectTop3();
        break;
    case 'addUser':
        echo addUser();
        break;
    case 'addParticipation':
        echo addParticipation();
        break;
    case 'updateUser':
        echo updateUser();
        break;
    case 'updateShare':
        echo updateShare();
        break;
    default:
        $error = array("error" => "Undefined function.");
        echo json_encode($error);
        break;
}
开发者ID:sylvhama,项目名称:summer2015,代码行数:31,代码来源:do.php

示例15: addUser

            <title>Guillaume Tell</title>
            <link rel="stylesheet" media="screen" type="text/css" title="Design" href="style.css" />
            <script type="text/javascript" src="jquery-1.6.2.min.js"></script>
            <script type="text/javascript" src="toto.js"></script>
            <script src="jquery.metadata.js" type="text/javascript"></script>
            <script src="jquery.validate.js" type="text/javascript"></script>

            <meta http-equiv="refresh" content="50;url=index.php">
        </head>

        <body>

            <div class="triche">
                <?php 
    // on enregiste les réponses de l'utilisateur.
    $id_user = addUser();
    // Boucle qui survole toutes les questions
    foreach ($questions as $id_question => $question) {
        $reponse = $_POST['question_' . $id_question];
        // echo "Q".$id_question." : ".$reponse."\n"; // debug
        if ($reponse) {
            saveAnswer($id_question, $reponse, $id_user);
        }
    }
    // on obtient les réponses de l'utilisateur dans un tableau
    $query = "SELECT * from reponse where id_utilisateur=" . $id_user;
    $result = $db->query($query);
    $userAnswers = $db->getAssocArrays($result);
    // on affiche une page avec la correction
    $reponsesJustes = 0;
    $reponsesFausses = 0;
开发者ID:Ecodev,项目名称:guillaumetell,代码行数:31,代码来源:index.php


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