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


PHP makeUsername函数代码示例

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


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

示例1: createRows

function createRows()
{
    $dbh = new PDO(DB_DSN, DB_USERNAME, DB_PASSWORD);
    $user_insert = <<<EOF
insert into users 
    (id, active, approved, username, display_name, email) 
    values
    (:id, 1, 1, :username, :full_name, :email)
EOF;
    $user_stmt = $dbh->prepare($user_insert);
    $user_stmt->bindParam(':id', $user_id);
    $user_stmt->bindParam(':username', $username);
    $user_stmt->bindParam(':full_name', $full_name);
    $user_stmt->bindParam(':email', $email);
    $group_insert = <<<EOF
insert into users_groups 
    (id, active, name, user_id) 
    values
    (:id, 1, :username, :user_id)
EOF;
    $group_stmt = $dbh->prepare($group_insert);
    $group_stmt->bindParam(':id', $group_id);
    $group_stmt->bindParam(':username', $username);
    $group_stmt->bindParam(':user_id', $user_id);
    $student_insert = <<<EOF
insert into tg_student
    (user_id, first_name, last_name)
    values
    (:user_id, :first_name, :last_name)        
EOF;
    $student_stmt = $dbh->prepare($student_insert);
    $student_stmt->bindParam(':user_id', $user_id);
    $student_stmt->bindParam(':first_name', $first_name);
    $student_stmt->bindParam(':last_name', $last_name);
    $user_id_result = $dbh->query('select id from users_seq', PDO::FETCH_ASSOC);
    $lastUserId = $user_id_result->fetchColumn();
    $group_id_result = $dbh->query('select id from users_groups_seq', PDO::FETCH_ASSOC);
    $lastGroupId = $group_id_result->fetchColumn();
    for ($i = 1; $i <= STUDENT_LIMIT; $i++) {
        $user_id = $lastUserId + $i;
        $group_id = $lastGroupId + $i;
        $first_name = getName(1);
        $last_name = getName(2);
        $full_name = "{$first_name} {$last_name}";
        $username = makeUsername($first_name, $last_name);
        $email = $username . '@appstate.edu';
        $user_stmt->execute();
        $group_stmt->execute();
        $student_stmt->execute();
        echo "Created user {$username}\n";
    }
    $user_seq_stmt = 'update users_seq set id=' . $user_id;
    $dbh->exec($user_seq_stmt);
    $group_seq_stmt = 'update users_groups_seq set id=' . $group_id;
    $dbh->exec($group_seq_stmt);
}
开发者ID:AppStateESS,项目名称:tailgate,代码行数:56,代码来源:create-students.php

示例2: signup

