/**
  *  Activation du compte.
  *  @author Cam
  *  @return tpl
  */
 protected function main()
 {
     if (empty($_GET['mid']) || empty($_GET['ca'])) {
         header('Location: ./');
     }
     if (is_logged_in()) {
         redir(Nw::$lang['common']['already_connected'], false, './');
     }
     $return_valid = false;
     inc_lib('users/mbr_act_exists');
     if (mbr_act_exists($_GET['mid'], $_GET['ca'])) {
         inc_lib('users/get_info_mbr');
         $donnees_compte = get_info_mbr($_GET['mid']);
         if ($donnees_compte['u_active'] == 0) {
             inc_lib('users/valid_account');
             inc_lib('admin/gen_cachefile_nb_members');
             valid_account($_GET['mid']);
             gen_cachefile_nb_members();
             generate_members_sitemap();
             redir(Nw::$lang['users']['compte_valide'], true, './');
             $return_valid = true;
         }
     }
     if (!$return_valid) {
         redir(Nw::$lang['users']['compte_valid_error'], false, './');
     }
 }
Beispiel #2
0
<?php

if (!user_admin()) {
    include PATH_GLOBAL_VIEW . 'error_not_admin.php';
} else {
    require_once PATH_MODEL . 'members.php';
    valid_account($_GET['hash_validation']);
    header("Location: index.php?module=admin&action=users&id=" . $_SESSION['id']);
    //reload Admin user page
}
//end of user_admin
Beispiel #3
0
    $form_edit_user->add('Text', 'nabz_token')->label('Token du Nabz')->required($required)->value($nabz_token);
    $form_edit_user->add('Submit', 'submit')->value('Éditer');
    if ($form_edit_user->is_valid($_POST)) {
        list($new_login, $new_pass, $new_email, $new_balance, $valid_account, $new_nabz_serial, $new_nabz_token) = $form_edit_user->get_cleaned_data('login', 'password', 'email_addr', 'balance', 'valid_account', 'nabz_serial', 'nabz_token');
        if ($new_pass != $infos_user['user_pass']) {
            $new_pass = sha1($new_pass);
        } else {
            $new_pass = $infos_user['user_pass'];
        }
        if (nabz_exists($new_nabz_serial, $new_nabz_token) == true) {
            update_infos_nabz($id_user, $new_nabz_serial, $new_nabz_token);
        } else {
            $error_update[] = "Couple token/serial incorrect.";
        }
        //end nabz_exist
        $update = update_infos_user($new_login, $new_pass, $new_email, $new_balance, $id_user);
        if ($update[0] == 23000) {
            $error = ereg_replace("for key 3", "", $update[2]);
            $error_update[] = $error;
        } else {
            $msg_confirm[] = "Modification effectuée";
        }
        //end $update
        if (!empty($valid_account)) {
            valid_account($infos_user['hash_validation']);
        }
        //header("Location: index.php?module=admin&action=users&id=".$_SESSION['id']); //Reload page
    }
    //end of form is_valid
    include PATH_VIEW . 'form_edit_users.php';
}
Beispiel #4
0
<?php

//only display this page if user is not connected
if (user_connected()) {
    include PATH_GLOBAL_VIEW . 'error_already_connected.php';
} else {
    ?>

<?php 
    //Is there an hash on the url ?
    if (!empty($_GET['hash'])) {
        if (valid_account($_GET['hash'])) {
            include PATH_VIEW . 'account_validated.php';
        } else {
            //error in validation
            include PATH_VIEW . 'error_account_validation.php';
        }
    } else {
        include PATH_VIEW . 'error_account_validation.php';
    }
    ?>

<?php 
}
//end user_connected verification
Beispiel #5
0
    header('Location:' . BASE_URL . 'index.php');
    exit;
}
//Neu nguoi dung chua dang nhap thi dang nhap
if (isset($_POST["login-click"])) {
    //thu vien validate
    require_once LIB_PATH . '/validate.php';
    //Khoi tao bien
    $loginError = array('message' => '', 'username' => '', 'password' => '');
    //khoi tao bien ok
    $loginOk = TRUE;
    //Khoi tao bien luu du lieu
    $username = trim($_POST["login-username"]);
    $password = trim($_POST["login-password"]);
    //validate du lieu
    if (!valid_account($username)) {
        $loginOk = FALSE;
        //Thong tin loi
        $loginError['username'] = '******';
    }
    if (!valid_password($password)) {
        $loginOk = FALSE;
        $loginError['password'] = '******';
    } else {
        $password = md5($password);
    }
    //Ket noi co so du lieu
    require_once LIB_PATH . '/database.php';
    db_connect();
    if ($loginOk == TRUE) {
        $checkUserQuery = "SELECT * FROM user WHERE uaccount = '{$username}' and upassword = '******'";