include './includes/page-header.php'; include './includes/functions.php'; $host_url = host_url(); if ($_POST) { if (isset($_SESSION['verifycode']) and $_POST['verifycode'] == $_SESSION['verifycode']['code'] and time() - $_SESSION['verifycode']['time'] < 5 * 60) { $database_config = (require __DIR__ . '/config/database.php'); require_once __DIR__ . '/lib/Medoo.class.php'; $medoo = @new Medoo($database_config); $medoo->query('set names utf8'); $password = trim($_POST['password']); $password_again = trim($_POST['password_again']); $email = $_POST['email']; $has_error = FALSE; $errors = []; //check password $check_user_password_result = check_user_password($password, $password_again); if ($check_user_password_result[0]) { $has_error = TRUE; array_push($errors, $check_user_password_result[1]); } if (!$has_error) { $reset_result = $medoo->update('users', ['password' => md5($password)], ['email' => $email]); if (isset($reset_result)) { $_SESSION['errors']['state'] = 'am-alert-success'; $_SESSION['errors']['details'] = ['恭喜您,重置密码成功!']; header("Location:{$host_url}log.php"); exit; } else { $_SESSION['errors']['state'] = 'am-alert-warning'; $_SESSION['errors']['details'] = ['Sorry,@~_~@,我们的数据库出问题啦,稍后再试']; }
<?php # # Changes password for the user # Called from edit_profile.php # include("redirect.php"); session_start(); include("includes/db_lib.php"); $username = $_SESSION['username']; $old_password = $_REQUEST['old_password']; $new_password = $_REQUEST['new_password']; # Check if old password matches $correct_password = check_user_password($username, $old_password); $url_append = ""; if($correct_password === false) { $url_append = "pmatcherr"; } else { # Update new password in DB $password_changed = change_user_password($username, $new_password); if($password_changed === false) { $url_append = "pupdateerr"; } else { $url_append = "pupdate"; } }
# # Validates username and password # If passed, redirects to home.php # Else, redirects to login.php # include "redirect.php"; require_once "includes/db_lib.php"; //include("includes/db_lib.php"); require_once "includes/user_lib.php"; # Start session if not already started if (session_id() == "") { session_start(); } $username = $_REQUEST['username']; $password = $_REQUEST['password']; $login_correct = check_user_password($username, $password); if ($login_correct) { #Set session variables $user = get_user_by_name($username); $_SESSION['username'] = $username; $_SESSION['user_id'] = $user->userId; $_SESSION['user_actualname'] = $user->actualName; $_SESSION['user_level'] = $user->level; $_SESSION['locale'] = $user->langId; if ($user->level == 17) { $combinedString = $_SESSION['doctorConfig'] = $user->rwoptions; $rwopts = '2,3,4,6,7'; $rwoptsarr = explode(" ", $rwopts); $_SESSION['rwoptionsarray'] = $rwoptsarr; } else { $rwopts = $user->rwoptions;
<?php require 'init.php'; $username = ''; $password = ''; $errors = []; if ($_SERVER['REQUEST_METHOD'] == 'POST') { $username = $_POST['username']; $password = $_POST['password']; if (check_user_password($username, $password)) { login_user(get_user_id_by_username($username)); redirect(APP_URL); } else { $errors[] = "�е �півпадає ім'�-пароль 😞"; } } ?> <!DOCTYPE html> <head> <meta charset="utf-8"> <title>Tubogram</title> <?php echo js_and_css(); ?> </head> <?php page_header('login', 'login'); ?> <div class="container">
$medoo->query('set names utf8'); $password_origin = trim($_POST['password_origin']); $password_new = trim($_POST['password_new']); $password_again = trim($_POST['password_again']); $has_error = FALSE; $errors = []; //check origin password $password = $_SESSION['user']['password']; $password_origin = md5($password_origin); $check_user_password_result1 = check_user_password_origin($password_origin, $password); if ($check_user_password_result1[0]) { $has_error = TRUE; array_push($errors, $check_user_password_result1[1]); } //check password_new $check_user_password_result2 = check_user_password($password_new, $password_again); if ($check_user_password_result2[0]) { $has_error = TRUE; array_push($errors, $check_user_password_result2[1]); } if (!$has_error) { $insert_result = $medoo->update('users', ['password' => md5($password_new)], ['name' => $_SESSION['user']['name']]); if ($insert_result) { $_SESSION['errors']['state'] = 'am-alert-success'; $_SESSION['errors']['details'] = ['密码修改成功!']; $_SESSION['user'] = $medoo->select('users', '*', ['id' => $insert_result])[0]; header("Location:{$host_url}login.php"); exit; } else { $_SESSION['errors']['state'] = 'am-alert-warning'; $_SESSION['errors']['details'] = ['Sorry,@~_~@,我们的数据库出问题啦,稍后再试'];
require_once __DIR__ . '/lib/Medoo.class.php'; $medoo = @new Medoo($database_config); $medoo->query('set names utf8'); $password_origin = trim($_POST['password_origin']); $password_change = trim($_POST['password_change']); $password_again = trim($_POST['password_again']); $has_error = FALSE; $errors = []; $password = $_SESSION['user']['password']; $password_origin = md5($password_origin); $check_user_password_result1 = check_user_password_origin($password_origin, $password); if ($check_user_password_result1[0]) { $has_error = TURE; array_push($errors, $check_user_password_result1[1]); } $check_user_password_result2 = check_user_password($password_change, $password_again); if ($check_user_password_result2[0]) { $has_error = TRUE; array_push($errors, $check_user_password_result2[1]); } if (!$has_error) { $update_result = $medoo->update('users', ['password' => md5($password_change)], ['name' => $_SESSION['user']['name']]); if ($update_result) { $_SESSION['errors']['state'] = 'am-alert-success'; $_SESSION['errors']['details'] = ['恭喜您,修改密码成功!']; header("Location:{$host_url}index.php"); exit; } else { $_SESSION['errors']['state'] = 'am-alert-warning'; $_SESSION['errors']['details'] = ['Sorry,@~_~@,我们的数据库出问题啦,稍后再试']; }
unset($_SESSION['profile_update']); } elseif (!empty($_SESSION['image_uploaded'])) { $upload_picture_success = $_SESSION['image_uploaded'] == 'success'; unset($_SESSION['image_uploaded']); } elseif (!empty($_SESSION['production_uploaded'])) { $upload_production_success = $_SESSION['production_uploaded'] == 'success'; unset($_SESSION['production_uploaded']); } } if ($form->validate()) { $wrong_current_password = false; // $user_data = $form->exportValues(); $user_data = $form->getSubmitValues(1); // set password if a new one was provided if (!empty($user_data['password0'])) { if (check_user_password($user_data['password0'])) { if (!empty($user_data['password1'])) { $password = $user_data['password1']; } } else { $wrong_current_password = true; $_SESSION['is_not_password'] = '******'; } } if (empty($user_data['password0']) && !empty($user_data['password1'])) { $wrong_current_password = true; $_SESSION['is_not_password'] = '******'; } $allow_users_to_change_email_with_no_password = true; if (is_platform_authentication() && api_get_setting('allow_users_to_change_email_with_no_password') == 'false') { $allow_users_to_change_email_with_no_password = false;
<?php require_once '../lib/lib.everything.php'; enforce_master_on_off_switch($_SERVER['HTTP_ACCEPT_LANGUAGE']); $context = default_context(True); /**** ... ****/ $error = ''; switch ($_POST['action']) { case 'log in': $registered_user = get_user_by_name($context->db, $_POST['username']); if (!$registered_user) { $error = 'You are not registered.'; } if (empty($error)) { if (!check_user_password($context->db, $registered_user['id'], $_POST['password'])) { $error = 'That\'s not the correct password!'; } if (empty($error)) { login_user_by_name($context->db, $registered_user['name']); header('Location: ' . $_POST['redirect']); } } break; case 'log out': logout_user(); header('Location: ' . $_POST['redirect']); break; } if (is_logged_in()) { $context->sm->assign('logged_in', true); $context->sm->assign('username', $_SESSION['user']['name']);