예제 #1
0
/**
 * Проверка формы регистрации пользователя
 * @param array $post
 * @return bool|string
 */
function checkUserForm(array $post)
{
    if (mb_strlen($post['fio']) < 10) {
        return "ФИО доджно быть не менее 10 символов.";
    }
    if (mb_strlen($post['phone']) < 11) {
        return "Номер телефона должне быть не менее 11 цифр";
    }
    if (mb_strlen($post['login']) < 10) {
        return "Логин должен быть не менее 10 символов";
    }
    if (mb_strlen($post['password']) < 10) {
        return "Пароль должен быть не менее 10 символов";
    }
    if ($post['password'] != $post['confirm_password']) {
        return "Пароли не совпадают";
    }
    $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) {
        return "Не правильный адрес почты";
    }
    //Если есть пользователь с такой почтой
    if (!is_null(getUserByEmail($post['email']))) {
        return "Указанная почта \"{$post['email']}\" уже используется другим человеком.";
    }
    //Если есть пользователь с таким логином
    if (!is_null(getUserByLogin($post['login']))) {
        return "Указанный login \"{$post['login']}\" уже используется другим человеком.";
    }
    //проверить остальные поля.
    //если все поля заполнены корректно, функция вернет true
    return true;
}
예제 #2
0
function checkUserPwd($user, $pwd)
{
    global $key_pwd;
    if (!($u = getUserByName($user))) {
        $u = getUserByEmail($user);
    }
    if (dc_decrypt($u->password, $key_pwd) == $pwd) {
        return $u;
    } else {
        return false;
    }
}
예제 #3
0
function getLoginInfo($email, $password)
{
    $user = getUserByEmail($email);
    if ($user == null || $password != $user->password) {
        return invalidLogin();
    }
    $eventIds = $user->sharedEvent;
    $events = array();
    foreach ($eventIds as $key => $value) {
        $events[] = R::exportAll($value);
        $dates[$key] = $value['startdate'];
    }
    if (count($events) > 0) {
        array_multisort($dates, SORT_ASC, $events);
    }
    return array(ID => $user->id, USER_FNAME => $user->firstname, USER_LNAME => $user->lastname, USER_EMAIL => $user->email, USER_USEF_ID => $user->usefid, USER_EVENTS => getUserEvents($user->id, $eventIds));
    //count($events) > 0 ? $events : null);
}
예제 #4
0
function createAccount($name, $username, $email, $password)
{
    if (strlen($name) > 100) {
        throw new InvalidArgumentException("Name too large, maximum 100 chars.");
    }
    if (!preg_match("/^\\p{Lu}[\\p{L&}\\.' ]*\$/u", $name)) {
        throw new InvalidArgumentException("Invalid name.");
    }
    $username = strtolower($username);
    if (!preg_match("/^([A-z0-9]|_|-|\\.){3,30}\$/", $username)) {
        throw new InvalidArgumentException("Invalid username. It must contain only alfanumeric characters and have length between 3 and 30.");
    }
    if (getUserByUsername($username)) {
        throw new InvalidArgumentException("Username already registered. Choose a different one.");
    }
    if (strlen($email) > 254) {
        // 254 is the maximum email address size
        throw new InvalidArgumentException("Email too large, maximum 254 chars.");
    }
    $email = strtolower($email);
    if (!preg_match("/^[a-z0-9._%+-]+@[a-z0-9.-]+\\.[a-z]{2,}\$/", $email)) {
        throw new InvalidArgumentException("Invalid email address.");
    }
    if (getUserByEmail($email)) {
        throw new InvalidArgumentException("Email address already registered. Choose a different one.");
    }
    $password_length = strlen($password);
    if ($password_length < 6) {
        throw new InvalidArgumentException("Password too short, minimum 6 chars.");
    }
    if ($password_length > 512) {
        throw new InvalidArgumentException("Password too large, maximum 512 chars.");
    }
    $hash = password_hash($password, PASSWORD_DEFAULT);
    if (!createUser($name, $username, $email, $hash)) {
        throw new RuntimeException("Error inserting new user in the database.");
    }
}
예제 #5
0
파일: functions.php 프로젝트: aazhbd/ArtCms
/**
*   This function loads user home templates for diffferent types of users: e.g admin/ normal user
*/
function getUserHomeByUserType($userType, $email, $al)
{
    if ($userType === "") {
        Errors::report("User type of user is missing.");
        return false;
    }
    $data = getUserByEmail($email, $al->db);
    if ($data === false) {
        return false;
    }
    if (is_string($data)) {
        return $data;
    }
    $name = $data['firstname'] . " " . $data['lastname'];
    switch ($userType) {
        case '0':
            $title = "Welcome, {$name}";
            $subtitle = "You are a normal user.";
            $menuTpl = 'home_user.tpl';
            $mainTpl = 'main.tpl';
            break;
        case '1':
            $title = "Welcome, {$name}";
            $subtitle = "You are an Administrator.";
            $mainTpl = 'admin.tpl';
            $menuTpl = 'admin_menu.tpl';
            $menuBlockTpl = 'admin_menublock.tpl';
            $isadmin = true;
            break;
        default:
            Errors::report("User type of user is invalid.");
            return false;
    }
    $al->tp->assign('title', $title);
    $al->tp->assign('subtitle', $subtitle);
    if ($isadmin) {
        if (!$al->tp->template_exists($menuTpl)) {
            Errors::report("The template file, {$menuTpl} is missing");
            return false;
        }
        if (!$al->tp->template_exists($menuBlockTpl)) {
            Errors::report("The template file, {$menuBlockTpl} is missing");
            return false;
        }
        $body = $al->tp->fetch($menuTpl);
        $body .= $al->tp->fetch($menuBlockTpl);
    } else {
        if (!$al->tp->template_exists($menuTpl)) {
            Errors::report("The template file, {$menuTpl} is missing");
            return false;
        }
        $body .= $al->tp->fetch($menuTpl);
    }
    $al->tp->assign('body', $body);
    if (!$al->tp->template_exists($mainTpl)) {
        Errors::report("The file, {$mainTpl} is missing");
        return false;
    }
    $al->tp->display($mainTpl);
    return true;
}
예제 #6
0
function recover($email)
{
    global $db;
    global $mailer;
    $password = generateRandomString(8);
    $res = pg_query($db, "UPDATE users SET password = '******' WHERE email = '" . pg_escape_string($email) . "'") or die("Database Error");
    if (pg_affected_rows($res) == 1) {
        $user = getUserByEmail($email);
        if ($user) {
            $bodyMessage = "You've requested for the new Password, Your new Password is : <br/><b>{$password} </b> <br/><br/> Please click the below button to login.";
            $body = file_get_contents(MAIL_TEMPLATE_DIRECTORY . "recoverPasswordEmail.tpl");
            $body = str_replace(array("[#BASEURL#]", "[#FIRSTNAME#]", "[#BODY#]", "[#COPYRIGHT_TEXT#]"), array(BASEURL, $user['firstname'], $bodyMessage, COPYRIGHT_TEXT), $body);
            if ($mailer->send(MAIL_FROM, MAIL_FROM_NAME, $user['email'], SITE_NAME_FORMATED . " Studio - Change Your Password", $body)) {
                return true;
            }
        }
        return true;
    }
    return false;
}
<?php

