本文整理汇总了PHP中insert_user函数的典型用法代码示例。如果您正苦于以下问题:PHP insert_user函数的具体用法?PHP insert_user怎么用?PHP insert_user使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了insert_user函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create_account
function create_account()
{
$name = $_POST['name'];
$email = $_POST['email'];
$password = $_POST['password'];
$result = insert_user($name, $email, $password);
if ($result) {
redirect("home");
} else {
redirect("user/create-failed");
}
}
示例2: make_a_comment
function make_a_comment($pid, $name, $content)
{
$content = trim($content);
if (strlen($content) > CONTENT_MAX_LENGTH) {
echo json_encode(["content too long(max 140)"]);
return;
}
global $db;
try {
$uid = insert_user($name);
$stmt = $db->prepare("INSERT INTO Comments (user_id, photo_id, content) VALUES(:user_id, :photo_id, :content)");
$stmt->bindParam(":user_id", $uid, PDO::PARAM_INT);
$stmt->bindParam(":photo_id", $pid, PDO::PARAM_INT);
$stmt->bindParam(":content", $content);
$stmt->execute();
echo json_encode(["status" => "OK"]);
} catch (PDOException $e) {
error_log("ERROR while favour: " . $e->getMessage());
echo json_encode(["ERROR" => $e->getMessage()]);
// return false;
}
}
示例3: insert_shares
}
// Shares
if (substr($split, 0, 6) == "shares") {
insert_shares($split);
}
// Mapped Drives
if (substr($split, 0, 6) == "mapped") {
insert_mapped($split);
}
// Local Groups
if (substr($split, 0, 7) == "l_group") {
insert_group($split);
}
// Local Users
if (substr($split, 0, 6) == "l_user") {
insert_user($split);
}
// Startup Programs
if (substr($split, 0, 7) == "startup") {
insert_startup($split);
}
// Services
if (substr($split, 0, 7) == "service") {
insert_service($split);
}
// Hotfixes
if (substr($split, 0, 6) == "hotfix") {
insert_hotfix($split);
}
// IE Browser Helper Objects
if (substr($split, 0, 6) == "ie_bho") {
示例4: create_user
function create_user($U)
{
extract($U);
$U['inputs']['account_addr_id'] = insert_address($U);
if ($_SERVER['HTTP_X_FORWARDED_HOST'] != '') {
$server = $_SERVER['HTTP_X_FORWARDED_HOST'];
} else {
$server = $_SERVER['HTTP_HOST'];
}
$s3dburl = 'http://' . $server . S3DB_URI_BASE;
if (insert_user($U)) {
#send and email to the user telling him about his new password!
$message .= sprintf("%s\n\n", 'Dear ' . $inputs['account_uname'] . ',');
$message .= sprintf("%s\n", 'An account on s3db has been created on your behalf.');
$message .= sprintf("%s\n", 'Your login ID is: ' . $inputs['account_lid']);
$message .= sprintf("%s\n", 'Your password is: ' . $inputs['account_pwd']);
$message .= sprintf("%s\n\n", 'You can login at ' . $s3dburl);
$message .= sprintf("%s\n", 'The S3DB team.(http://www.s3db.org)');
$message .= sprintf("%s\n\n", 'Note: Please do not reply, this is an automated message');
$E = array('email' => array($inputs['account_email']), 'message' => $message, 'subject' => 'Your s3db account');
if ($GLOBALS['s3db_info']['server']['email_host'] != '' && $GLOBALS['s3db_info']['server']['email_host'] != 'mail') {
#if user did no input data on host of deleted it, don't send email
send_email($E);
}
return True;
} else {
return False;
}
}
示例5: header
header('Location: index.php?info=User added successfully');
}
} elseif ($op == "add") {
$username = $_POST['username'];
$password = $_POST['password'];
$password2 = $_POST['password2'];
$groups = $_POST['user_groups'];
$permissions = $_POST['permissions'];
$err = "";
if (strlen(trim($password)) > 0) {
if (trim($password) != trim($password2)) {
$err = "The passwords are not equal.";
}
}
if ($err == "") {
$err = insert_user($username, $password, $groups, $permissions);
}
if (strlen($err) > 0) {
header('Location: error.php?msg=' . urlencode($err));
} else {
header('Location: user_list.php');
}
} elseif ($op == "edit") {
if (isset($_POST['id'])) {
$username = $_POST['id'];
$new_username = $_POST['username'];
$password = $_POST['password'];
$password2 = $_POST['password2'];
$groups = $_POST['user_groups'];
$permissions = $_POST['permissions'];
$err = "";
示例6: filter_input
<?php
include 'include/database.class.php';
/*If any registration is invalid,
/ set up error message in error string
/ to inform to the other page.error.php
*/
if (isset($_GET['uname'], $_GET['uemail'], $_GET['upassword'])) {
$uname = filter_input(INPUT_GET, 'uname', FILTER_SANITIZE_STRING);
// $uemail = $_GET['uemail'];
$uemail = filter_input(INPUT_GET, 'uemail', FILTER_SANITIZE_EMAIL);
$upassword = $_GET['upassword'];
check_email($uemail);
check_user_exists($uname, $uemail);
check_password($upassword);
insert_user($uname, $uemail, $upassword);
} else {
$mgs = "INFORMATION NOT PROPERLY SET";
send_error($mgs);
}
function check_email($uemail)
{
if (!filter_var($uemail, FILTER_VALIDATE_EMAIL)) {
$mgs = "INVALID EMAIL";
send_error($mgs);
} else {
if (check_email_exists($uemail)) {
$mgs = "EMAIL ALREADY REGISTERED";
send_error($mgs);
exit;
} else {
示例7: isset
$debug = isset($_SESSION['debug']) && $_SESSION['debug'] == "on" ? 1 : 0;
if ($debug) {
/*Head of the page*/
include_once $_SERVER['DOCUMENT_ROOT'] . '/Contacts/views/building/head.php';
dump($_SESSION, "SESSION");
dump($_POST, "POST");
}
$failure = 0;
/*For disable or enable registration.*/
if (1) {
if (isset($_POST['useremail_1']) && !empty($_POST['useremail_1']) && isset($_POST['useremail_2']) && !empty($_POST['useremail_2']) && isset($_POST['userpass_1']) && !empty($_POST['userpass_1']) && isset($_POST['userpass_2']) && !empty($_POST['userpass_2'])) {
if ($_POST['useremail_1'] == $_POST['useremail_2'] && $_POST['userpass_1'] == $_POST['userpass_2']) {
$username = trim($_POST['useremail_1']);
if (NULL == exists_user(0, $username)) {
$active = "act" . md5(mt_rand());
if ($userid = insert_user($username, md5(trim($_POST['userpass_1'])), $_SERVER['REMOTE_ADDR'], $_SERVER['REMOTE_PORT'], $_SERVER['HTTP_USER_AGENT'], $active)) {
$url = "" . $_SERVER['SERVER_NAME'] . "contacts/models/user/activation.php?id=" . $userid . "&user=" . $username . "&active=" . $active . "";
$message = "<h2>Thank you " . $username . " for registering!</h2><hr /><br /><p>Your account is not activated, \n\t\t\t\t\tTo activate click on the following link: </p>" . $url . "<div><sub>Mycnts © 2014<sub></div>";
if (mail_utf8($_POST['useremail_1'], "Account validation MyCnts", $message)) {
$_SESSION['success'] = ($debug ? "<b>register.php:</b><br />" : "") . "Thanks for signing up! We've sent an email account activation at: <b>'" . $username . "'</b>";
} else {
$_SESSION['error'] = ($debug ? "<b>register.php:</b><br />" : "") . "Ooops! Something went wrong with sending e-mail!";
}
} else {
$failure = 1;
$_SESSION['error'] = ($debug ? "<b>register.php:</b><br />" : "") . "Ooops! The registration process failed!";
}
} else {
$failure = 1;
$_SESSION['warning'] = ($debug ? "<b>register.php:</b><br />" : "") . "The user with e-mail '" . $username . "' already exists, try again with another username!";
}
示例8: AlertText
if (!$session) {
$message = new AlertText('That doesn\'t seem to be a valid or unexpired token, please try again or <a href="mailto:grinnellplans@gmail.com">Email</a> us.', 'Token not recognized');
$thispage->append($message);
$thispage->append(show_form());
} else {
$data = unserialize($session);
$username = $data['username'];
$type = $data['type'];
$year = $data['year'];
$email = $username . '@' . $domain;
if (get_item($dbh, 'username', 'accounts', 'username', $username)) {
$message = new AlertText("A plan with the username {$username} already exists, meaning this token has been used. If you are the owner of that email, your password was given to you when you first clicked the link. If you've lost the password, or for anything else, <a href=\"mailto:{$admin_email}\">Email us</a>.", 'Plan exists');
$thispage->append($message);
$thispage->append(show_form());
} else {
$results = insert_user($username, '', $year, $email, $type);
$password = $results[0];
$message = new InfoText("Your account has been created! Your username is {$username} and your initial password is {$password}." . ' Go <a href="http://www.grinnellplans.com/">Here</a> to test them out.', 'Plan Created');
$thispage->append($message);
$message = "A new plan has been created with \nusername: {$username}\nGrad Year: {$year}\n{$username} self-identifies as {$type}.";
send_mail($admin_email, "Plan Created: {$username}", $message);
$message = "Your account has been created! Your username is {$username} and your initial password is {$password}. Go to http://www.grinnellplans.com/ to get started.\n";
send_mail($email, "Plan Created", $message);
}
}
} else {
$thispage->append(show_form());
}
}
interface_disp_page($thispage);
db_disconnect($dbh);
示例9: check_user
$variable['Login_Username'] = $_POST['Login_Username'];
$variable['Login_Password'] = $_POST['Login_Password'];
include 'check_user.php';
check_user($variable);
break;
case 'frm_AddUser':
$variable = array();
$variable['addUser_Username'] = general_validate($_POST['addUser_Username']);
$variable['addUser_Password'] = general_validate($_POST['addUser_Password']);
$variable['addUser_ReEnterPassword'] = general_validate($_POST['addUser_ReEnterPassword']);
$variable['addUser_Fname'] = general_validate($_POST['addUser_Fname']);
$variable['addUser_Lname'] = general_validate($_POST['addUser_Lname']);
$variable['addUser_Address'] = general_validate($_POST['addUser_Address']);
$variable['addUser_ContactNo'] = general_validate($_POST['addUser_ContactNo']);
include 'insert_user.php';
insert_user($variable);
break;
case 'frm_AddCCard':
$variable = array();
$variable['addCC_CardName'] = general_validate($_POST['addCC_CardName']);
$variable['addCC_CardType'] = general_validate($_POST['addCC_CardType']);
$variable['addCC_CardNumber'] = general_validate($_POST['addCC_CardNumber']);
$variable['addCC_ExpireYear'] = general_validate($_POST['addCC_ExpireYear']);
$variable['addCC_CardSecurityNumber'] = general_validate($_POST['addCC_CardSecurityNumber']);
break;
case 'frm_AddMerchant':
$variable = array();
$variable['addMer_name'] = general_validate($_POST['addMer_name']);
$variable['addMer_cat'] = general_validate($_POST['addMer_cat']);
include 'insert_merchant.php';
insert_merchant($variable);
示例10: session_start
<?php
include_once '/../../includes/connection.php';
include_once 'user_function.php';
session_start();
$userid = $_POST['userid'];
$name = $_POST['name'];
$password = $_POST['password'];
if ($_POST['add']) {
insert_user($userid, $name, $password);
$_SESSION['message'] = "{$name} has been added";
header('Location: /danzsecurity/database');
}
if ($_POST['update']) {
update_user($userid, $name, $password);
$_SESSION['message'] = "{$name} has been updated";
header('Location: /danzsecurity/database');
}
if ($_POST['delete']) {
delete_user($userid);
$_SESSION['message'] = "{$name} has been deleted";
header('Location: /danzsecurity/database');
}
示例11: get_user
// get user record informaation.
$user = get_user($conn, $_GET['edit']);
include 'views/edit_user.php';
} elseif (isset($_GET['add'])) {
//if form is submitted.
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$msg = "";
$class_stat = 'class="alert alert-info"';
if (trim($_POST['password']) != trim($_POST['confirm_password'])) {
$msg = "Your password does not match your confirmed password.";
$class_stat = 'class="alert alert-warning"';
} else {
$_POST['password'] = md5($_POST['password']);
unset($_POST['confirm_password']);
$data[] = $_POST;
//print_r($data);exit;
$is_inserted = insert_user($conn, $data);
if ($is_inserted) {
$msg = "Data is inserted.";
$class_stat = 'class="alert alert-info"';
} else {
$msg = "Error input.";
$class_stat = 'class="alert alert-warning"';
}
}
//redirect to user list
//header("Location: index.php?controller=users");
//exit();
}
include 'views/add_user.php';
}
示例12: db_connect
<?php
require "dbfunctions.php";
$dbh = db_connect();
if ($added_name) {
if (isvaliduser($dbh, $added_name)) {
echo "User already exists.";
} else {
$type = $_POST['type'];
$password = $_POST['password'];
$email = $_POST['email'];
$perms = $_POST['perms'];
$gradyear = $_POST['gradyear'];
if ($type == "other") {
$type = $_POST['other'];
}
$results = insert_user($added_name, $password, $gradyear, $email, $type, $perms);
$password = $results[0];
$email = $results[1];
echo "Account created for " . $added_name . " with password " . $password . ", email " . $email . ", and graduation year " . $gradyear . ".<br>";
?>
<form action="email.php" method="POST">
<input type="hidden" name="username" value="<?php
echo $added_name;
?>
">
<input type="hidden" name="password" value="<?php
echo $password;
?>
">
<input type="hidden" name="email" value="<?php
echo $email;
示例13: htmlspecialchars
if (isset($_POST['sent'])) {
//initialisations
$pseudo = htmlspecialchars($_POST['pseudo']);
$password = $_POST['password'];
$password_verification = $_POST['password_verification'];
$email = htmlspecialchars($_POST['email']);
$everything_entered = verify_everything_entered($pseudo, $password, $password_verification, $email);
//Si tout a bien été entré, on commence les vérifications
if ($everything_entered) {
include_once 'model/user/user_exists.php';
$everything_verified = verify($pseudo, $password, $password_verification, $email);
//Si tout est vérifié
if ($everything_verified) {
//On peut rajouter l'utilisateur
include_once 'model/user/insert_user.php';
insert_user($pseudo, $password, $email);
include_once 'model/user/connect_user.php';
connect_user($pseudo);
include_once 'view/user/inscription/inscription_done.php';
exit;
//Stop le chargement pour éviter de charger l'autre vue
}
} else {
$_SESSION['inscription_errors'][] = 'Il manque des informations.';
}
}
//Si ça ne s'est pas bien passé ou que l'utilisateur n'a rien fait
//On affiche le formulaire
include_once 'view/user/inscription/inscription_form.php';
//Vérification que les infos sont bien entrées
function verify_everything_entered($pseudo, $password, $password_verification, $email)
示例14: session_unset
session_unset();
// destroy the session
session_destroy();
if (!session_id()) {
session_start();
}
$clef_id = $result['id'];
$_SESSION['name'] = $result['first_name'] . ' ' . $result['last_name'];
$_SESSION['email'] = $result['email'];
$_SESSION['user_id'] = $clef_id;
$_SESSION['logged_in_at'] = time();
// timestamp in unix time
require_once 'mysql.php';
$user = get_user($clef_id, $mysql);
if (!$user) {
insert_user($clef_id, $result['first_name'], $mysql);
}
// send them to the member's area!
header("Location: members_area.php");
}
} else {
echo "Log in with Clef failed, please try again.";
}
}
} else {
echo "Log in with Clef failed, please try again.";
}
} else {
echo "Log in with Clef failed, please try again.";
}
}
示例15: session_unset
$result = $response->info;
// reset the user's session
if (isset($result->id) && $result->id != '') {
//remove all the variables in the session
session_unset();
// destroy the session
session_destroy();
if (!session_id()) {
session_start();
}
$clef_id = $result->id;
$_SESSION['name'] = $result->first_name . ' ' . $result->last_name;
$_SESSION['email'] = $result->email;
$_SESSION['user_id'] = $clef_id;
$_SESSION['logged_in_at'] = time();
// timestamp in unix time
require_once 'mysql.php';
$user = get_user($clef_id, $mysql);
if (!$user) {
insert_user($clef_id, $result->first_name, $mysql);
}
// send them to the member's area!
header("Location: members_area.php");
}
} catch (Exception $e) {
echo "Login with Clef failed: " . $e->getMessage();
}
}
?>