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


PHP insertUser函数代码示例

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


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

示例1: registration

function registration()
{
    require_once "mysql.inc.php";
    if (isset($_POST["submit"])) {
        $eingabeVorname = $_POST["vorname"];
        $eingabeNachname = $_POST["nachname"];
        $eingabeBenutzername = $_POST["benutzername"];
        $eingabeEmail = $_POST["email"];
        $eingabePassword = $_POST["password"];
        $passwordmd5 = md5($eingabePassword);
        $eingabePasswordTest = $_POST["passwordTest"];
        $passwordTestmd5 = md5($eingabePasswordTest);
        $eingabeGeburtstag = $_POST["geburtstag"];
        $eingabeWohnort = $_POST["wohnort"];
        $eingabeHochschule = $_POST["hochschule"];
        $eingabeStudienrichtung = $_POST["studienrichtung"];
        if (countUser($eingabeBenutzername) == 0 && $eingabeBenutzername != NULL) {
            if ($passwordmd5 == $passwordTestmd5) {
                if ($eingabeEmail != NULL) {
                    insertUser($eingabeVorname, $eingabeNachname, $eingabeBenutzername, $eingabeEmail, $passwordmd5, $eingabeGeburtstag, $eingabeWohnort, $eingabeHochschule, $eingabeStudienrichtung);
                    echo "Willkommen {$eingabeVorname} {$eingabeNachname}, Sie wurden erfolgreich registriert";
                    $_SESSION["sessionLogin"] = $eingabeBenutzername;
                } else {
                    echo "FEHLER: Keine Email Adresse eingegeben";
                }
            } else {
                echo "FEHLER: Die eingegebenen Passwörter unterscheiden sich.";
            }
        } else {
            echo "FEHLER: Der Benutzer existiert bereits (oder es wurde kein Benutzername eingegeben).";
        }
    }
}
开发者ID:TyLeRRR,项目名称:MusicLibrary,代码行数:33,代码来源:functions.php

示例2: register

function register()
{
    // Xu ly dang ki thanh vien moi
    if (isset($_POST['ok'])) {
        if ($_POST['username'] == "") {
            $error = "Chưa nhập username";
        } else {
            if ($_POST['password'] == "") {
                $error = "Chưa nhập mật khẩu";
            } else {
                if ($_POST['re-password'] == "") {
                    $error = "Chưa nhập lại mật khẩu";
                } else {
                    if ($_POST['fullname'] == "") {
                        $error = "Chưa nhập họ tên";
                    } else {
                        if ($_POST['password'] != $_POST['re-password']) {
                            $error = "Xác thực mật khẩu không đúng";
                        } else {
                            insertUser($_POST['username'], $_POST['password'], $_POST['fullname'], $_POST['year'], $_POST['info']);
                            // Chuyen sang trang login
                            redirect("?controller=user&action=login");
                        }
                    }
                }
            }
        }
    }
    include "view/user/register.php";
}
开发者ID:ndm93bn,项目名称:webbanhang,代码行数:30,代码来源:user.php

示例3: createAccount

function createAccount()
{
    if (!isset($_POST['name']) || !isset($_POST['pass'])) {
        http_response_code(HTTP_BAD_REQUEST);
        echo 'name and pass parameters required';
        return;
    }
    $hash = password_hash($_POST['pass'], PASSWORD_DEFAULT);
    $userid = insertUser($_POST['name'], $hash);
    if ($userid > 0) {
        setSessionUser($userid, $_POST['name']);
    }
}
开发者ID:JoshuaRichards,项目名称:php-todo,代码行数:13,代码来源:user.php

示例4: parseURI

function parseURI()
{
    parse_str($_SERVER['QUERY_STRING'], $params);
    $ustreamUID = $params['ustreamUID'] ? $params['ustreamUID'] : NULL;
    $longitude = $params['longitude'] ? $params['longitude'] : NULL;
    $latitude = $params['latitude'] ? $params['latitude'] : NULL;
    $event = $params['event'] ? $params['event'] : NULL;
    echo "uid: " . $ustreamUID . " latitude: " . $latitude . " longitude: " . $longitude . " event: " . $event . "<br/>";
    if ($ustreamUID && $longitude && $latitude && $event) {
        if (findUser($ustreamUID)) {
            updateUser($ustreamUID, $longitude, $latitude, $event);
        } else {
            insertUser($ustreamUID);
            updateUser($ustreamUID, $longitude, $latitude, $event);
        }
    }
}
开发者ID:nzukoski,项目名称:Misc,代码行数:17,代码来源:parser.php

