本文整理汇总了PHP中generate_hash函数的典型用法代码示例。如果您正苦于以下问题:PHP generate_hash函数的具体用法?PHP generate_hash怎么用?PHP generate_hash使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了generate_hash函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: OS_CaptchaOnRegistration
function OS_CaptchaOnRegistration()
{
if (isset($_SESSION["r_code"]) and $_SESSION["r_code"] == "OK") {
/* CAPTCHA OK */
} else {
$code = rand(100, 10000);
$_SESSION["r_code"] = $code;
$trap1 = generate_hash(16);
$trap2 = generate_hash(8);
$_SESSION["r_trap1"] = $trap1;
$_SESSION["r_trap2"] = $trap2;
?>
<tr>
<td class="padLeft">Captcha:</td>
<td class="padLeft">
<input type="text" size="1" value="" name="r_captcha"/>
<input type="hidden" name="<?php
echo $trap1;
?>
" value="<?php
echo $trap2;
?>
" />
<span style="font-size:26px; font-weight:bold;"><?php
echo $code;
?>
</span>
</td>
</tr>
<?php
}
}
开发者ID:WeKiNGSRO,项目名称:OHSystem,代码行数:32,代码来源:captcha_registration.php
示例2: check_login
function check_login(){
$user=db_easy("SELECT `name`, `password_hash` FROM `users` WHERE `name`='".mysql_real_escape_string(@$_POST['user'])."'");
if(generate_hash($user['name'], @$_POST['password'])==$user['password_hash']){
return true;
}else{
return false;
}
}
开发者ID:jsib,项目名称:dumps.loc,代码行数:8,代码来源:auth.php
示例3: change_password
public function change_password(IChangePasswordInput $input)
{
// Prepare data
$this->load->helper('crypto');
$passwordsalt = generate_salt();
$passwordhash = generate_hash($input->get_password(), $passwordsalt);
$this->db->where('email', $input->get_email());
$this->db->where('passwordresetcode', $input->get_resetcode());
$this->db->update("users", array("passwordresetcode" => NULL, "passwordhash" => $passwordhash, "passwordsalt" => $passwordsalt));
return $this->db->affected_rows() > 0;
}
开发者ID:git-ecorise,项目名称:snp,代码行数:11,代码来源:UserModel.php
示例4: OS_CheckCaptcha
function OS_CheckCaptcha()
{
if (isset($_POST["post_comment"])) {
if (isset($_GET["post_id"]) and is_numeric($_GET["post_id"])) {
$backTo = OS_HOME . '?post_id=' . safeEscape($_GET["post_id"]) . "&" . generate_hash(12) . "#SubmitComment";
} else {
$backTo = '';
}
$CaptchaError = '<h2>Invalid captcha</h2><div><a href="' . $backTo . '">« Back</a></div>';
if (!isset($_POST["c_code"]) or !isset($_SESSION["c_code"])) {
os_trigger_error($CaptchaError);
}
if ($_POST["c_code"] != $_SESSION["c_code"]) {
os_trigger_error($CaptchaError . " ");
} else {
$code = generate_hash(5);
$code = str_replace(array("o", "0"), array("x", "x"), $code);
$_SESSION["c_code"] = $code;
}
}
}
开发者ID:WeKiNGSRO,项目名称:OHSystem,代码行数:21,代码来源:captcha_comments.php
示例5: login
function login($username, $password, $dbh)
{
if ($query = $dbh->prepare("SELECT uid, username, password FROM accounts WHERE username = ? LIMIT 1")) {
$query->bindValue(1, $username);
// Bind "$username" to parameter.
$query->execute();
// Execute the prepared query.
$result = $query->fetch();
$user_id = $result['uid'];
$username = $result['username'];
$storedpass = $result['password'];
$storedsalt = substr($storedpass, 0, 32);
// break salt from stored hash
$password = generate_hash($password, $storedsalt);
// hash the attempted password with the unique salt from database.
if ($result) {
// If the user exists
if ($storedpass == $password) {
// Check if the password in the database matches the password the user submitted.
// Password is correct!
$ip_address = $_SERVER['REMOTE_ADDR'];
// Get the IP address of the user.
$user_browser = $_SERVER['HTTP_USER_AGENT'];
// Get the user-agent string of the user.
$user_id = preg_replace("/[^0-9]+/", "", $user_id);
// XSS protection as we might print this value
$_SESSION['user_id'] = $user_id;
$username = preg_replace("/[^a-zA-Z0-9_\\-]+/", "", $username);
// XSS protection as we might print this value
$_SESSION['username'] = $username;
$_SESSION['login_string'] = hash('sha512', $password . $ip_address . $user_browser);
// Login successful.
return true;
}
}
} else {
// No user exists.
return false;
}
}
开发者ID:rechner,项目名称:foxoffice,代码行数:40,代码来源:functions.php
示例6: __construct
public function __construct($processed_array)
{
$this->entrada_url = isset($processed_array["entrada_url"]) ? $processed_array["entrada_url"] : "";
$this->entrada_relative = isset($processed_array["entrada_relative"]) ? $processed_array["entrada_relative"] : "";
$this->entrada_absolute = isset($processed_array["entrada_absolute"]) ? $processed_array["entrada_absolute"] : "";
$this->entrada_storage = isset($processed_array["entrada_storage"]) ? $processed_array["entrada_storage"] : "";
$this->database_adapter = isset($processed_array["database_adapter"]) ? $processed_array["database_adapter"] : "mysql";
$this->database_host = isset($processed_array["database_host"]) ? $processed_array["database_host"] : "";
$this->database_username = isset($processed_array["database_username"]) ? $processed_array["database_username"] : "";
$this->database_password = isset($processed_array["database_password"]) ? $processed_array["database_password"] : "";
$this->entrada_database = isset($processed_array["entrada_database"]) ? $processed_array["entrada_database"] : "";
$this->auth_database = isset($processed_array["auth_database"]) ? $processed_array["auth_database"] : "";
$this->clerkship_database = isset($processed_array["clerkship_database"]) ? $processed_array["clerkship_database"] : "";
$this->admin_username = isset($processed_array["admin_username"]) ? $processed_array["admin_username"] : "";
$this->admin_password_hash = isset($processed_array["admin_password_hash"]) ? $processed_array["admin_password_hash"] : "";
$this->admin_firstname = isset($processed_array["admin_firstname"]) ? $processed_array["admin_firstname"] : "";
$this->admin_lastname = isset($processed_array["admin_lastname"]) ? $processed_array["admin_lastname"] : "";
$this->admin_email = isset($processed_array["admin_email"]) ? $processed_array["admin_email"] : "";
$this->auth_username = isset($processed_array["auth_username"]) ? $processed_array["auth_username"] : generate_hash();
$this->auth_password = isset($processed_array["auth_password"]) ? $processed_array["auth_password"] : generate_hash();
$this->config_file_path = $this->entrada_absolute . "/core/config/config.inc.php";
}
开发者ID:nadeemshafique,项目名称:entrada-1x,代码行数:22,代码来源:Entrada_Setup.php
示例7: create
/**
* Add new user
*
* @param array $user_data
*
* @return bool
*/
public function create($user_data)
{
$user_data = $this->validate($user_data);
if (!$user_data) {
return false;
}
$user_exist = $this->checkExist($user_data);
if ($user_exist) {
$this->setAttributes($user_exist);
return true;
}
$hash = generate_hash();
$date_start = date("Y-m-d H-i-s");
$sql = "INSERT INTO\n {$this->table_name} (\n name,\n email,\n phone,\n hash,\n date_start,\n conference_id\n ) VALUES (\n :name,\n :email,\n :phone,\n :hash,\n :date_start,\n :conference_id\n )";
$prepare_statement = $this->connection->prepare($sql, [PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY]);
$status = $prepare_statement->execute([':name' => $user_data['name'], ':email' => $user_data['email'], ':phone' => $user_data['phone'], ':conference_id' => $user_data['conference_id'], ':date_start' => $date_start, ':hash' => $hash]);
if (!$status) {
return false;
}
$user_data['hash'] = $hash;
$user_data['date_start'] = $date_start;
$this->setAttributes($user_data);
return true;
}
开发者ID:eGGshke,项目名称:cookie_parser,代码行数:31,代码来源:User.php
示例8: generate_hash
$TOTAL_ERRORS = $ERROR;
$STEP = 2;
}
case 2:
/**
* Keys to allow Entrada to access the authentication web-service.
*/
if (isset($_POST["auth_username"]) && ($auth_username = clean_input($_POST["auth_username"], "alphanumeric"))) {
$PROCESSED["auth_username"] = $auth_username;
} else {
$PROCESSED["auth_username"] = generate_hash();
}
if (isset($_POST["auth_password"]) && ($auth_password = clean_input($_POST["auth_password"], "alphanumeric"))) {
$PROCESSED["auth_password"] = $auth_password;
} else {
$PROCESSED["auth_password"] = generate_hash();
}
case 1:
default:
continue;
break;
}
$setup = new Entrada_Setup($PROCESSED);
/**
* Post-Error Check Data Processing
*/
switch ($STEP) {
case 6:
if (@file_exists($PROCESSED["entrada_absolute"] . "/.htaccess")) {
if (@file_exists($PROCESSED["entrada_absolute"] . "/core/config/config.inc.php")) {
try {
开发者ID:nadeemshafique,项目名称:entrada-1x,代码行数:31,代码来源:index.php
示例9: createUser
/**
* Creates a user account and updates object, returns true or false.
* $user_data requires: "username", "firstname", "lastname", "email", "password", "organisation_id"
* $user_access requires: "group", "role", "app_id"
*
* @param array $user_data User data array, keys match table fields. Ex: array("id" => "1", "username" => "foo").
* @param array $user_access User access array, keys match table fields. Ex: array("group" => "admin").
* @return boolean
*/
public function createUser(array $user_data, array $user_access)
{
global $db;
$required_user_data = array("username", "firstname", "lastname", "email", "password", "organisation_id");
$required_user_access = array("group", "role", "app_id");
foreach ($required_user_data as $data) {
if (!array_key_exists($data, $user_data)) {
$error = true;
}
}
foreach ($required_user_access as $data) {
if (!array_key_exists($data, $user_access)) {
$error = true;
}
}
if (!$error) {
foreach ($user_data as $fieldname => $data) {
$processed["user_data"][$fieldname] = clean_input($data, array("trim", "striptags"));
}
foreach ($user_access as $fieldname => $data) {
$processed["user_access"][$fieldname] = clean_input($data, array("trim", "striptags"));
}
if ($db->AutoExecute("`" . AUTH_DATABASE . "`.`user_data`", $processed["user_data"], "INSERT")) {
$processed["user_data"]["id"] = $db->Insert_ID();
$processed["user_access"]["user_id"] = $processed["user_data"]["id"];
if (!isset($processed["user_access"]["organisation_id"])) {
$processed["user_access"]["organisation_id"] = $processed["user_data"]["organisation_id"];
}
if (!isset($processed["user_access"]["access_starts"])) {
$processed["user_access"]["access_starts"] = time();
}
if (!isset($processed["user_access"]["account_active"])) {
$processed["user_access"]["account_active"] = "true";
}
if (!isset($processed["user_access"]["private_hash"])) {
$processed["user_access"]["private_hash"] = generate_hash();
}
if (!$db->AutoExecute("`" . AUTH_DATABASE . "`.`user_access`", $processed["user_access"], "INSERT")) {
application_log("error", "Failed to add user, DB said: " . $db->ErrorMsg());
$return = false;
} else {
$params = get_class_vars(__CLASS__);
foreach ($params as $param_name => $param) {
$this->{$param_name} = isset($processed["user_data"][$param_name]) ? $processed["user_data"][$param_name] : (isset($processed["user_access"][$param_name]) ? $processed["user_access"][$param_name] : $param);
}
$return = true;
}
} else {
application_log("error", "Failed to add user, DB said: " . $db->ErrorMsg());
$return = false;
}
} else {
$return = false;
}
return $return;
}
开发者ID:nadeemshafique,项目名称:entrada-1x,代码行数:65,代码来源:User.class.php
示例10: trim
$pw = trim($_POST["password"]);
$email = trim($_POST["email"]);
if (strlen($admin) <= 2 or strlen($pw) <= 2) {
$admin = "admin";
$pw = "admin";
$email = "[email protected]";
?>
<div>Admin username or password have too few characters</div>
<div>Inserting default admin username and password</div>
<div><b>Admin username:</b> admin</div>
<div><b>Admin password:</b> admin</div>
<div> </div>
<div>Don't forget to change admin username and password via admin panel</div>
<?php
}
$hash = generate_hash(16, 1);
$pass = generate_password($pw, $hash);
$userLevel = 10;
// 10 - root admin, 9 - administrator
$sth = $dbh->prepare("INSERT INTO oh_users(user_name, user_password, password_hash, user_email, user_joined, user_level,user_ip, confirm, can_comment) VALUES('{$admin}', '{$pass}', '{$hash}', '{$email}', '" . time() . "', '" . $userLevel . "', '" . $_SERVER["REMOTE_ADDR"] . "', '', '1')");
$sth->execute();
$result = 1;
flush();
if ($result) {
?>
<div> </div>
<div><b>Admin successfully created.</b></div>
<div style="display:none;">Please delete <b>install.php</b>, <b>sql_data.sql</b> and <b>sql_heroes_items.sql</b> from install directory.</div>
<div style="display:none;">Please delete or rename <b>install/</b> folder.</div>
开发者ID:WeKiNGSRO,项目名称:OHSystem,代码行数:30,代码来源:install.php
示例11: check_hash
function check_hash($proper, $check)
{
$len = strlen($proper);
$nhash = generate_hash($check, substr($proper, $len - SALT_LENGTH));
if ($proper == $nhash) {
return true;
}
return false;
}
开发者ID:blenderbox,项目名称:bagel,代码行数:9,代码来源:base.php
示例12: header
<?php
if (!isset($website)) {
header('HTTP/1.1 404 Not Found');
die;
}
$code = generate_hash(8);
$_SESSION["code"] = $code;
if (isset($errors) and !empty($errors)) {
?>
<div><?php
echo $errors;
?>
</div>
<?php
}
?>
<a name="comments"></a><?php
if (isset($CommentsData) and !empty($CommentsData)) {
?>
<div class="comments" id="comments">
<h4><?php
echo $lang["comments"];
?>
(<?php
echo $CommentsData[0]["total_comments"];
?>
)</h4>
<div class="comments-content">
<div id="comment-holder">
<ol>
开发者ID:WeKiNGSRO,项目名称:OHSystem,代码行数:31,代码来源:comment_form.php
示例13: get_hash_thold_template
function get_hash_thold_template($id)
{
$hash = db_fetch_cell("SELECT hash FROM thold_template WHERE id={$id}");
if (preg_match("/[a-fA-F0-9]{32}/", $hash)) {
return $hash;
} else {
return generate_hash();
}
}
开发者ID:caiorasec,项目名称:thold,代码行数:9,代码来源:thold_functions.php
示例14: generate_hash
img/fb_connect.png" width="300" height="50" alt="FB CONNECT" /></a>
<div>Click on the button above to sign in with your FB account</div>
<div style="margin-top: 360px;"> </div>
</div>
</div>
</div>
</div>
</div>
<?php
}
if ($user and isset($email) and strlen($email) >= 5) {
$result = $db->query("SELECT * FROM users WHERE user_email = '" . $email . "' AND user_fbid = '" . $user . "' ");
if ($db->num_rows($result) <= 0) {
$pass = generate_hash(5);
$hash = generate_hash(12);
$password_db = generate_password($pass, $hash);
$avatar = 'https://graph.facebook.com/' . $user . '/picture?type=large';
$www = 'http://www.facebook.com/profile.php?id=' . $user . '';
if ($gender == "male") {
$gen = 1;
} else {
if ($gender == "female") {
$gen = 2;
} else {
$gen = 0;
}
}
$insert = $db->query("INSERT INTO users(user_name, user_fbid, user_password, password_hash, user_email, user_joined, user_level, user_last_login, user_ip, user_avatar, user_website, user_gender) \n\t VALUES('" . safeEscape($name) . "', '" . $user . "', '" . $password_db . "', '" . $hash . "', '" . safeEscape($email) . "', '" . (int) time() . "', '0', '" . (int) time() . "', '" . safeEscape($_SERVER["REMOTE_ADDR"]) . "', '" . strip_tags($avatar) . "', '" . $www . "', '" . $gen . "')");
$id = $db->get_insert_id();
$_SESSION["user_id"] = $id;
开发者ID:WeKiNGSRO,项目名称:OHSystem,代码行数:31,代码来源:connect.php
示例15: handleUser
/**
* Creates user data / user access records
* @global type $db
* @param type $member_ldap_data
* @return int $status
*/
private function handleUser($member_ldap_data)
{
global $db;
$number = str_replace("S", "", $member_ldap_data[LDAP_USER_QUERY_FIELD]);
$GRAD = date("Y", time()) + 4;
$user_id = "";
$query = "SELECT * FROM `" . AUTH_DATABASE . "`.`user_data` WHERE `number` = ?";
$result = $db->GetRow($query, array($number));
if (!$result) {
if (isset($member_ldap_data["sn"]) && isset($member_ldap_data["givenName"]) && $member_ldap_data["sn"] && $member_ldap_data["givenName"]) {
$names[0] = $member_ldap_data["givenName"];
$names[1] = $member_ldap_data["sn"];
} else {
$names = explode(" ", $member_ldap_data["cn"]);
}
$student = array("number" => $number, "username" => strtolower($member_ldap_data[LDAP_MEMBER_ATTR]), "password" => md5(generate_password(8)), "organisation_id" => $this->course["organisation_id"], "firstname" => trim($names[0]), "lastname" => trim($names[1]), "prefix" => "", "email" => isset($member_ldap_data["mail"]) ? $member_ldap_data["mail"] : strtolower($member_ldap_data[LDAP_MEMBER_ATTR]) . "@queensu.ca", "email_alt" => "", "email_updated" => time(), "telephone" => "", "fax" => "", "address" => "", "city" => DEFAULT_CITY, "postcode" => DEFAULT_POSTALCODE, "country" => "", "country_id" => DEFAULT_COUNTRY_ID, "province" => "", "province_id" => DEFAULT_PROVINCE_ID, "notes" => "", "privacy_level" => "0", "notifications" => "0", "entry_year" => date("Y", time()), "grad_year" => $GRAD, "gender" => "0", "clinical" => "0", "updated_date" => time(), "updated_by" => "1");
if ($db->AutoExecute("`" . AUTH_DATABASE . "`.`user_data`", $student, "INSERT")) {
$user_id = $db->Insert_ID();
$access = array("user_id" => $user_id, "app_id" => $this->app_id, "organisation_id" => $this->course["organisation_id"], "account_active" => "true", "access_starts" => time(), "access_expires" => "0", "last_login" => "0", "last_ip" => "", "role" => $GRAD, "group" => "student", "extras" => "", "private_hash" => generate_hash(32), "notes" => "");
if ($db->AutoExecute("`" . AUTH_DATABASE . "`.`user_access`", $access, "INSERT")) {
application_log("error", "Failed to create user access record, DB said: " . $db->ErrorMsg());
}
} else {
application_log("error", "Failed to create user data record, DB said: " . $db->ErrorMsg());
}
} else {
$user_id = $result["id"];
$query = "SELECT * FROM `" . AUTH_DATABASE . "`.`user_access`\n WHERE `user_id` = " . $db->qstr($result["id"]) . " AND `organisation_id` = " . $db->qstr($this->course["organisation_id"]);
$access_record = $db->GetRow($query);
if (!$access_record) {
$access = array("user_id" => $user_id, "app_id" => $this->app_id, "organisation_id" => $this->course["organisation_id"], "account_active" => "true", "access_starts" => time(), "access_expires" => "0", "last_login" => "0", "last_ip" => "", "role" => $GRAD, "group" => "student", "extras" => "", "private_hash" => generate_hash(32), "notes" => "");
if (!$db->AutoExecute("`" . AUTH_DATABASE . "`.`user_access`", $access, "INSERT")) {
application_log("error", "Failed to create user access record, DB said: " . $db->ErrorMsg());
}
}
}
$query = "SELECT * FROM `group_members` \n WHERE `proxy_id` = " . $db->qstr($user_id) . "\n AND `group_id` = " . $db->qstr($this->group_id);
$group_member = $db->GetRow($query);
if (!$group_member) {
$values = array("group_id" => $this->group_id, "proxy_id" => $user_id, "start_date" => $this->course["start_date"], "expire_date" => $this->course["end_date"], "member_active" => "1", "entrada_only" => "0", "updated_date" => time(), "updated_by" => "1");
if (!$db->AutoExecute("group_members", $values, "INSERT")) {
application_log("error", "User was not added to group_members table, DB said: " . $db->ErrorMsg());
}
}
if ($this->community_id) {
$query = "SELECT * FROM `community_members` WHERE `proxy_id` = ? AND `community_id` = ?";
$community_membership = $db->GetRow($query, array($user_id, $this->community_id));
if (!$community_membership) {
$values = array("community_id" => $this->community_id, "proxy_id" => $user_id, "member_active" => "1", "member_joined" => time(), "member_acl" => "0");
if (!$db->AutoExecute("`community_members`", $values, "INSERT")) {
application_log("error", "Failed to add user to community, DB said: " . $db->ErrorMsg());
}
}
}
unset($this->community_audience[$user_id]);
}
开发者ID:nadeemshafique,项目名称:entrada-1x,代码行数:62,代码来源:Ldap.php
示例16: RAND
////////////////// VOTE ///////////////////
//HERO 1 vs HERO 2
require_once 'inc/class.database.php';
require_once 'inc/db_connect.php';
$sth = $db->prepare("SELECT * FROM heroes WHERE summary!= '-' ORDER BY RAND() LIMIT 2");
$result = $sth->execute();
$c = 0;
$HeroVoteData = array();
while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
$HeroVoteData[$c]["id"] = strtoupper($row["heroid"]);
$HeroVoteData[$c]["original"] = $row["original"];
$HeroVoteData[$c]["description"] = $row["description"];
$HeroVoteData[$c]["summary"] = $row["summary"];
$c++;
}
$code = generate_hash(14);
$_SESSION["code"] = $code;
?>
<div align="center">
<form action="" method="post">
<table width="460" style="width:460px;">
<tr>
<th class="padLeft"><?php
echo $lang["vote_title"];
?>
</th><th></th><th></th>
</tr>
<tr style="height: 154px; vertical-align: middle;">
<td align="center" style="height: 154px; vertical-align: middle; width:200px;" >
<label for="h1">
<img style="vertical-align:middle; padding-right:8px; cursor:pointer;" width="64" height="64" border=0 src="<?php
开发者ID:WeKiNGSRO,项目名称:OHSystem,代码行数:31,代码来源:vote.php
示例17: array
$access["last_ip"] = "";
$access["role"] = "communityinvite";
$access["group"] = "guest";
if ($db->AutoExecute(AUTH_DATABASE . ".user_access", $access, "INSERT")) {
$community = array();
$community["community_id"] = $user["community_id"];
$community["proxy_id"] = $proxy_id;
$community["member_active"] = 1;
$community["member_joined"] = time();
$community["member_acl"] = 0;
if ($db->AutoExecute("community_members", $community, "INSERT")) {
if ($SKIP_EMAIL_NOTIFICATION) {
output_success("[Row " . $row_count . "]\tSuccessfully added username [" . $user["username"] . "] and skipped e-mail notification.");
} else {
do {
$hash = generate_hash();
} while ($db->GetRow("SELECT `id` FROM `" . AUTH_DATABASE . "`.`password_reset` WHERE `hash` = " . $db->qstr($hash)));
if ($db->AutoExecute(AUTH_DATABASE . ".password_reset", array("ip" => "127.0.0.1", "date" => time(), "user_id" => $proxy_id, "hash" => $hash, "complete" => 0), "INSERT")) {
$notification_search = array("%firstname%", "%lastname%", "%username%", "%password_reset_url%", "%application_url%", "%application_name%", "%community_name%", "%community_url%");
$notification_replace = array(stripslashes($user["firstname"]), stripslashes($user["lastname"]), stripslashes($user["username"]), PASSWORD_RESET_URL . "?hash=" . rawurlencode($proxy_id . ":" . $hash), ENTRADA_URL, APPLICATION_NAME, $community_info["community_title"], COMMUNITY_URL . $community_info["community_url"]);
$message = str_ireplace($notification_search, $notification_replace, $NEW_GUEST_NOTIFICATION);
if ($SEND_ADMIN_NOTIFICATION) {
$user["email"] = $AGENT_CONTACTS["administrator"]["email"];
}
if (@mail($user["email"], "New User Account: " . APPLICATION_NAME, $message, "From: \"" . $AGENT_CONTACTS["administrator"]["name"] . "\" <" . $AGENT_CONTACTS["administrator"]["email"] . ">\nReply-To: \"" . $AGENT_CONTACTS["administrator"]["name"] . "\" <" . $AGENT_CONTACTS["administrator"]["email"] . ">")) {
output_success("[Row " . $row_count . "]\tSuccessfully added username [" . $user["username"] . "] and sent e-mail notification to [" . $user["email"] . "].");
} else {
output_error("[Row " . $row_count . "]\tAdded username [" . $user["username"] . "] to the database, but could not send e-mail notification to [" . $user["email"] . "].");
}
} else {
output_error("[Row " . $row_count . "]\tAdded username [" . $user["username"] . "] to the database, but could not insert password reset entry into password_reset table. Database said: " . $db->ErrorMsg());
开发者ID:nadeemshafique,项目名称:entrada-1x,代码行数:31,代码来源:community-import-guests.php
示例18: foreach
foreach ($publications as $publication) {
$query = "INSERT INTO `profile_publications` (`pub_type`, `pub_id`, `dep_id`, `proxy_id`) VALUES (" . $db->qstr($pub_type) . ", " . $db->qstr($publication) . ", " . $db->qstr($dep_id) . ", " . $db->qstr($ENTRADA_USER->getID()) . ")";
$db->Execute($query);
}
}
}
}
}
$url = ENTRADA_URL . "/admin/users/manage?id=" . $PROXY_ID;
$SUCCESS++;
$SUCCESSSTR[] = "You have successfully updated the <strong>" . html_encode($PROCESSED["firstname"] . " " . $PROCESSED["lastname"]) . "</strong> account in the authentication system.<br /><br />You will now be redirected to the users profile page; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . $url . "\" style=\"font-weight: bold\">click here</a> to continue.";
header("refresh:5;url=" . $url);
if (isset($_POST["send_notification"]) && (int) $_POST["send_notification"] == 1) {
$PROXY_ID = $PROCESSED_ACCESS["user_id"];
do {
$HASH = generate_hash();
} while ($db->GetRow("SELECT `id` FROM `" . AUTH_DATABASE . "`.`password_reset` WHERE `hash` = " . $db->qstr($HASH)));
if ($db->AutoExecute(AUTH_DATABASE . ".password_reset", array("ip" => $_SERVER["REMOTE_ADDR"], "date" => time(), "user_id" => $PROXY_ID, "hash" => $HASH, "complete" => 0), "INSERT")) {
// Send welcome & password reset e-mail.
$notification_search = array("%firstname%", "%lastname%", "%username%", "%password_reset_url%", "%application_url%", "%application_name%");
$notification_replace = array($PROCESSED["firstname"], $PROCESSED["lastname"], $PROCESSED["username"], PASSWORD_RESET_URL . "?hash=" . rawurlencode($PROXY_ID . ":" . $HASH), ENTRADA_URL, APPLICATION_NAME);
$message = str_ireplace($notification_search, $notification_replace, isset($_POST["notification_message"]) ? html_encode($_POST["notification_message"]) : $DEFAULT_EDIT_USER_NOTIFICATION);
if (!@mail($PROCESSED["email"], "Updated User Account: " . APPLICATION_NAME, $message, "From: \"" . $AGENT_CONTACTS["administrator"]["name"] . "\" <" . $AGENT_CONTACTS["administrator"]["email"] . ">\nReply-To: \"" . $AGENT_CONTACTS["administrator"]["name"] . "\" <" . $AGENT_CONTACTS["administrator"]["email"] . ">")) {
$NOTICE++;
$NOTICESTR[] = "The user was successfully added; however, we could not send them a new account e-mail notice. The MEdTech Unit has been informed of this problem, please send this new user a password reset notice manually.<br /><br />You will now be redirected back to the user index; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . $url . "\" style=\"font-weight: bold\">click here</a> to continue.";
application_log("error", "New user [" . $PROCESSED["username"] . "] was given access to OCR but the e-mail notice failed to send.");
}
} else {
$NOTICE++;
$NOTICESTR[] = "The user was successfully added; however, we could not send them a new account e-mail notice. The MEdTech Unit has been informed of this problem, please send this new user a password reset notice manually.<br /><br />You will now be redirected back to the user index; this will happen <strong>automatically</strong> in 5 seconds or <a href=\"" . $url . "\" style=\"font-weight: bold\">click here</a> to continue.";
application_log("error", "New user [" . $PROCESSED["username"] . "] was given access to OCR but the e-mail notice failed to send. Database said: " . $db->ErrorMsg());
开发者ID:nadeemshafique,项目名称:entrada-1x,代码行数:31,代码来源:edit.inc.php
示例19: strtolower
} else {
$gen = 0;
}
}
$sql .= "user_gender = '" . $gen . "' ";
$sql .= " WHERE user_name = '" . $_SESSION["username"] . "' ";
$update = $db->prepare($sql);
$result = $update->execute();
/* //=======================================================
UPLOAD AVATAR
*/
//=======================================================
if ($AllowUploadAvatar == 1 and isset($_FILES["avatar_upload"]) and !empty($_FILES["avatar_upload"])) {
$imagename = strtolower($_FILES['avatar_upload']['name']);
$fileExt = end(explode('.', $imagename));
$savedName = generate_hash(4) . "_" . generate_hash(12) . "." . $fileExt;
$savedName = uniqid(time()) . "." . $fileExt;
$source = $_FILES['avatar_upload']['tmp_name'];
$target = "img/avatars/" . $savedName;
//die($fileExt);
$allowtype = array('gif', 'jpg', 'jpe', 'jpeg', 'png');
if (in_array($fileExt, $allowtype)) {
move_uploaded_file($source, $target);
list($width, $height) = getimagesize($target);
if ($width > $MaxImageSize) {
$modwidth = $MaxImageSize;
} else {
$modwidth = $width;
}
$diff = $width / $modwidth;
$modheight = $height / $diff;
开发者ID:WeKiNGSRO,项目名称:OHSystem,代码行数:31,代码来源:user_profile_page.php
|
请发表评论