function signup()
{
    global $Userservice;
    global $SKADATE_BOL_AccountTypeToGenderDao;
    global $BOL_AvatarService_inst;
    //global $EmailVerifyService;
    global $SKAPI_BOL_Service_inst;
    global $language;
    $app = \Slim\Slim::getInstance();
    $app->response->headers->set('Content-Type', 'application/json');
    $app->response->setStatus(200);
    //Lang Call Start
    $hammu_lang_id = $app->request()->params("lang_id");
    if (!empty($hammu_lang_id)) {
        getCurrentLanguages($hammu_lang_id);
    }
    //Lang Call end
    //$match_sex = $app->request()->params('match_sex');
    //$preferences_or_services = $app->request()->params('preferences_or_services');
    //$photo = $app->request()->params('photo');
    //$photo_data = $_FILES["photo"];
    $username = $app->request()->params('username');
    $email = $app->request()->params('email');
    $password = $app->request()->params('password');
    $realname = $app->request()->params('realname');
    $sex = $app->request()->params('sex');
    $i_m_using = $app->request()->params(HAMMU_DB_IM_USING_HAMMU_AS_KEY);
    $googlemap_location = $app->request()->params('googlemap_location');
    $birthdate = $app->request()->params('birthdate');
    $mobile_number = $app->request()->params(HAMMU_DB_MOBILE_NUMBER_KEY);
    $meeting_point = $app->request()->params(HAMMU_DB_METTING_POINT_KEY);
    $pay_pal_address = $app->request()->params(HAMMU_DB_PAYMENT_TYPE_KEY);
    //hardik edited
    $HOTEL_SERVICE = $app->request()->params(HAMMU_HOTEL_SERVICE);
    $HOME_VISIT = $app->request()->params(HAMMU_HOME_VISIT);
    $HAMMU_AVAILABLE_AT = urldecode($app->request()->params(HAMMU_AVAILABLE_AT));
    $SECRET_FANTASY = $app->request()->params(HAMMU_SECRET_FANTASY);
    $HAMMU_LANGUAGE = $app->request()->params(HAMMU_LANGUAGE);
    $HAMMU_COUNTRY = $app->request()->params(HAMMU_COUNTRY);
    //
    $token = $app->request()->params('token');
    $type = $app->request()->params('type');
    $preferences = $app->request()->params(HAMMU_DB_SERVICES_KEY);
    $lang = $app->request()->params(HAMMU_LANG);
    $deviceId = $token;
    $deviceType = $type;
    $preferenceArr = explode(",", $preferences);
    $langArr = explode(",", $lang);
    //print_r($preferenceArr);
    $preVal = 0;
    foreach ($preferenceArr as $key => $value) {
        $preVal = $preVal + $value;
    }
    $langVal = 0;
    foreach ($langArr as $key => $value) {
        $langVal = $langVal + $value;
    }
    //
    $HAMMU_AVAILABLE_ATArr = explode(",", $HAMMU_AVAILABLE_AT);
    //print_r($HAMMU_AVAILABLE_ATArr);
    // die;
    //    $preVal1 = 0;
    //    foreach ($HAMMU_AVAILABLE_ATArr as $key => $value) {
    //        $preVal1 = $preVal1 + $value;
    //    }
    $data["email"] = urldecode($email);
    $data["username"] = $username;
    $data['password'] = $password;
    $data["googlemap_location"] = $googlemap_location;
    $data["birthdate"] = $birthdate;
    $data[HAMMU_DB_MOBILE_NUMBER_KEY] = $mobile_number;
    $data["sex"] = $sex;
    $today_date_timestamp = strtotime(date("d-m-Y"));
    $birth_date_timestamp = strtotime($birthdate);
    if ($birth_date_timestamp > $today_date_timestamp) {
        $message = $language->text("hammu", "signup_error_prorper_date");
        //"Please Provide Proper Date!";
        $return_data = array("response_status" => "0", "response_message" => $message);
        $app->response->setBody(json_encode($return_data));
    } else {
        $crdata = checkuserexists($data);
        if (count($crdata) > 0) {
            $app->response->setBody(json_encode($crdata));
        } else {
            $username = trim(preg_replace('/[^\\w]/', '', $username));
            $username = makeUsername($username);
            $data['realname'] = $username;
            $newUser = false;
            $accountdata = $SKADATE_BOL_AccountTypeToGenderDao->findByGenderValue($sex);
            $accounttype = $accountdata[0]->accountType;
            $user = $Userservice->createUser($username, $password, $data["email"], $accounttype, false);
            $check_exist_value = $SKAPI_BOL_Service_inst->findValueExistOrNot($user->id);
            if ($check_exist_value) {
                $table_id = $check_exist_value[0]->id;
                if ($table_id) {
                    $user_skapi_id = $check_exist_value[0]->id;
                } else {
                    $user_skapi_id = "";
                }
            } else {
//.........这里部分代码省略.........
开发者ID:bhushansonar,项目名称:hammu,代码行数:101,代码来源:index_4_7_2015.php

示例3: facebookLogin

function facebookLogin()
{
    //$data = $_POST;
    global $Userservice;
    global $QuestionService;
    global $getPluginManager;
    global $BOL_AvatarService_inst;
    global $getEventManager;
    $data = array();
    $app = \Slim\Slim::getInstance();
    $app->response->headers->set('Content-Type', 'application/json');
    $app->response->setStatus(200);
    $facebookid = $app->request()->params('facebookid');
    $email = $app->request()->params('email');
    $sex = $app->request()->params('gender');
    $birthdate = $app->request()->params('birthdate');
    $token = $app->request()->params('token');
    $type = $app->request()->params('type');
    $deviceId = $token;
    $deviceType = $type;
    $facebookId = $facebookid;
    //        $data = json_decode($params['data'], true);
    //    $facebookId = (int) $data['facebookid'];
    //    $email = (int) $data['email'];
    //    echo "got her";
    //    $authAdapter = new OW_RemoteAuthAdapter($facebookId, 'facebook');
    //echo "got her 2";
    $email = trim($email);
    $params = array("email" => $email, "deviceid" => $deviceId, "device_type" => $deviceType);
    $return_data = checkfacebookuserexists($params);
    //echo "got here 41";
    //print_r($return_data);
    if ($return_data) {
        // print_r($return_data);
        $app->response->setBody(json_encode($return_data));
        // exit();
    } else {
        //echo "got her 1";
        $password = uniqid();
        $tmpUsername = explode('@', $email);
        $username = $tmpUsername[0];
        $username = trim(preg_replace('/[^\\w]/', '', $username));
        //echo "got her 2";
        $username = makeUsername($username);
        // echo "got her 3";
        $newUser = false;
        $data['realname'] = $username;
        $accountype = $sex == "female" ? "8cc28eaddb382d7c6a94aeea9ec029fb" : "808aa8ca354f51c5a3868dad5298cd72";
        //(int) $data["sex"]; //(1 = Female, 2 = Male)
        if ($accountype == "8cc28eaddb382d7c6a94aeea9ec029fb") {
            $sex = 2;
            //$type = "services";
            $sex_type = "lady";
        } else {
            //$type = "preferences";
            $sex = 1;
            $sex_type = "gentleman";
        }
        $data["sex"] = $sex;
        //$accountype;
        $UserDob = date("Y/m/d", strtotime($birthdate));
        $data["birthdate"] = $UserDob;
        // echo "got her 3 1";
        // echo "come";
        $user = $Userservice->createUser($username, $password, $email, $accountype, true);
        $newUser = true;
        // echo "got her 3 1 2";
        //        if (!empty($data["address"])) {
        //            $urlencode_address = urlencode($data["address"]);
        //            $geocode = file_get_contents('http://maps.google.com/maps/api/geocode/json?address=' . $urlencode_address . '&sensor=false');
        //            $output = json_decode($geocode);
        ////echo print_r(json_encode($output->results));
        //            if (!empty($output->results[0]->formatted_address)) {
        //                $data['googlemap_location']['address'] = $output->results[0]->formatted_address;
        //                $data['googlemap_location']['latitude'] = $output->results[0]->geometry->location->lat;
        //                $data['googlemap_location']['longitude'] = $output->results[0]->geometry->location->lng;
        //                $data['googlemap_location']['northEastLat'] = $output->results[0]->geometry->bounds->northeast->lat;
        //                $data['googlemap_location']['northEastLng'] = $output->results[0]->geometry->bounds->northeast->lng;
        //                $data['googlemap_location']['southWestLat'] = $output->results[0]->geometry->bounds->southwest->lat;
        //                $data['googlemap_location']['southWestLng'] = $output->results[0]->geometry->bounds->southwest->lng;
        //                $data['googlemap_location']['json'] = json_encode($output->results[0]);
        //            }
        //        }
        //        echo "got here";
        $QuestionService->saveQuestionsData(array_filter($data), $user->id);
        $avatarUrl = 'http://graph.facebook.com/' . $facebookid . '/picture?type=large&height=400&width=400';
        //$pluginfilesDir = OW_DIR_ROOT;
        $pluginfilesDir = $getPluginManager->getPlugin('skapi')->getPluginFilesDir();
        $ext = 'jpg';
        $tmpFile = $pluginfilesDir . uniqid('avatar-') . (empty($ext) ? '' : '.' . $ext);
        // echo "cal copy";
        //move_uploaded_file($avatarUrl, $tmpFile);
        //  if (!file_exists($path)) {
        //mkdir($pluginfilesDir, 0777);
        chmod($pluginfilesDir, 0777);
        //  }
        //        error_reporting(E_ALL);
        //        ini_set('display_errors', true);
        //copy($avatarUrl, $tmpFile);
        @copy($avatarUrl, $tmpFile);
//.........这里部分代码省略.........
开发者ID:bhushansonar,项目名称:hammu,代码行数:101,代码来源:index_29_5_2015.php

示例4: signup

function signup()
{
    global $Userservice;
    global $SKADATE_BOL_AccountTypeToGenderDao;
    global $BOL_AvatarService_inst;
    $app = \Slim\Slim::getInstance();
    $app->response->headers->set('Content-Type', 'application/json');
    $app->response->setStatus(200);
    //$match_sex = $app->request()->params('match_sex');
    //$preferences_or_services = $app->request()->params('preferences_or_services');
    //$photo = $app->request()->params('photo');
    //$photo_data = $_FILES["photo"];
    $username = $app->request()->params('username');
    $email = $app->request()->params('email');
    $password = $app->request()->params('password');
    $realname = $app->request()->params('realname');
    $sex = $app->request()->params('sex');
    $i_m_using = $app->request()->params(HAMMU_DB_IM_USING_HAMMU_AS_KEY);
    $googlemap_location = $app->request()->params('googlemap_location');
    $birthdate = $app->request()->params('birthdate');
    $mobile_number = $app->request()->params(HAMMU_DB_MOBILE_NUMBER_KEY);
    $meeting_point = $app->request()->params(HAMMU_DB_METTING_POINT_KEY);
    $pay_pal_address = $app->request()->params(HAMMU_DB_PAYMENT_TYPE_KEY);
    $token = $app->request()->params('token');
    $type = $app->request()->params('type');
    $preferences = $app->request()->params(HAMMU_DB_SERVICES_KEY);
    $deviceId = $token;
    $deviceType = $type;
    $preferenceArr = explode(",", $preferences);
    $preVal = 0;
    foreach ($preferenceArr as $key => $value) {
        $preVal = $preVal + $value;
    }
    $data["email"] = urldecode($email);
    $data["username"] = $username;
    $data['password'] = $password;
    $data["googlemap_location"] = $googlemap_location;
    $data["birthdate"] = $birthdate;
    $data[HAMMU_DB_MOBILE_NUMBER_KEY] = $mobile_number;
    $data["sex"] = $sex;
    $today_date_timestamp = strtotime(date("d-m-Y"));
    $birth_date_timestamp = strtotime($birthdate);
    if ($birth_date_timestamp > $today_date_timestamp) {
        $return_data = array("response_status" => "0", "response_message" => "Please Provide Proper Date!");
        $app->response->setBody(json_encode($return_data));
    } else {
        $crdata = checkuserexists($data);
        if (count($crdata) > 0) {
            $app->response->setBody(json_encode($crdata));
        } else {
            $username = trim(preg_replace('/[^\\w]/', '', $username));
            $username = makeUsername($username);
            $data['realname'] = $username;
            $newUser = false;
            $accountdata = $SKADATE_BOL_AccountTypeToGenderDao->findByGenderValue($sex);
            $accounttype = $accountdata[0]->accountType;
            $user = BOL_UserService::getInstance()->createUser($username, $password, $data["email"], $accounttype, false);
            $newUser = true;
            unset($data['email']);
            unset($data['password']);
            unset($data['username']);
            //Geo location settings on address
            $price = $app->request()->params(HAMMU_DB_PRICE_KEY);
            if (!empty($price)) {
                $final_price = $price;
            } else {
                $final_price = "";
            }
            if (!empty($data["googlemap_location"])) {
                $urlencode_address = urlencode($data["googlemap_location"]);
                $geocode = file_get_contents('http://maps.google.com/maps/api/geocode/json?address=' . $urlencode_address . '&sensor=false');
                $output = json_decode($geocode);
                if (!empty($output->results[0]->formatted_address)) {
                    $data_location[HAMMU_DB_PRICE_KEY] = $final_price;
                    $data_location['googlemap_location']['address'] = $output->results[0]->formatted_address;
                    $data_location['googlemap_location']['latitude'] = $output->results[0]->geometry->location->lat;
                    $data_location['googlemap_location']['longitude'] = $output->results[0]->geometry->location->lng;
                    $data_location['googlemap_location']['northEastLat'] = $output->results[0]->geometry->bounds->northeast->lat;
                    $data_location['googlemap_location']['northEastLng'] = $output->results[0]->geometry->bounds->northeast->lng;
                    $data_location['googlemap_location']['southWestLat'] = $output->results[0]->geometry->bounds->southwest->lat;
                    $data_location['googlemap_location']['southWestLng'] = $output->results[0]->geometry->bounds->southwest->lng;
                    $data_location['googlemap_location']['json'] = json_encode($output->results[0]);
                    $data_location['birthdate'] = $data["birthdate"];
                    $data_location['sex'] = $sex;
                    $data_location['realname'] = $realname;
                    $data_location[HAMMU_DB_MOBILE_NUMBER_KEY] = $data[HAMMU_DB_MOBILE_NUMBER_KEY];
                    $data_location[HAMMU_DB_SERVICES_KEY] = $preVal;
                    $data_location[HAMMU_DB_PAYMENT_TYPE_KEY] = $pay_pal_address;
                    $data_location[HAMMU_DB_IM_USING_HAMMU_AS_KEY] = $i_m_using;
                    $data_location[HAMMU_DB_METTING_POINT_KEY] = $meeting_point;
                }
            }
            if ($i_m_using == "1") {
                array_shift($data_location);
            }
            //            print_r($data_location);
            //            exit;
            BOL_QuestionService::getInstance()->saveQuestionsData(array_filter($data_location), $user->id);
            if (!empty($_FILES)) {
                $files = $_FILES;
//.........这里部分代码省略.........
开发者ID:hardikamutech,项目名称:hammu,代码行数:101,代码来源:index_2_6_2015_second.php


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