示例5: addUser

function addUser($userName, $passwordHash, $role)
{
    $dbInfo = getDbForUserIdGeneration();
    $link = $dbInfo ? connect($dbInfo) : null;
    if (!$link || !\database\beginTransaction($link)) {
        return 0;
    }
    $userId = \database\getNextUserId($link);
    if (!$userId) {
        \database\rollbackTransaction($link);
        return 0;
    }
    $existingId = getUserIdByName($userName);
    if ($existingId) {
        \database\rollbackTransaction($link);
        return 0;
    }
    if (!insertUser($userId, $userName, $passwordHash, $role)) {
        \database\rollbackTransaction($link);
        return 0;
    }
    return \database\commitTransaction($link) ? $userId : 0;
}
开发者ID:ekudel,项目名称:vkt,代码行数:23,代码来源:storage.php

示例6: processCSVFile

function processCSVFile($filename = '', $delimiter = ',')
{
    if (!file_exists($filename) || !is_readable($filename)) {
        return FALSE;
    }
    if (($handle = fopen($filename, 'r')) !== FALSE) {
        while (($row = fgetcsv($handle, 1000, $delimiter)) !== FALSE) {
            $rowData = array();
            $rowData[] = $row[0];
            //name
            $rowData[] = $row[1];
            //last name
            $rowData[] = strtolower(substr(trim($row[0]), 0, 1) . trim($row[1]));
            //user_id
            $random_password = wp_generate_password($length = 8, $include_standard_special_chars = false);
            $rowData[] = $random_password;
            //password
            $rowData[] = $row[2];
            //email
            insertUser($rowData);
        }
        fclose($handle);
    }
}
开发者ID:appzzman,项目名称:import-user-from-csv,代码行数:24,代码来源:students_import.php

示例7: fancyDie

