function writeUsers($users) { $q = new Querries(); $db = $q->getDB(); foreach ($users as $user) { if (!$user instanceof User) { echo "<h1>complain loudly</h1>"; } saveUser($user); } $db->close(); }
/** * Method to save user data from admin interface */ function mcsave($ext) { $api = $this->api(); //Create the api object $params =& JComponentHelper::getParams('com_joomailermailchimpintegration'); $paramsPrefix = version_compare(JVERSION, '1.6.0', 'ge') ? 'params.' : ''; $MCapi = $params->get($paramsPrefix . 'MCapi'); $api = new joomlamailerMCAPI($MCapi); $db =& JFactory::getDBO(); $email = JRequest::getVar('email'); $name = JRequest::getVar('name'); $name = explode(' ', $name); $fname = $name[0]; $lname = isset($name[1]) ? $name[1] : ''; //Get the ID of the mailing list $plugin =& JPluginHelper::getPlugin('system', 'joomailermailchimpsignup'); $pluginParams = new JParameter($plugin->params); $listId = $pluginParams->get('listid'); $dbext = $ext == 'com_community' ? 'JS' : 'CB'; //Get the fields associated with the extension $query = 'SELECT * FROM #__joomailermailchimpintegration_custom_fields ' . 'WHERE framework = "' . $dbext . '" ' . 'AND listID = "' . $listId . '"'; $db->setQuery($query); $fields = $db->loadObjectList(); $merge_vars = $this->getData($fields, $dbext); $others = array('FNAME' => $fname, 'LNAME' => $lname, 'INTERESTS' => ''); $merge_vars = array_merge($others, $merge_vars); $email_type = ''; $replace_interests = true; //var_dump($merge_vars);die;var_dump($_POST);die; $retval = $api->listUpdateMember($listId, $email, $merge_vars, $email_type, $replace_interests); if ($api->errorCode) { echo "Unable to update member info!\n"; echo "\tCode=" . $api->errorCode . "\n"; echo "\tMsg=" . $api->errorMessage . "\n"; } else { if ($ext == 'com_community') { //echo "Returned: ".$retval."\n"; require_once JPATH_ADMINISTRATOR . '/components/com_community/controllers/controller.php'; require_once JPATH_ADMINISTRATOR . '/components/com_community/controllers/users.php'; require_once JPATH_ADMINISTRATOR . '/components/com_community/models/users.php'; $lang =& JFactory::getLanguage(); $lang->load('com_community', JPATH_ADMINISTRATOR); $userController = new CommunityControllerUsers(); $userController->execute('save'); $userController->redirect(); } elseif ($ext == 'com_comprofiler') { $GLOBALS['_JREQUEST']['option'] = array('DEFAULTCMD0' => 'com_comprofiler'); require_once JPATH_ADMINISTRATOR . '/components/com_comprofiler/admin.comprofiler.controller.php'; saveUser($ext); } } }
checkConfirmation(); break; case 'login': loginUserIntoSession(); break; case 'getUserlist': getUserlist(); break; case 'getUser': getUser(); break; case 'getNicknameByUsername': getNicknameByUsername(); break; case 'saveUser': saveUser(); break; case 'getInvitationUrl': getInvitationUrl(); break; case 'sendloveToAll': sendloveToAll(); break; case 'setUserRemoved': setUserRemoved(); break; case 'adminCreateUsers': adminCreateUsers(); break; case 'getLoveReceivedAmount': getLoveAmount();
function inscription() { ?> <form style="display: hidden" action="../View/Inscription.php?form=Incorrecte Donnees" method="post" id="form"> <input type="text" size="20" name="nomt" value="<?php echo $_POST['nom']; ?> "> <input type="text" size="20" name="prenomt" value="<?php echo $_POST['prenom']; ?> "> <input type="text" size="20" name="emailt" value="<?php echo $_POST['email']; ?> "> </form> <?php if (isset($_POST['nom']) && isset($_POST['prenom']) && isset($_POST['pwd1']) && isset($_POST['pwd2']) && isset($_POST['email'])) { if (!empty($_POST['nom']) && !empty($_POST['prenom']) && !empty($_POST['pwd1']) && !empty($_POST['pwd2']) && !empty($_POST['email'])) { if ($_POST['pwd1'] == $_POST['pwd2'] && checkEmail($_POST['email']) == 0) { saveUser($_POST['nom'], $_POST['prenom'], $_POST['pwd1'], $_POST['email'], 'etudiant', '../Ressources/Photo/face.jpg'); echo '<script type="text/javascript">', 'document.location.replace("../Index.php?form=votre inscription a été validée");', '</script>'; } else { echo '<script type="text/javascript">', 'document.getElementById("form").submit();', '</script>'; } } else { echo '<script type="text/javascript">', 'document.getElementById("form").submit();', '</script>'; } } else { echo '<script type="text/javascript">', 'document.getElementById("form").submit();', '</script>'; } }
} mysqli_stmt_close($statement); return $inserted; } /** * @param array $request * @return array */ return function (array $request) { if (currentUser()) { return createRedirectResponse('/index.php/'); } $form = createForm(); formHandleRequest($form, $request); $form['fields']['name']['value'] = trim(preg_replace('/(\\s)+/', ' ', $form['fields']['name']['value'])); if (formIsValid($form)) { $user = extractValues($form); $user['email'] = strtolower($user['email']); $user['hashed_password'] = password_hash($user['password'], PASSWORD_DEFAULT); unset($user['password'], $user['password_repeat']); $userConnection = mappedConnection('users'); if (saveUser($userConnection, $user)) { authorize($user); return createRedirectResponse('/'); } else { $form['valid'] = false; $form['fields']['email']['errors'][] = 'Такой Email уже используется.'; } } return createResponse(render('registration/index.html.php', ['form' => $form])); };
debug($debugIt, "---Update user!"); $updateUser = true; } if (isset($newPassword1) && isset($newPassword2)) { if ($newPassword1 != "" && $newPassword2 != "") { // They are trying to update their password. if ($newPassword1 != $newPassword2) { throw new Exception('The passwords you entered do not match - please go back and try again.'); } debug($debugIt, "---Update Password!"); $updatePassword = true; } } if ($updateUser) { debug($debugIt, "---Updating User"); saveUser($user, $oldEmail); $_SESSION['current_user'] = $user; } if ($updatePassword) { debug($debugIt, "---Updating Password of " . $user->getEmail() . " to " . $newPassword1); savePassword($user->getEmail(), $newPassword1); } if ($updateUser) { header("Location: /profile_updated.php"); } else { if ($updatePassword) { header("Location: /profile_updated.php"); } else { header("Location: /index.php"); } }
<span>Choose a view for this session</span> <select name="type"> <option value="Student">Student</option> <option value="Instructor">Instructor</option> </select> <input type="submit" value="Submit"> </form> <?php } else { $name = $_SESSION["name"]; $type = $_SESSION["type"]; $classes = $_SESSION["classes"]; $active = $_SESSION["active"]; setcookie("name", $name); include "common.php"; $newUser = saveUser($servername, $username, $password, $db, $port, $name, $type, $active, $classes); common_head(); if ($active) { if ($type == "Instructor") { ?> <script type="text/javascript"> questionStreamInstructor(<?php echo "\"{$active}\""; ?> ); </script> <?php } else { //type == Student ?> <h1><?php
<title>Создание пользователя</title> <meta charset="utf-8"> </head> <body> <h1>Создание пользователя</h1> <?php $login = '******'; $password = '******'; $result = ''; if ($_SERVER['REQUEST_METHOD'] == 'POST') { $login = $_POST['login'] ?: $login; if (!userExists($login)) { $password = $_POST['password'] ?: $password; $hash = getHash($password); if (saveUser($login, $hash)) { $result = 'Хеш ' . $hash . ' успешно добавлен в файл'; } else { $result = 'При записи хеша ' . $hash . ' произошла ошибка'; } } else { $result = "Пользователь {$login} уже существует. Выберите другое имя."; } } ?> <h3><?php echo $result; ?> </h3> <form action="<?php echo $_SERVER['PHP_SELF'];
case 'new': editUser(0, $option); break; case 'edit': editUser(intval($cid[0]), $option); break; case 'editA': editUser($id, $option); break; case 'save': case 'apply': // check to see if functionality restricted for use as demo site if ($_VERSION->RESTRICT == 1) { mosRedirect('index2.php?mosmsg=Functionality Restricted'); } else { saveUser($task); } break; case 'remove': removeUsers($cid, $option); break; case 'block': // check to see if functionality restricted for use as demo site if ($_VERSION->RESTRICT == 1) { mosRedirect('index2.php?mosmsg=Functionality Restricted'); } else { changeUserBlock($cid, 1, $option); } break; case 'unblock': changeUserBlock($cid, 0, $option);
$password = cleanPost($_POST['passw1']); $newuserpass = md5($password); $userdata['password'] = $newuserpass; $_SESSION['user'] = md5($newuserpass); $passw_changed = true; } else { $savedetails = false; $showindex = false; $userdata['password'] = NULL; sysMsg(MSG00181); userForm($userdata); } } } if ($savedetails == true) { saveUser($userdata); $showindex = true; } } else { sysMsg(MSG00033); } } elseif (isset($_GET['user']) && $_GET['user'] == 'hidehelp' && $userid != 0) { disableUserHelp($userid); $showindex = true; } elseif (isset($_GET['user']) && $_GET['user'] == 'showhelp' && $userid != 0) { enableUserHelp($userid); $showindex = true; } elseif (isset($_GET['user']) && $_GET['user'] == 'edit' && $userid != 0) { $showindex = false; $userdata['id'] = $userid; userForm($userdata);
<?php include '../config.php'; include '../functions.php'; saveUser($_POST['user']);
<?php include_once "db_functions.php"; if (isset($_POST['username']) && !empty($_POST['username'])) { $username = $_POST['username']; $email = $_POST['email']; $phone = $_POST['phone']; $password = $_POST['password']; $user = getUser($email); if (empty($user)) { $result = saveUser($username, $password, $email, $phone); if (is_bool($result)) { echo "Вы успешно зарегистрированы!"; } else { echo $result; } } else { echo "Вы уже зарегистрированы!"; } } ?> <!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8"> <title>Registration</title> </head> <body> <p><a href="index.php">Back to site</a></p> <form name="registration" action="registration.php" method="post"> <label>User name:
} require_once $mainframe->getPath('admin_html'); $task = trim(mosGetParam($_REQUEST, 'task', null)); $cid = mosGetParam($_REQUEST, 'cid', array(0)); if (!is_array($cid)) { $cid = array(0); } switch ($task) { case 'new': editUser(0, $option); break; case 'edit': editUser(intval($cid[0]), $option); break; case 'save': saveUser($option); break; case 'remove': removeUsers($cid, $option); break; case 'block': changeUserBlock($cid, 1, $option); break; case 'unblock': changeUserBlock($cid, 0, $option); break; case 'logout': logoutUser($cid, $option); break; case 'cancel': cancelUser($option);
<?php $name = $_REQUEST["name"]; $email = $_REQUEST["name"]; $donation = $_REQUEST["name"]; if ($name != null and $email != null and $donation != null) { saveUser($name, $email, $donation); }
$pattern = '/^(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){255,})(?!(?:(?:\\x22?\\x5C[\\x00-\\x7E]\\x22?)|(?:\\x22?[^\\x5C\\x22]\\x22?)){65,}@)(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22))(?:\\.(?:(?:[\\x21\\x23-\\x27\\x2A\\x2B\\x2D\\x2F-\\x39\\x3D\\x3F\\x5E-\\x7E]+)|(?:\\x22(?:[\\x01-\\x08\\x0B\\x0C\\x0E-\\x1F\\x21\\x23-\\x5B\\x5D-\\x7F]|(?:\\x5C[\\x00-\\x7F]))*\\x22)))*@(?:(?:(?!.*[^.]{64,})(?:(?:(?:xn--)?[a-z0-9]+(?:-+[a-z0-9]+)*\\.){1,126}){1,}(?:(?:[a-z][a-z0-9]*)|(?:(?:xn--)[a-z0-9]+))(?:-+[a-z0-9]+)*)|(?:\\[(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){7})|(?:(?!(?:.*[a-f0-9][:\\]]){7,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,5})?)))|(?:(?:IPv6:(?:(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){5}:)|(?:(?!(?:.*[a-f0-9]:){5,})(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3})?::(?:[a-f0-9]{1,4}(?::[a-f0-9]{1,4}){0,3}:)?)))?(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))(?:\\.(?:(?:25[0-5])|(?:2[0-4][0-9])|(?:1[0-9]{2})|(?:[1-9]?[0-9]))){3}))\\]))$/iD'; if (preg_match($pattern, $post['email']) !== 1) { $errorEmail = "Не правильный адрес почты"; } if (!is_null(getUserByEmail($post['email']))) { $errorEmail = "Указанная почта \"{$post['email']}\" уже используется другим человеком."; } if (!is_null(getUserByLogin($post['login']))) { $errorLogin = "******"{$post['login']}\" уже используется другим человеком."; } $post['kv'] = abs((int) $post['kv']); if ($post['kv'] == 0) { $errorKv = "кв. должна быть > 0"; } if ($errorFio == "" && $errorEmail == "" && $errorPhone == "" && $errorHouseNum == "" && $errorLogin == "" && $errorPassword == "" && $errorKv == "") { $res = saveUser($post); if (is_numeric($res)) { //сохранилось? //$res - ID текущего пользователя, только созданного sendUserToMail($res); //отправить письмо $_SESSION['userId'] = $res; header("Location: profile.php"); die; } else { $error = $res; } } } } else { //метод запроса НЕ POST (значит GET)
/*$jsonString = '{ "request": "createGroup", "data": {"group_name":"nouveau groupe"} }';*/ //$json = json_decode($jsonString,true); $json = json_decode(file_get_contents("php://input"), true); $request = $json["request"]; $response = null; if ($request == "getAllAccount") { $response = getUserList($json["userId"], $json["raw"], false); } else { if ($request == "getAllAccountReady") { $response = getUserList($json["userId"], $json["raw"], true); } else { if ($request == "save") { $response = saveUser($json["data"]); } else { if ($request == "createUser") { $response = createUser($json["raw"]); } else { if ($request == "saveGroups") { $response = saveGroups($json["data"]); } else { if ($request == "removeUserFromGroup") { $response = removeUserFromGroup($json["data"]); } else { if ($request == "addUserToGroup") { $response = addUserToGroup($json["data"]); } else { if ($request == "getUsersUngroup") { $response = getUsersUngroup($json["data"]);
$connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET); /* Get temporary credentials. */ $request_token = $connection->getRequestToken(OAUTH_CALLBACK); /* Save temporary credentials to session. */ $_SESSION['request_token'] = $request_token; switch ($connection->http_code) { case 200: /* Build authorize URL and redirect user to Twitter. */ $url = $connection->getAuthorizeURL($request_token['oauth_token']); header('Location: ' . $url); break; default: /* Show notification if something went wrong. */ echo 'Could not connect to Twitter. Refresh the page or try again later.'; exit; } } else { /* 2. Fetch and save Access Token */ /* Create TwitteroAuth object with app key/secret and token key/secret from default phase */ $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $_SESSION['request_token']['oauth_token'], $_SESSION['request_token']['oauth_token_secret']); /* Request access tokens from twitter */ $access_token = $connection->getAccessToken($_REQUEST['oauth_verifier']); show($access_token); /* Save the access tokens. Normally these would be saved in a database for future use. */ $_SESSION['access_token'] = $access_token; $twitter = $connection->get('account/verify_credentials'); $user = array("twitter_username" => $twitter->screen_name, "twitter_token" => $access_token['oauth_token'], "twitter_secret" => $access_token['oauth_token_secret']); dbConnect(); $user = saveUser($user); } /* 3. Store credentials in Local Storage to pass back to the app */
if (isset($data['id'])) { $id = $data['id']; } else { if (isset($_GET['id'])) { $id = $_GET['id']; } } if (isset($id)) { $user = getUserById((int) $id); if (!$user) { header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not found'); exit('Post not found'); } } if ($data) { $user = saveUser($data, $errors); if (!$errors) { //Запись успешно сохарнена header('location: registration.php?id=' . $user['id']); exit; } } ?> <!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Blojjeq - Registration</title> </head> <body>
$city = $_POST['city']; $phone = $_POST['phone']; $mobile = $_POST['mobile']; $passwordEncrypted = password_hash($password, PASSWORD_BCRYPT); $user = array('email' => $email, 'pass' => $passwordEncrypted, 'isPro' => $isPro, 'gender' => $gender, 'name' => $name, 'firstname' => $firstname, 'street' => $street, 'zip' => $zip, 'city' => $city, 'phone' => $phone, 'mobile' => $mobile); if ($isPro == 0) { //Patient fields $physicianName = $_POST['medecin_name']; $physicianMail = $_POST['email_medecin']; $birthday = $_POST['birthday']; $emergency = $_POST['emergency']; $status = $_POST['status']; $accompaniment = $_POST['accompaniment']; $city = $_POST['residency']; $isFinancial = $_POST['isFinancial']; $isHelp = $_POST['isHelp']; $patientArray = array('physicianName' => $physicianName, 'physicianMail' => $physicianMail, 'birthday' => $birthday, 'emergency' => $emergency, 'status' => $status, 'accompaniment' => $accompaniment, 'isFinancial' => $isFinancial, 'isHelp' => $isHelp); $user = array_merge($user, $patientArray); } else { //Professionnal fields $officeName = $_POST['officename']; $docArray = array('officeName' => $officeName); $user = array_merge($user, $docArray); } $result = saveUser($user); if ($result) { echo 'success'; die; } echo 'fail'; die;
if (!is_array($cid)) { $cid = array(0); } switch ($task) { case 'new': editUser(0, $option); break; case 'edit': editUser(intval($cid[0]), $option); break; case 'editA': editUser($id, $option); break; case 'save': case 'apply': saveUser($option, $task); break; case 'remove': removeUsers($cid, $option); break; case 'block': changeUserBlock($cid, 1, $option); break; case 'unblock': changeUserBlock($cid, 0, $option); break; case 'logout': logoutUser($cid, $option, $task); break; case 'flogout': logoutUser($id, $option, $task);
<?php require 'services.php'; echo saveUser();
<?php require_once '../models/add_user_conf.model.php'; require_once '../../settings.php'; $id = $_POST['id']; $name = $_POST['name']; $job = $_POST['job']; $lecture_title = $_POST['lecture_title']; $head = $_POST['head']; saveUser($id, $name, $job, $lecture_title, $head);