本文整理汇总了PHP中addNewUser函数的典型用法代码示例。如果您正苦于以下问题:PHP addNewUser函数的具体用法?PHP addNewUser怎么用?PHP addNewUser使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了addNewUser函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Push_New_Entries
function Push_New_Entries()
{
print '<br>Push_New_Entries<br>';
$attribute_changer = $GLOBALS['AttributeChangerPlugin'];
$PLUGIN_FILES_DIR = $attribute_changer->AttributeChangerData['PLUGIN_FILES_DIR'];
$AttributeChangerData = $attribute_changer->AttributeChangerData;
$case_array = $AttributeChangerData['case_array'];
$Session = $attribute_changer->Current_Session;
foreach ($Session->Committed_New_Entries as $email_key => $new_attributes_and_values) {
$exists = Sql_Fetch_Row_Query(sprintf('select id from %s where email = "%s"', $AttributeChangerData['tables']['user'], $email_key));
if ($exists[0]) {
//$Failed_New_Entries[$email_key] = $new_attributes_and_values;
} else {
$new_user_id = addNewUser($email_key);
$new_value_array = array();
foreach ($new_attributes_and_values as $attribute_id => $attribute_value_id) {
if ($case_array[$Session->attribute_list[$attribute_id]['type']] == 'case_3') {
$new_value_array = array();
foreach ($attribute_value_id as $individual_id) {
if (array_key_exists($individual_id, $Session->attribute_list[$attribute_id]['allowed_value_ids'])) {
array_push($new_value_array, $individual_id);
}
}
$proper_this_attribute_value = implode(',', $new_value_array);
} else {
if ($case_array[$Session->attribute_list[$attribute_id]['type']] == 'case_2') {
if (array_key_exists($attribute_value_id, $Session->attribute_list[$attribute_id]['allowed_value_ids'])) {
$proper_this_attribute_value = $attribute_value_id;
}
} else {
///HERE IS MESSSSSSSSY
if (in_array($attribute_value_id, $Session->New_Entry_List[$email_key][$attribute_id])) {
$proper_this_attribute_value = $attribute_value_id;
}
}
}
print '<br>new user: ' . $email_key . ' attribute id: ' . $attribute_id . ' value :' . $proper_this_attribute_value . '<br>';
//need a way for 'STICKY' attributes
SaveCurrentUserAttribute($new_user_id, $attribute_id, $proper_this_attribute_value);
//saveUserAttribute($new_user_id, $attribute_id, $proper_this_attribute_value);
}
}
}
}
示例2: connectDatabase
if (!preg_match("/^[a-zA-Z ]*\$/", $_POST['first_name']) || !preg_match("/^[a-zA-Z ]*\$/", $_POST['last_name'])) {
$nameErr = "Only letters and white space allowed";
} else {
$first_name = $_POST["first_name"];
$last_name = $_POST["last_name"];
$email = $_POST["email"];
$phone = $_POST["phone"];
$pword = $_POST["pword"];
$cpword = $_POST["cpword"];
if ($pword != $cpword) {
echo '<font color = "red">Passwords do not match</font><br>';
}
$link = connectDatabase();
$check = checkNewUser($email, $link);
if (FALSE == $check) {
$flag = addNewUser($first_name, $last_name, $email, $phone, $pword, $link);
if (FALSE == $flag) {
echo '<font color = "red">Oops techie issues !!</font><br>';
} else {
echo "<script type='text/javascript'>alert('User " . $email . " was created successfully.');</script>";
closeConn($link);
}
} else {
echo "<script type='text/javascript'>alert('User " . $email . " already registered.');</script>";
}
}
}
}
}
}
}
示例3: readPostVar
if (isset($_POST['user_ufield10'])) {
$arrValuesToUpdate['user_ufield10'] = readPostVar('user_ufield10');
}
}
if (isset($_POST['user_notes'])) {
$arrValuesToUpdate['user_notes'] = readPostVar('user_notes');
}
$bIsUserNameDuplicated = getRecordCount($srv_settings['table_prefix'] . 'users', 'username=' . $arrValuesToUpdate['username'] . (!$bIsNewUser ? ' AND id<>' . $arrValuesToUpdate['id'] : '')) > 0;
if ($bIsUserNameDuplicated) {
$g_vars['page']['errors'] .= $lngstr['err_username_duplicate'];
}
if ($g_vars['page']['errors']) {
include_once $DOCUMENT_PAGES . "manageusers-2.inc.php";
} else {
if ($bIsNewUser) {
$f_id = addNewUser($arrValuesToUpdate, array(), true);
} else {
updateUser($arrValuesToUpdate);
}
if (isset($_POST['group']) && !empty($_POST['group'][0])) {
$arrGroupIDsNew = readPostVar('group');
unset($arrGroupIDsNew[0]);
$arrGroupIDsToAdd = array();
$arrGroupIDsToDelete = array();
//9917//9917
$i_rSet1 = $g_db->Execute("SELECT " . $srv_settings['table_prefix'] . "groups_users.groupid FROM " . $srv_settings['table_prefix'] . "groups_users WHERE id=" . $f_id);
if (!$i_rSet1) {
showDBError(__FILE__, 1);
} else {
while (!$i_rSet1->EOF) {
if (!empty($arrGroupIDsNew[$i_rSet1->fields['groupid']])) {
示例4: addNewUser
<?php
include '../../functions.php';
include '../../connectdb.php';
//Get data from the former page via POST method
$first_name = $_POST["first-name"];
$last_name = $_POST["last-name"];
$email = $_POST["email"];
$password = $_POST["password"];
//Add a new user to the database
addNewUser($first_name, $last_name, $email, $password);
//Go to the login page
header("Location: ../../login.php");
示例5: addNewUser
$alertArr[] = $ALERT['PASS_TOSHORT'];
}
if (strlen($_POST['email']) > 140) {
$alertArr[] = $ALERT['EMAIL_TOLONG'];
}
if ($_POST['email'] && !emailValid($_POST['email'])) {
$alertArr[] = $ALERT['EMAIL_INVALID'];
}
if ($_POST['email'] && emailExist($_POST['email'])) {
$alertArr[] = $ALERT['EMAIL_TAKEN'];
}
if (count($alertArr) == 0) {
// Add the new account to the database
// (password has already been encrypted using javascript)
$_SESSION['reguname'] = $_SESSION['username'];
$_SESSION['regresult'] = addNewUser($_POST['pass1'], $_POST['email']);
$_SESSION['registered'] = true;
$refresh = $HTTP_SERVER_VARS[PHP_SELF];
exit(include_once HTML_PATH . "html_refresh.php");
// stop script
}
}
$alert = displayAlert($alertArr);
if ($_POST['pass_field_curr']) {
$_POST['pass_field_curr'] = "";
}
if ($_POST['pass_field_1']) {
$_POST['pass_field_1'] = "";
}
if ($_POST['pass_field_2']) {
$_POST['pass_field_2'] = "";
示例6: Sql_Table_exists
$subselect_where = " where " . $tables["list"] . ".owner = 0";
break;
}
if ($access != "all") {
$delete_message = '<br />' . $GLOBALS['I18N']->get('Delete will delete user from the list') . '<br />';
} else {
$delete_message = '<br />' . $GLOBALS['I18N']->get('Delete will delete user and all listmemberships') . '<br />';
}
$usegroups = Sql_Table_exists("groups") && Sql_Table_exists('user_group');
if ($_POST["change"] && ($access == "owner" || $access == "all")) {
if (!verifyToken()) {
print Error($GLOBALS['I18N']->get('No Access'));
return;
}
if (!$id) {
$id = addNewUser($_POST['email']);
$newuser = 1;
}
if (!$id) {
print $GLOBALS['I18N']->get('Error adding user, please check that the user exists');
return;
}
# read the current values to compare changes
$old_data = Sql_Fetch_Array_Query(sprintf('select * from %s where id = %d', $tables["user"], $id));
$old_data = array_merge($old_data, getUserAttributeValues('', $id));
# and membership of lists
$req = Sql_Query("select * from {$tables["listuser"]} where userid = {$id}");
while ($row = Sql_Fetch_Array($req)) {
$old_listmembership[$row["listid"]] = listName($row["listid"]);
}
while (list($key, $val) = each($struct)) {
示例7: array
if ($action == "Regret button") {
$props = array('u_id' => $_POST['u_id'], 'r_id' => $_POST['r_id']);
regretAndBecomeFriends($props);
print json_encode($_POST['u_id']);
return;
}
if ($action == "Form Filling") {
$props = $_POST;
$props['u_id'] = isset($_SESSION['loggedInUser']['u_id']) ? $_SESSION['loggedInUser']['u_id'] : null;
$props['u_password'] = md5($props['u_password']);
if ($_FILES) {
$props['u_picture'] = move_files($_FILES['file1']);
$props['u_secret_pic'] = move_files($_FILES['file2']);
}
if (!$props['u_id']) {
$resultArr = addNewUser($props);
} else {
$resultArr = updateExistingUser($props);
}
if (isset($resultArr['u_id'])) {
$_SESSION['loggedInUser'] = $resultArr;
}
print json_encode($resultArr);
return;
}
/*if($action == "Select All Active Users") {
if($_GET['order_by'] == "ASC") {
$users = selectAllActiveUsersASC($_SESSION['loggedInUser']['u_id']);
print json_encode($users);
return;
} else {
示例8: strlen
$email = $_POST["email"];
}
} else {
$errors['email'] = "поле Email не может быть пустым";
}
if (!empty($_POST['pass'])) {
$pass = strlen($_POST['pass']);
//Проверяем длинну пароля
if ($pass < 6) {
$errors['pass'] = "Пароль должен содержать минимум 6 символов";
} else {
$pass = md5($_POST["pass"]);
}
} else {
$errors['pass'] = "пароль не может быть пустым";
}
//Тут уже отправка
if (empty($errors)) {
$res = addNewUser($login, $email, $pass, $regitrationdate);
$result = 'Пользователь успешно зарегистрирован';
}
}
include 'view/index.php';
//Тесты
//$link = DBconnect();
//$res = mysql_query("SELECT COUNT * FROM users", $link);
//$row = mysql_fetch_row($res);
//$users = $row[0];
//echo $users;
$result = mysql_query("SELECT * FROM users");
$num_rows = mysql_num_rows($result);
示例9: md5
} else {
return true;
}
}
/**
* Determines whether or not to show to sign-up form
* based on whether the form has been submitted, if it
* has, check the database for consistency and create
* the new account.
*/
if (isset($_POST['subjoin'])) {
if (checkSubmitValues()) {
/* Add the new account to the database */
$_SESSION['username'] = $_POST['user'];
$_SESSION['password'] = md5($_POST['pass']);
$_SESSION['reguid'] = addNewUser(trim($_POST['user']), trim($_POST['pass']), trim($_POST['email']));
$_SESSION['registered'] = true;
header('Location: ' . $CFG->wwwroot . '/modules/frontpage/frontpage.php');
return;
}
// Otherwise will fall through to show the form, with the error set.
} else {
if (isset($_GET['confirm'])) {
if (confirmRegistration($_GET['confirm'])) {
$t->assign('message', 'Thank you for confirming your registration.');
$t->display('registerConfirm.tpl');
die;
} else {
$t->assign('message', 'This registration is no longer valid. Please begin your registration again.');
$t->display('registerConfirm.tpl');
die;
示例10: getContent
/**
* Функция которая возвращает массив информации
* о просматриваемой страничка с типом $type
* и $id
* @param null $type
* @param null $id
* @return array
*/
function getContent($type = null, $id = null)
{
/*Если параметры null, то выводим страничку по умолчанию*/
if ($type == null) {
$type = DEFAULT_PAGE;
}
if (isset($_POST['new_submit']) && $_POST['new_submit']) {
$type = NEW_SUBMIT_TYPE;
}
$loginStatus = LOGIN_ALREADY;
if (isset($_GET['unlogin']) && $_GET['unlogin']) {
unlogin();
$loginStatus = LOGIN_EXIT;
}
if ($_POST['submit']) {
$loginStatus = login($_POST['login'], $_POST['password']);
}
/*Инициализируем информацию в зависимости от типа */
$array = array();
switch ($type) {
/*Если тип страницы - текстовая*/
case TEXT_TYPE:
/*Если id не инициализирован выводим главную.
Иначе страницу с id*/
if ($id == null) {
$id = MAIN_PAGE_TEXT_ID;
}
/*Получаем текст из базы*/
$page = getTextContent($id);
$array['content'] = $page['text'];
break;
case CATALOG_TYPE:
/*Если id не инициаизирован */
if (!($id > 0)) {
/*Выбираем первый попавшийся театр*/
$sql = "SELECT id from theatures LIMIT 1";
$res = mysql_query($sql);
$row = mysql_fetch_array($res);
$id = $row['id'];
}
/*Получаем спектали из базы*/
$items = getCatalogItems($id);
//$parent_item = get;
/*Вставляем их в ш для красивого вывода*/
$array['content'] = (include 'templates/content/item/items.php');
break;
case ITEM_TYPE:
$item = getItem($id);
$array['content'] = (include 'templates/content/item/item_big.php');
break;
case NEW_REG_TYPE:
$array['content'] = (include 'templates/content/login/newreg.php');
break;
case NEW_SUBMIT_TYPE:
//Если пароли совпадают
if ($_POST['new_password1'] == $_POST['new_password2']) {
if (addNewUser($_POST['new_login'], $_POST['new_password2'])) {
$array['content'] = 'Поздравляем вы зарегистерированы';
} else {
$array['content'] = 'Такой пользователь уже есть';
}
} else {
$array['content'] = 'Пароли не совпадают';
}
break;
case ADD_CART_TYPE:
addToCart($id);
$cartItems = getCartItems();
$sum = calculateCart();
$array['content'] = (include 'templates/content/cart/cart.php');
break;
case CART_TYPE:
$cartItems = getCartItems();
$sum = calculateCart();
$array['content'] = (include 'templates/content/cart/cart.php');
break;
/*Удаляем одну штуку*/
/*Удаляем одну штуку*/
case REMOVE_CART_TYPE:
$cartItems = getCartItems();
$sum = calculateCart();
removeFromCart($id);
$array['content'] = (include 'templates/content/cart/cart.php');
break;
/*Удаляем весь товар*/
/*Удаляем весь товар*/
case REMOVE_ITEM_CART_TYPE:
$cartItems = getCartItems();
$sum = calculateCart();
removeFromCart($id, CART_REMOVE_ALL);
$array['content'] = (include 'templates/content/cart/cart.php');
break;
//.........这里部分代码省略.........
示例11: die
/* Check if username is already in use */
if (usernameTaken($_POST['user'])) {
$use = $_POST['user'];
die("<br>\n <div align=center>\n <center>\n <table border=1 cellpadding=5 cellspacing=0 style=border-collapse: collapse id=AutoNumber1 bordercolor=#FFFFFF>\n <tr>\n <td width=100% bgcolor=#666666>\n \n <font color=#FF0000><b>ERROR:</b></font> Sorry, the username: <strong>{$use}</strong> is already taken, please pick another one!<br>\n </tr>\n </table>\n </center>\n</div>");
}
/* Check pass length */
if (strlen($_POST['pass']) < 5) {
die("<br>\n <div align=center>\n <center>\n <table border=1 cellpadding=5 cellspacing=0 style=border-collapse: collapse id=AutoNumber1 bordercolor=#FFFFFF>\n <tr>\n <td width=100% bgcolor=#666666>\n \n <font color=#FF0000><b>ERROR:</b></font> Sorry, the password is shorter than 5 characters, please make it longer!<br>\n </tr>\n </table>\n </center>\n</div>");
}
if (strlen($_POST['pass']) > 32) {
die("<br>\n <div align=center>\n <center>\n <table border=1 cellpadding=5 cellspacing=0 style=border-collapse: collapse id=AutoNumber1 bordercolor=#FFFFFF>\n <tr>\n <td width=100% bgcolor=#666666>\n \n <font color=#FF0000><b>ERROR:</b></font> Sorry, the password is longer than 32 characters, please shorten it!<br>\n </tr>\n </table>\n </center>\n</div>");
}
/* Add the new account to the database */
$md5pass = md5($_POST['pass']);
$_SESSION['reguname'] = $_POST['user'];
$_SESSION['regresult'] = addNewUser($_POST['user'], $md5pass);
$_SESSION['registered'] = true;
return;
} else {
/**
* This is the page with the sign-up form, the names
* of the input fields are important and should not
* be changed.
*/
if (!$_GET['ref']) {
$_GET['ref'] = 0;
}
?>
<html>
<body>
示例12: _footer
<tr>
<td colspan="2" align="center"><input type="submit" /></td>
</tr>
<table>
</form>
</div>
<?php
echo _footer();
// Create new user, after submiting the form
} elseif ($_GET['act'] == 'createNewUser') {
$dbControlHandler = new SQLiteDatabase(DB_CONTROL_FILE);
// Create Users Table
$dbControlHandler->query("CREATE TABLE users(id INTEGER PRIMARY KEY, username CHAR(60), salt CHAR(10), password CHAR(32), permissions INTEGER);");
$userName = $_POST['userName'];
$userPw = $_POST['password'];
addNewUser($dbControlHandler, $userName, $userPw, GLOBAL_ADMIN);
$dbTrackHandler = new SQLiteDatabase(DB_TRACK_FILE);
// Create Tracking Table
$dbTrackHandler->query("BEGIN;\r\n\t\tCREATE TABLE computers(id INTEGER PRIMARY KEY, name CHAR(250), region INTEGER, x INTEGER, y INTEGER, comment INTEGER, icon CHAR(150), laststatus INTEGER, lastsignal INTEGER);\r\n\t\tCREATE TABLE miscrecords(id INTEGER PRIMARY KEY, name CHAR(250), timestamp INTEGER, recordtype INTEGER, data TEXT);\r\n\t\tCREATE TABLE trackrecords(id INTEGER PRIMARY KEY, name CHAR(250), time INTEGER, status INTEGER);\r\nCREATE TABLE zones(id INTEGER PRIMARY KEY, region_name CHAR(255), region_width INTEGER, region_height INTEGER, region_map_img CHAR(255));\r\n\t\tCOMMIT;");
echo _header(_('New Database Setup'));
?>
<div id="yui-main">
<h1>Database Creation Completed!</h1>
<div>
<p>The Database Creation Process is completed. Please login to your root account!</p>
</div>
</div>
<?php
echo _footer();
} else {
die('Not Implemented!');
示例13: Get_Attribute_File_Column_Match
}
if ($attribute_changer->Current_Session->file_is_good == false) {
print '</body></html>';
} else {
$print_html = Get_Attribute_File_Column_Match();
$attribute_changer->Serialize_And_Store();
print '<html><body>' . $print_html . '</body></html>';
}
}
if (isset($_POST['resetTable'])) {
$query = sprintf("truncate table %s", $AttributeChangerData['tables']['user']);
$ret1 = Sql_Query($query);
$query = sprintf("truncate table %s", $GLOBALS['tables']['user_attribute']);
$ret2 = Sql_Query($query);
include_once $PLUGIN_FILES_DIR . 'New_And_Modify_Entry_Processor.php';
$id = addNewUser('djarcaig@milburnlaw.ca@');
if (!$id) {
print "error with user clear<br>";
return -1;
}
SaveCurrentUserAttribute($id, '1', 'fake name');
SaveCurrentUserAttribute($id, '1', '1');
}
if (isset($_POST['submitTest']) && $_POST['submitTest'] == 'submitTest') {
include_once $PLUGIN_FILES_DIR . 'Upload_Test_File_Processor.php';
if (!isset($attribute_changer->Current_Session) || $attribute_changer->Current_Session == null) {
print "<html><html>";
}
if ($attribute_changer->Current_Session->file_is_good == false) {
print '</body></html>';
} else {
示例14: session_start
require_once "connection.php";
session_start();
$form = $_GET['q'];
checkLogin($username, $password);
if ($form == "login") {
$username = $_POST['login-username'];
$password = $_POST['login-password'];
if (checkLogin($username, $password)) {
//if($username == "admin" && $password == "1234") {
// Successfully login
$_SESSION['username'] = $username;
header("location:index.php");
} else {
header("location:login.php?login=error");
}
} else {
if ($form == "logout") {
session_destroy();
header("location:index.php");
} else {
if ($form == "register") {
$username = $_POST["register-username"];
$password = $_POST["register-password"];
$repeatpassword = $_POST["register-repeat-password"];
if ($password == $repeatpassword) {
addNewUser($username, $password);
}
header("location:index.php");
}
}
}
示例15: tfb_getRequestVar
/******************************************************************************/
$email = tfb_getRequestVar('email_address');
$newUser = tfb_getRequestVar('newUser');
$pass1 = tfb_getRequestVar('pass1');
$pass2 = tfb_getRequestVar('pass2');
$userType = tfb_getRequestVar('userType');
// check username
$usernameCheck = checkUsername($newUser);
// check password
$passwordCheck = checkPassword($pass1, $pass2);
// fast check email
$emailCheck = checkEmail($email);
// new user ?
$newUser = strtolower($newUser);
if ($usernameCheck === true && $passwordCheck === true && $emailCheck === true) {
addNewUser($newUser, $pass1, $userType, $email);
AuditAction($cfg["constants"]["admin"], $cfg['_NEWUSER'] . ": " . $newUser);
@header("location: admin.php?op=showUsers");
exit;
}
// init template-instance
tmplInitializeInstance($cfg["theme"], "page.admin.addUser.tmpl");
// set vars
$tmpl->setvar('newUser', $newUser);
// error
$tmpl->setvar('_ERROR', $cfg['_ERROR']);
// error-vars
$tmpl->setvar('errUsername', $usernameCheck !== true ? 1 : 0);
$tmpl->setvar('errMsgUsername', $usernameCheck !== true ? $usernameCheck : '');
$tmpl->setvar('errPassword', $passwordCheck !== true ? 1 : 0);
$tmpl->setvar('errMsgPassword', $passwordCheck !== true ? $passwordCheck : '');