if (!function_exists('mysqli_connect')) {
    fancyDie("MySQL library is not installed");
}
$link = @mysqli_connect(TINYIB_DBHOST, TINYIB_DBUSERNAME, TINYIB_DBPASSWORD);
if (!$link) {
    fancyDie("Could not connect to database: " . (is_object($link) ? mysqli_error($link) : (($link_error = mysqli_connect_error()) ? $link_error : '(unknown error)')));
}
$db_selected = @mysqli_query($link, "USE " . constant('TINYIB_DBNAME'));
if (!$db_selected) {
    fancyDie("Could not select database: " . (is_object($link) ? mysqli_error($link) : (($link_error = mysqli_connect_error()) ? $link_error : '(unknown error')));
}
mysqli_query($link, "SET NAMES 'utf8'");
// Create the users table if it does not exist, as well as a default user
if (mysqli_num_rows(mysqli_query($link, "SHOW TABLES LIKE '" . TINYIB_DBUSERS . "'")) == 0) {
    mysqli_query($link, $users_sql);
    insertUser(array('name' => 'admin', 'password' => password_hash(TINYIB_DEFAULTPASS, PASSWORD_BCRYPT), 'admin' => 1));
}
// Create the posts table if it does not exist
if (mysqli_num_rows(mysqli_query($link, "SHOW TABLES LIKE '" . TINYIB_DBPOSTS . "'")) == 0) {
    mysqli_query($link, $posts_sql);
}
// Create the bans table if it does not exist
if (mysqli_num_rows(mysqli_query($link, "SHOW TABLES LIKE '" . TINYIB_DBBANS . "'")) == 0) {
    mysqli_query($link, $bans_sql);
}
# User Functions
function insertUser($user)
{
    global $link;
    mysqli_query($link, "INSERT INTO `" . TINYIB_DBUSERS . "` (`name`, `password`, `admin`) VALUES ('" . mysqli_real_escape_string($link, $user['name']) . "', '" . mysqli_real_escape_string($link, $user['password']) . "', " . boolval($user['admin']) . ")");
    return mysqli_insert_id($link);
开发者ID:Circlepuller,项目名称:TinyIB,代码行数:31,代码来源:database_mysqli.php

示例8: updateMiPerfil

    $resultado = updateMiPerfil($mysqli, $_POST["uId"], $_POST["uName"], $_POST["uPass"], $_POST["uNombre"], $_POST["uApellidos"], $_POST["uDireccion"], $_POST["uEmail"], $_POST["uTelefono"], $_POST["uBio"]);
    echo 'USUARIO ACTUALIZADO -->' . $resultado;
    //print_r($_POST);
}
//DELETE
if (isset($_POST["userId"]) && isset($_POST["act"]) && $_POST["act"] === 'DELETE') {
    $resultado = deleteUser($mysqli, $_POST["userId"]);
    //devolvemos un mensaje de borrado correcto
    echo 'USUARIO ' . $_POST["userId"] . ' BORRADO';
}
if (isset($_POST["act"]) && $_POST["act"] === 'UPDATE' && isset($_POST["uId"]) && isset($_POST["uPass"]) && isset($_POST["uName"])) {
    $resultado = updateUser($mysqli, $_POST["uName"], $_POST["uPass"], $_POST["uId"]);
    echo 'USUARIO ACTUALIZADO -->' . $resultado;
}
if (isset($_POST["act"]) && $_POST["act"] === 'INSERT' && isset($_POST["uPass"]) && isset($_POST["uName"])) {
    $resultado = insertUser($mysqli, $_POST["uName"], $_POST["uPass"]);
    echo 'USUARIO INSERTADO -->' . $resultado;
}
//updateUser2 de casa
/*
    if(isset($_POST["email"]) && ($_POST["email"] !=="") && isset($_POST["bio"]) && ($_POST["bio"] !=="") && isset($_POST["usuario"]) && ($_POST["usuario"] !=="") && isset($_POST["password"]) && ($_POST["password"] !=="")){
          
      $resultado = updateUser2($mysqli,$_POST["usuario"],$_POST["password"],$_POST["email"],$_POST["bio"],$_SESSION['userId']);
}
*/
//nueva funcion update2
if (isset($_POST["act"]) && $_POST["act"] === 'UPDATE2' && isset($_POST["uId"]) && isset($_POST["uPass"]) && isset($_POST["uName"]) && isset($_POST["uEmail"]) && isset($_POST["uBio"])) {
    $resultado = updateUser2($mysqli, $_POST["uName"], $_POST["uPass"], $_POST["uEmail"], $_POST["uBio"], $_POST["uId"]);
    echo 'USUARIO ACTUALIZADO -->' . $resultado;
    //print_r($_POST);
}
开发者ID:virgi1974,项目名称:js-web-developers,代码行数:31,代码来源:userActions.php

示例9: registerUser

function registerUser($username, $password)
{
    global $salt;
    $hash = base64_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, md5($salt), $password, MCRYPT_MODE_CBC, md5(md5($salt))));
    insertUser($username, $hash);
}
开发者ID:CWMCDev,项目名称:Barend,代码行数:6,代码来源:auth.php