require_once __DIR__ . '/../../../carbon/core.ini.php';
require_once __DIR__ . '/../../../carbon/requests/requests.inc.php';
require_once __DIR__ . '/../../../carbon/responses/responses.inc.php';
require_once __DIR__ . '/../../../carbon/formats/formats.inc.php';
require_once __DIR__ . '/../../../src/account/account.php';
try {
    $db = $config->getDefaultDatabase()->open();
    $user = ['email' => Request::REQUIRED];
    $request = new StandardRequest();
    $user = $request->extract($user);
    $user = arrayToJSONObject($user);
    $response = getUserByEmail($db, $user->email);
} catch (Exception $ex) {
    $response = new ExceptionResponse($ex);
}
$response = new JSONPrettyFormat($response);
$response->present();
예제 #8
0
    global $app;
    $result = new stdClass();
    $result->status = false;
    $user = getUserByName($username);
    if ($user) {
        unset($user["password"]);
        $result->status = true;
        $result->data = $user;
    }
    echo json_encode($result);
});
$app->get("/email/:email", function ($email) {
    global $app;
    $result = new stdClass();
    $result->status = false;
    $user = getUserByEmail($email);
    if ($user) {
        unset($user["password"]);
        $result->status = true;
        $result->data = $user;
    }
    echo json_encode($result);
});
$app->post("/changeavatar", function () {
    global $app;
    $result = new stdClass();
    $result->status = false;
    $user = getUserByKey($_POST["key"]);
    if ($user) {
        $ext = explode('.', $_FILES['file']['name']);
        $ext = $ext[count($ext) - 1];
예제 #9
0
 $user_pseudo = getUserByUsername($pseudo);
 if ($user_pseudo != NULL) {
     $_SESSION['error_msg'] = "This username already exists.";
     $_SESSION['wrong_pseudo'] = true;
     header('location: /app/admin/login/?action=signup');
     exit;
 }
 // Check if the email is valid.
 if (!$email) {
     $_SESSION['error_msg'] = "This email is invalid. Please type a valid email.";
     $_SESSION['wrong_email'] = true;
     header('location: /app/admin/login/?action=signup');
     exit;
 }
 // Check if the email exists in the database.
 $user_email = getUserByEmail($email);
 if ($user_email != NULL) {
     $_SESSION['error_msg'] = "This email already exists.";
     $_SESSION['wrong_email'] = true;
     header('location: /app/admin/login/?action=signup');
     exit;
 }
 // Check if the password meets the requirements.
 if (!$password) {
     $_SESSION['error_msg'] = "Your password must contain at least 8 characters and be composed of at least 1 number, 1 uppercase letter and 1 lowercase letter.";
     $_SESSION['wrong_password'] = true;
     header('location: /app/admin/login/?action=signup');
     exit;
 }
 // Check if password and verifiy match.
 $hashed_password = hash_password($password);
예제 #10
0
function process_registration()
{
    // used for testing
    //sleep(1);
    $username = strtolower(trim($_POST['username']));
    $email = trim($_POST['email']);
    $password = trim($_POST['password']);
    include _DOCROOT . '/inc/sql-core.php';
    include _DOCROOT . '/html/pre-header.php';
    include _DOCROOT . '/inc/functions.class.php';
    include _DOCROOT . '/modules/site/site-data.php';
    $fn = new Functions();
    $err = false;
    // 1. check value fields.
    $email_check = $fn->checkEmail($email);
    if ($email_check === false) {
        $err = true;
        $htmls['#email_err'] = 'Invalid format. Use something similar to username@domain.com';
    }
    $un_check = $fn->checkUsername($username);
    if ($un_check != "") {
        $err = true;
        $htmls['#username_err'] = $un_check;
    }
    $pw_check = $fn->checkUsername($password);
    if ($pw_check != "") {
        $err = true;
        $htmls['#password_err'] = $pw_check;
    }
    $existingUser = getUserByUsername($username);
    if (count($existingUser) > 0) {
        $err = true;
        $htmls['#username_err'] = "Username already exists. Try a different name.";
    }
    $existingUser = getUserByEmail($email);
    if (count($existingUser) > 0) {
        $err = true;
        $htmls['#email_err'] = "This email is already registered. Try a different one.";
    }
    if ($err) {
        echo json_encode(array('htmls' => $htmls));
    } else {
        // 2. create user folder.
        $fn->makeUserFolder(strtolower($username));
        // 3. create salt / tokens.
        $salt = md5($username . time());
        $token = md5($email . $salt);
        // 4. insert into database.
        $sql_u = "INSERT INTO signup (\n                email,\n                username,\n                `password`,\n                token,\n                salt,\n                fname,\n                lname,\n                bday,\n                created,\n                lastloggedin\n            ) VALUES (\n                ?,?,?,?,?,?,?,?,?,?\n            )";
        sqlRun($sql_u, 'ssssssssii', array($email, $username, md5($password), $token, $salt, "", "", "", time(), time()));
        // 5. send out email.
        $to = $email;
        $subject = "Your Website Registration";
        $message = "Click this link to validate your email. Or, copy / paste this code";
        $headers = 'From: webmaster@mypersonalwebsite.com' . "\r\n" . 'Reply-To: webmaster@mypersonalwebsite.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion();
        //mail($to, $subject, $message, $headers);
        // 6. Set session variables.
        $_SESSION['site_user_username'] = $username;
        $_SESSION['site_user_salt'] = $salt;
        $_SESSION['site_user_token'] = $token;
        // 7. display success message (check email or check email and enter verification code).
        echo json_encode(array('closevbox' => true, 'redirect' => $username));
        /*
        echo json_encode(array(
            'closevbox' => true,
            'redirect' => strtolower(trim($_POST['username']))
        ));
        */
    }
}
예제 #11
0
    if (checkUser($_POST['email'], $_POST['password'])) {
        /* Cookie expires when browser closes */
        $_COOKIE['email'] = $_POST['email'];
        setcookie('email', $_POST['email'], false, '/');
        setcookie('password', $_POST['password'], false, '/');
    } else {
        header('Location: login.php?e=Login%20Failed');
    }
} else {
    if (isset($_COOKIE['email']) && isset($_COOKIE['password']) && $_COOKIE['email'] != NULL) {
        // proceed as normal
    } else {
        header('Location: login.php?e=Please%20Login!');
    }
}
$user = getUserByEmail($_COOKIE['email']);
if (isset($_POST['create_team'])) {
    $name = cleanInput($_POST['team_name']);
    if (isTeamUsed($name)) {
        $e = "Team name is already used!";
    } else {
        $teamId = createTeam($name, $user['id']);
        $s = "Team " . $name . " was successfully created!  Access code: " . $teamId * 7;
        joinTeam($user['id'], $teamId);
        $user['team_id'] = $teamId;
    }
} else {
    if (isset($_POST['join_team'])) {
        $teamId = cleanInput($_POST['team_id']) / 7;
        if (!isTeamValid($teamId)) {
            $e = "Access code is not valid";
예제 #12
0
 if ($_POST['location'] == 'other') {
     $location = mysql_real_escape_string($_POST['otherlocation']);
 } else {
     $location = mysql_real_escape_string($_POST['location']);
 }
 $password = mysql_real_escape_string(md5($_POST['password']));
 $user_name = mysql_real_escape_string($_POST['user_name']);
 $android_app = 'web_user';
 $month_name = mysql_real_escape_string($_POST['month_name']);
 $day_name = mysql_real_escape_string($_POST['day_name']);
 $year_name = mysql_real_escape_string($_POST['year_name']);
 $birth_date = $year_name . "-" . $month_name . "-" . $day_name;
 $birth_date = date("Y-m-d", strtotime($birth_date));
 $verificationcode = generateCode(1);
 $activation = md5($email . time());
 $user_register = getUserByEmail($email);
 $user = mysql_fetch_array($user_register);
 registerNewUser($name, $email, $user_name, $password, $gender, $birth_date, $location, $phone_number, $activation, $verificationcode, $android_app);
 $last_users = getLastRegisterUser();
 $last_user = mysql_fetch_array($last_users);
 $registration_points = 5;
 createUserGameCoins($last_user['id'], $registration_points);
 $base_url = "http://www.maverickgame.com/activation.php?code=" . $activation;
 $subject = "Registration successful, please activate email at Maverick Game";
 $from = "*****@*****.**";
 $email_server = "*****@*****.**";
 $to = $email;
 $mail_body = "Dear {$name},<br/><br/>You have embarked on a journey where your role will change along with the game you choose to play. From here onwards this portal is your abode and you are destined to achieve greatness. Greatness bigger than what you had fathomed this is your true calling. <br/> <br/> You are new here but remember you are the chosen one. Competition will be ruthless and the going will get difficult. You may win some and you may lose some. Your ranking is down low and reaching top will be difficult. It may take time for you to master the game but remember that greatness is achieved by perseverance and not just through talent.<br/><br/>So proceed to your first game and make your way to the top of leaderboard. Riches and glory await you, Chosen One.<br/><br/><a href=" . $base_url . ">.{$base_url}.'</a>' <br/><br/>Your game score gives you reward points, through which you can redeem real life products ranging from Mobile scratch card to a Mercedes Benz. Better you play more rewards you get !<br/></br>Regards,<br/><br/>Team Maverick Game<br><br>For any queries please write to us : info@maverickgame.com";
 $body = wordwrap($mail_body, 2000);
 //$body_user = wordwrap($mail_body_user,70);
 $headers = "MIME-Version: 1.0" . "\r\n";
예제 #13
0
파일: editUser.php 프로젝트: evgeniya994/HH
 if (empty($post['houseNum']) || preg_match('/^[0-9]+[\\/а-яА-ЯЁ]/', $post['HouseNum'])) {
     $errorHouseNum = "Вы не указали дом";
 }
 if (mb_strlen($post['login']) < 4 || preg_match('/[^0-9a-zA-Z]/', $post['login'])) {
     $errorLogin = "******";
 }
 if (mb_strlen($post['password']) < 10) {
     $errorPassword = "******";
 }
 $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 ($currentUser['email'] != $post['email']) {
     //Если (текущий логин отличается от того что ввели)
     if (!is_null(getUserByEmail($post['email']))) {
         //смотрим в базе есть ли такой, Если есть то ошибка
         $errorEmail = "Указанная почта \"{$post['email']}\" уже используется другим человеком.";
     }
 }
 if ($currentUser['login'] != $post['login']) {
     //Если (текущий логин отличается от того что ввели)
     if (!is_null(getUserByLogin($post['login']))) {
         //смотрим в базе есть ли такой, Если есть то ошибка
         $errorLogin = "******"{$post['login']}\" уже используется другим человеком.";
     }
 }
 $post['kv'] = abs((int) $post['kv']);
 if ($post['kv'] == 0) {
     $errorKv = "кв. должна быть > 0";
 }
<section class="second">
<div class="container">
    
  
</div>
</div>
</section>


<section class="second">
<div class="container">
<div class="row">

<?php 
$email = $_SESSION['email'];
$loginuser = getUserByEmail($email);
if ($loginuser > 0) {
    $user = mysql_fetch_array($loginuser);
    $birth_date = $user['birth_date'];
    $birth_date = explode("-", $birth_date);
    $birth_day = $birth_date[2];
    $birth_month = $birth_date[1];
    $birth_year = $birth_date[0];
}
?>
    
<div class="col-md-12 bgwhite" style="margin-top:50px;">
  <h1 class="MOTHERINGMOM">MY PROFILE</h1>

<div class="col-md-4">
<br/>
예제 #15
0
파일: login.php 프로젝트: zangfenziang/DOJ
<?php

require_once 'query/message.php';
$msg = $_POST;
if (isset($msg['user'])) {
    $user = $msg['user'];
}
if (isset($msg['password'])) {
    $pwd = $msg['password'];
}
$rem = isset($msg['remember']);
if (getUserByName($user) || getUserByEmail($user)) {
    if ($r = checkUserPwd($user, $pwd)) {
        if ($rem) {
            $time = time() + 3600 * 24 * 365;
        } else {
            $time = 0;
        }
        setcookie("DOJSS", DOJSS($r->id, $r->password), $time);
        header("Location:/");
    } else {
        $error = $err['wrongPwd'];
    }
} else {
    $error = $err['noUser'];
}
require_once 'template/login.php';
예제 #16
0
<?php

require_once "query/message.php";
$DOJSS = $_COOKIE['DOJSS'];
$mail = safe($_POST['mail']);
$pwd = safe($_POST['password']);
$user = checkDOJSS($DOJSS);
if (!checkEmail($mail)) {
    send(1, $err['wrongEmailFormat']);
}
if ($user) {
    if ($user->mail == $mail) {
        send(2, $warning['sameMsg']);
    }
    if (getUserByEmail($mail)) {
        send(1, $err['sameEmail']);
    }
    if (dc_decrypt($user->password, $key_pwd) != $pwd) {
        send(1, $err['wrongPwd']);
    }
    $uid = $user->id;
    mysql_query("UPDATE `users` SET \n\t\t\t`mail` = '{$mail}'\n\t\tWHERE `id` = {$uid} ");
    $gravatar = "//cn.gravatar.com/avatar/" . md5($mail) . "?d=mm";
    if (mysql_affected_rows()) {
        send(0, $tip['changedMail'], "\$('#gravatar').attr('src', '{$gravatar}');");
    } else {
        send(1, $err['notSaved']);
    }
} else {
    send(1, $err['wrongDOJSS']);
}
예제 #17
0
/**
* Create a scheduling request in the schedule inbox for the
* @param iCalComponent $resource The VEVENT/VTODO/... resource we are scheduling
* @param iCalProp $attendee The attendee we are scheduling
* @return float The result of the scheduling request, per caldav-sched #3.5.4
*/
function write_scheduling_request(&$resource, $attendee_value, $create_resource)
{
    $email = preg_replace('/^mailto:/', '', $attendee_value);
    $schedule_target = getUserByEmail($email);
    if (isset($schedule_target) && is_object($schedule_target)) {
        $attendee_inbox = new WritableCollection(array('path' => $schedule_target->dav_name . '.in/'));
        if (!$attendee_inbox->HavePrivilegeTo('schedule-deliver-invite')) {
            $response = '3.8;' . translate('No authority to deliver invitations to user.');
        }
        if ($attendee_inbox->WriteCalendarMember($resource, $create_resource)) {
            $response = '2.0;' . translate('Scheduling invitation delivered successfully');
        } else {
            $response = '5.3;' . translate('No scheduling support for user');
        }
    } else {
        $response = '5.3;' . translate('No scheduling support for user');
    }
    return '"' . $response . '"';
}
예제 #18
0
<?php

require 'queries/userQueries.php';
require 'password_compat.php';
$fields = array('email', 'password');
$inputs = array();
//check POST object for variables from front end
foreach ($fields as $postKey) {
    if (isset($_POST[$postKey]) && !empty($_POST[$postKey])) {
        $inputs[$postKey] = $_POST[$postKey];
    } else {
        return errorHandler("missing {$postKey}", 503);
    }
}
//get the user's password
$stmt = getUserByEmail($DB, $inputs['email']);
if (!$stmt) {
    return;
}
//authLogin already sent an error.
if (!$stmt->execute()) {
    return errorHandler("failed to create this list {$stmt->errno}: {$stmt->error}");
}
$data = array();
$stmt->bind_result($data['id'], $data['name'], $data['hash']);
$stmt->fetch();
if (password_verify($inputs['password'], $data['hash'])) {
    $_SESSION['time'] = time();
    $_SESSION['userId'] = $data['id'];
    $_SESSION['userName'] = $data['name'];
} else {
예제 #19
0
			</div>
			<?php 
    }
}
?>

			<?php 
$user_email = isset($_REQUEST["user_id"]) ? $_REQUEST["user_id"] : getEmail();
?>

			<section class="inner-content-container">
				<div class="wc cf">
					<div class="inner-content">
						<form class="front-end-form">
							<input type="text" name="username" id="username" value="<?php 
echo getUserByEmail($user_email)["name"];
?>
">
							<input type="hidden" name="email" id="email" value="<?php 
echo $user_email;
?>
">
							<input type="text" name="new-email" id="new-email" value="<?php 
echo $user_email;
?>
">
							<input type="password" name="password" id="password" value="" placeholder="<?php 
_e('New Password', 'kb');
?>
">
							<input type="password" name="confirm_password" id="confirm_password" value="" placeholder="<?php 
예제 #20
0
<?php

if (isset($_REQUEST['email'])) {
    include "dbconnection.php";
    $email = $_REQUEST['email'];
    $passkey = $_REQUEST['passkey'];
    $result = getUserByEmail($email);
    $user = mysql_fetch_array($result);
} else {
    header("location:index.php");
}
?>
<!DOCTYPE HTML>
<html>
<head>

<title>Maverick Game|Reset Password</title>
<meta name="description" content="" />
<meta name="keywords" content="" />

<link rel="shortcut icon" href="favicon.png" type="image/x-icon"/>
<link href='http://fonts.googleapis.com/css?family=PT+Sans:400,700' rel='stylesheet' type='text/css' /
<link href='http://fonts.googleapis.com/css?family=Didact+Gothic' rel='stylesheet' type='text/css'>
<link rel="stylesheet" type="text/css" href="assets/css/style.css"/>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="assets/js/jquery.min.js" type="text/javascript"></script>
<script src="assets/js/bootstrap.min.js"></script>
<script src="assets/js/script.js"></script>
<script src="assets/js/wow.min.js"></script>
<script src="assets/js/jquery-1.9.1.js"></script>
예제 #21
0
 }
 if ($email != $emailchek) {
     $errors[] = lang("ACCOUNT_EMAIL_MISMATCH");
 } elseif (!isValidemail($email)) {
     $errors[] = lang("ACCOUNT_INVALID_EMAIL");
 }
 if (is_null($zip) && is_null($city)) {
     $errors[] = lang("ACCOUNT_NEED_LOCATION");
 }
 //End data validation
 if (count($errors) == 0) {
     //Construct a user auth object
     $auth = new RedcapAuth($username, NULL, $email, $fname, $lname, $zip, $city, $state, $actualage);
     //Checking this flag tells us whether there were any errors such as possible data duplication occured
     if ($auth->emailExists()) {
         $tempu = getUserByEmail($email);
         $olduser = new RedcapPortalUser($tempu->user_id);
         if ($olduser->isActive()) {
             //CURRENT ACCOUNT + ACTIVE (LINK ALREADY CLICKED)
             $errors[] = lang("ACCOUNT_EMAIL_IN_USE_ACTIVE", array($email));
         } else {
             //CURRENT ACCOUTN NOT ACTIVE
             if ($oldenough && $nextyear && $optin && $actualage >= 18) {
                 //WAS FORMERLY INELIGIBLE NOW ELIGIBLE, SEND ACTIVATION LINK
                 $errors[] = lang("ACCOUNT_NEW_ACTIVATION_SENT", array($email));
                 //SEND NEW ACTIVATION LINK
                 $olduser->updateUser(array(getRF("zip") => $zip, getRF("city") => $city, getRF("state") => $state, getRF("age") => $actualage));
                 $olduser->createEmailToken();
                 $olduser->emailEmailToken();
                 //CLEAN UP
                 unset($fname, $lname, $email, $zip, $city);
예제 #22
0
        if (has_post_thumbnail()) {
            $image = wp_get_attachment_url(get_post_thumbnail_id($post->ID), 'full');
        } else {
            $image = get_template_directory_uri() . '/imgs/gen-banner.jpg';
        }
        ?>
			<div class="page-banner" style="background:url('<?php 
        echo esc_url($image);
        ?>
') no-repeat center top / cover;">
				<div class="wc">
					<?php 
        $user_id = isset($_REQUEST["user_id"]) ? $_REQUEST["user_id"] : explode(":", $_COOKIE['kallababy_user'])[0];
        ?>
					<h1><?php 
        echo getUserByEmail($user_id)["name"];
        ?>
's Account</h1>
					<input type="hidden" name="current-profile-email" id="current-profile-email" value="<?php 
        echo $user_id;
        ?>
" />
					<?php 
    }
}
?>
					<ul class="quick-menu">
						<li><a href="<?php 
echo home_url();
?>
/edit-users-profile/?user_id=<?php 
function createUser(PDO $db, $user)
{
    $response = getUserByEmail($db, $user->email);
    if ($response->getType() == Response::SUCCESS) {
        return new ErrorResponse("User already exist.", $user);
    }
    $query = '  INSERT INTO 
                    users(
                        fullname,
                        email,
                        type,
                        gcmregid,
                        created,
                        updated
                    )
                VALUES(
                    :fullname,
                    :email,
                    :type,
                    :gcmregid,
                    NOW(),
                    NOW()
                )';
    try {
        $statement = $db->prepare($query);
        $statement->bindValue(':fullname', $user->fullname, PDO::PARAM_STR);
        $statement->bindValue(':email', $user->email, PDO::PARAM_STR);
        $statement->bindValue(':type', $user->type, PDO::PARAM_INT);
        $statement->bindValue(':gcmregid', $user->gcmregid, PDO::PARAM_STR);
        $statement->execute();
        if ($statement->rowCount() >= 1) {
            $userId = $db->lastInsertId();
            $response = getUserById($db, $userId);
            if ($response->getType() == Response::SUCCESS) {
                return new SuccessResponse("User created.", $response->getData());
            } else {
                return $response;
            }
        }
        return new ErrorResponse('User could not be registered.');
    } catch (PDOException $ex) {
        return new ExceptionResponse('PDOException was caught.', $ex);
    }
}
<?php

header('Content-type: application/json');
chdir('../../common');
require_once 'init.php';
chdir('../database');
require_once 'plataform.php';
chdir('../actions');
require_once 'plataform.php';
chdir('../ajax/plataform');
if (isset($_GET['name']) and isset($_GET['email']) and isset($_GET['password'])) {
    $user = getUserByEmail($_GET['email']);
    if (isset($user) and ($user['privilege'] == 'merchant' or $user['privilege'] == 'admin')) {
        echo json_encode(array("result" => "userAlreadyExists"));
    } else {
        try {
            $id = createMerchant($_GET['name'], $_GET['email'], $_GET['password']);
            $hash = generateActivationHash($id);
            sendConfirmationEmail($id);
            echo json_encode(array("result" => "ok", "id" => $id));
        } catch (Exception $e) {
            echo json_encode(array("result" => "error"));
        }
    }
} else {
    echo json_encode(array("result" => "missingParams"));
}
    $isValid = false;
}
// // confirm the message has content
if (strlen($_POST["content"]) > 2) {
} else {
    $isValid = false;
}
// if form is filled out properly
if ($isValid) {
    // have we seent this user before?
    $cleanEmail = mysql_real_escape_string($_POST['email']);
    $previousUser = getUserByEmail($cleanEmail, $connection);
    if (!$previousUser) {
        // create the user if they do not exist
        createUser($cleanEmail, $connection);
        $newUser = getUserByEmail($cleanEmail, $connection);
        // determine their ID
        $userId = $newUser["id"];
    } else {
        // if user is found determine their ID
        $userId = $previousUser["id"];
    }
    // get message contents
    $message = compileMessage($_POST, $userId);
    // create the message!
    createMessage($message, $connection);
    // send message to user that their message has been recieved
    header("Location: thankyou.php");
} else {
    // redirect back to empty form
    header("Location: newMessage.php");