示例10: db_query

                 } else {
                     $error[] = "Sorry, there was an error uploading your file.";
                 }
             }
         }
     }
     if (!empty($adimg) && !empty($pictures)) {
         $pictures .= ',' . $adimg;
     }
     if (!empty($adimg) && empty($pictures)) {
         $pictures .= $adimg;
     }
     $update = "update lam_user_profile set pictures = '{$pictures}' where id = {$LastID}";
     $query = db_query($update);
 } else {
     $newid = insertUser($username, $deviceid);
     $query = sprintf("INSERT INTO lam_user_profile SET " . $field . ",\n                                            userid          =   '%d',\n\t\t\t\t\t\t\t\t\t\t\tpictures\t\t=\t'%s',\n\t\t\t\t\t\t\t\t\t\t\tinsert_date\t\t=\t'%s',\n\t\t\t\t\t\t\t\t\t\t\tstatus\t\t\t=\t'%s'\n\t\t\t", $newid, $name, $title, $rate, $profile_type, $sex, $sexuality, $height, $location, $figure, $languages, $interests, $food, $drinks, $dress_style, $occupation, $description, $pictures, $date, $status);
     $LastID = db_query_lastID($query);
     for ($i = 0; $i < 6; $i++) {
         if (!empty($_FILES["UploadImage"]["name"][$i])) {
             $target_dir = "../upload/";
             $uploadOk = 1;
             $target_temp = $target_dir . basename($_FILES["UploadImage"]["name"][$i]);
             $imageFileType = pathinfo($target_temp, PATHINFO_EXTENSION);
             $imagename = $LastID . "lamansion" . $i . "." . $imageFileType;
             $target_file = $target_dir . $imagename;
             // Check if image file is a actual image or fake image
             if (isset($_POST["submit_profile"])) {
                 $check = getimagesize($_FILES["UploadImage"]["tmp_name"][$i]);
                 if ($check !== false) {
                 } else {
开发者ID:dunghand,项目名称:lamansion_2,代码行数:31,代码来源:insert_data.php

示例11: createUser

function createUser($userType, $email, $password, $confirmPassword, $firstname, $lastname)
{
    $return = returnValue();
    // check for empty fields
    if (empty($firstname) || empty($lastname)) {
        $return->value = false;
        $return->msg = "Firstname or lastname is empty";
        return $return;
    }
    //Whitelist name/surname fields
    if (!cleanInput($firstname)) {
        $return->value = false;
        $return->msg = "Invalid First Name";
        return $return;
    }
    if (!cleanInput($lastname)) {
        $return->value = false;
        $return->msg = "Invalid Last Name";
        return $return;
    }
    // check password meets complexity requirement
    if (!checkPasswordComplexity($password)) {
        $return->value = false;
        $return->msg = "Password must be between 8-20 chars, have upper and lower case, as well as digit";
        return $return;
    }
    // validate email format
    if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
        $return->value = false;
        $return->msg = "Invalid email format";
        return $return;
    }
    // check if usertype is among valid values
    if ($userType !== "E" && $userType !== "C") {
        $return->value = false;
        $return->msg = "Invalid user type";
        return $return;
    }
    // check if passwords match
    if ($password !== $confirmPassword) {
        $return->value = false;
        $return->msg = "Passwords do not match";
        return $return;
    }
    $password = hash('sha256', $password);
    getDBCredentials('R');
    $insert = insertUser($userType, $email, $password, $firstname, $lastname);
    // check if db operation failed
    if (!$insert) {
        $return->value = false;
        $return->msg = "DB insert operation failed";
        return $return;
    }
    $return->value = true;
    $return->msg = "Registration successful";
    return $return;
}
开发者ID:efdalustaoglu,项目名称:secure-coding,代码行数:57,代码来源:user.php

示例12: mysqli_query

                $query = "Select * from users where phone_no =" . $_POST['phone3'] . "";
                $result = mysqli_query($db, $query);
                $user[] = mysqli_affected_rows($db);
                $query = "Select * from teams where name ='" . $_POST['team'] . "'";
                $result = mysqli_query($db, $query);
                $team = mysqli_affected_rows($db);
                if ($user[0] > 0 || $user[1] > 0 || $user[2] > 0) {
                    $errors[] = "<p>Entered user already exists.</p>";
                }
                if ($team > 0) {
                    $errors[] = "<p>Entered team name already exists.</p>";
                }
                if (count($errors) == 0) {
                    insertUser($db, 1);
                    insertUser($db, 2);
                    insertUser($db, 3);
                    insertTeam($db);
                }
            } else {
                $errors[] = "<p>Enter unique phone numbers for each team member</p>";
            }
        }
    }
}
?>

<article id="main">
				<header>
					<h2>Register your team</h2>
				</header>
				<section class="wrapper style5" id="r_page">
开发者ID:SouravJaiswal,项目名称:saber-frontend,代码行数:31,代码来源:register.php

示例13: insertUser

    return $req;
}
function insertUser($password, $name, $surname, $dateofbirth, $gender, $adress, $town, $country, $mail, $telnumber, $pseudo)
{
    $req = connexion()->prepare("INSERT INTO users ( password, name, surname, datebirth, gender, adress, town, country, mail, telnumber,pseudo) VALUES ( :password, :name, :surname, :datebirth, :gender, :adress, :town, :country, :mail, :telnumber,:pseudo)");
    $req->bindParam(':password', $password);
    $req->bindParam(':name', $name);
    $req->bindParam(':surname', $surname);
    $req->bindParam(':datebirth', $dateofbirth);
    $req->bindParam(':gender', $gender);
    $req->bindParam(':adress', $adress);
    $req->bindParam(':town', $town);
    $req->bindParam(':country', $country);
    $req->bindParam(':mail', $mail);
    $req->bindParam(':telnumber', $telnumber);
    $req->bindParam(':pseudo', $pseudo);
    $req->execute();
}
function removeUser($userId)
{
    $req = connexion()->prepare('DELETE * FROM users WHERE userId = ?');
    $req->execute(array($userId));
}
function removeMessage($idmessage)
{
    $req = connexion()->prepare('DELETE * FROM message WHERE idmessage = ?');
    $req->execute(array($idmessage));
}
//if($_POST['nom'] && $_POST['prenom'] && $_POST['date'] && $_POST['sex'] && $_POST['address'] && $_POST['ville'] && $_POST['pays'] && $_POST['pseudo'] && $_POST['pass'] && $_POST['mail'])
insertUser($_POST['pass'], $_POST['nom'], $_POST['prenom'], $_POST['date'], $_POST['sex'], $_POST['address'], $_POST['ville'], $_POST['pays'], $_POST['mail'], $_POST['number'], $_POST['pseudo']);
header('Location: ../view/index.php');
开发者ID:Oclean14,项目名称:NuitDeL-Info,代码行数:31,代码来源:controleur.php

示例14: file_get_contents

    $captcha = '';
    if (isset($_POST['g-recaptcha-response'])) {
        $captcha = $_POST['g-recaptcha-response'];
    }
    if (!$captcha) {
        echo '<h2>Please check the the captcha form.</h2>';
        exit;
    }
    $response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=6Ld3rg8TAAAAADLoleP1CehvC4L7M2Bj87F2z5Jv&response=" . $captcha . "&remoteip=" . $_SERVER['REMOTE_ADDR']);
    $decoded_response = json_decode($response, true);
    if ($decoded_response["success"] == FALSE) {
        echo '<script language="javascript">
                                alert("You are Spammer ! Get the F%%k out");
                                window.location="' . SERVER . '";
                              </script>';
    } elseif (!checkUserEmail($email)) {
        insertUser($fname, $lname, $email, $contact, $pass);
        $_SESSION['user'] = $email;
        $row = getUserID($email);
        $_SESSION['id'] = $row['s_id'];
        echo '<script language="javascript">
                                alert("Successfully Registered !!");
                                window.location="' . SERVER . '";
                              </script>';
    } else {
        echo '<script language="javascript">
                                alert("Email Already Inserted !! Sign Up Failed");
                                window.location="' . SERVER . '/signup";
                              </script>';
    }
}
开发者ID:salehOyon,项目名称:Convention-Hall,代码行数:31,代码来源:signUpSuccess.php

示例15: switch

<?php

if (isset($_POST['collection'])) {
    if ($_POST['collection'] == 'users') {
        switch ($_POST['action']) {
            case 'new':
                insertUser($_POST);
                break;
            case 'list':
                listUsers();
                break;
            case 'edit':
                editUser($_POST);
                break;
            case 'delete':
                deleteUser($_POST['mongoid']);
                break;
            case 'login':
                checkLogin($_POST);
                break;
        }
    }
}
class DataBase
{
    static function getDB()
    {
        $connection = new MongoClient("mongodb://82.223.133.87:20002");
        // connect to a remote host at a given port
        $db = $connection->iWonder;
        return $db;
开发者ID:madoos,项目名称:iwonder,代码行数:31,代码来源:dataBase.php


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