示例#1
0
 function validateaccount($email, $rand_key_confirm)
 {
     global $__FROG_CONN__;
     $rand_key = $rand_key_confirm;
     $check_validated = "SELECT * FROM " . TABLE_PREFIX . "user WHERE email='{$email}'";
     $result = $__FROG_CONN__->prepare($check_validated);
     $result->execute();
     $count = $result->rowCount();
     if ($count > 0) {
         $registration_settings = "SELECT * FROM " . TABLE_PREFIX . "registered_users_settings WHERE id='1'";
         $registration_settings = $__FROG_CONN__->prepare($registration_settings);
         $registration_settings->execute();
         while ($settings = $registration_settings->fetchObject()) {
             $met = $settings->message_error_technical;
             $message_empty_name = $settings->message_empty_name;
             $message_empty_email = $settings->message_empty_email;
             $message_empty_username = $settings->message_empty_username;
             $message_empty_password = $settings->message_empty_password;
             $message_empty_password_confirm = $settings->message_empty_password_confirm;
             $message_notvalid_password = $settings->message_notvalid_password;
             $message_notvalid_username = $settings->message_notvalid_username;
             $message_notvalid_email = $settings->message_notvalid_email;
             $message_error_already_validated = $settings->message_error_already_validated;
         }
         echo $message_error_already_validated;
     } else {
         $today = date('Y-m-d G:i:s');
         $registration_temp = "SELECT * FROM " . TABLE_PREFIX . "registered_users_temp WHERE email='{$email}'";
         foreach ($__FROG_CONN__->query($registration_temp) as $row) {
             $name = $row['name'];
             $email = $row['email'];
             $username = $row['username'];
             $password = $row['password'];
             $rand_key = $row['rand_key'];
             $reg_date = $row['reg_date'];
             $welcome_message = $row['welcome_message'];
             $message_notvalid_password = $row['message_notvalid_password'];
         }
         if ($rand_key_confirm == $rand_key) {
             // Let's transfer the user from the temp table to the user table
             $update_user_table = "INSERT INTO " . TABLE_PREFIX . "user (`id`,`name`,`email`,`username`,`password`,`created_on`,`updated_on`,`created_by_id`,`updated_by_id`) VALUES\t('','{$name}','{$email}','{$username}','{$password}','{$reg_date}','{$today}','','');";
             $stmt = $__FROG_CONN__->prepare($update_user_table);
             $stmt->execute();
             // We don't need them in the temp table anymore
             $delete_temp_user = "******" . TABLE_PREFIX . "registered_users_temp WHERE email='{$email}'";
             $stmt = $__FROG_CONN__->prepare($delete_temp_user);
             $stmt->execute();
             // And let's make sure we have some permissions set so that user can then do something!
             // First we need the default permssion ID
             $def_permission = "SELECT * FROM " . TABLE_PREFIX . "registered_users_settings";
             foreach ($__FROG_CONN__->query($def_permission) as $row) {
                 $permission_id = $row['default_permissions'];
             }
             // Then we need the correct user ID
             $user = "******" . TABLE_PREFIX . "user WHERE email='{$email}'";
             foreach ($__FROG_CONN__->query($user) as $row) {
                 $id = $row['id'];
             }
             $set_permissions = "INSERT INTO " . TABLE_PREFIX . "user_permission (`user_id`,`permission_id`) VALUES ('{$id}','{$permission_id}');";
             $stmt = $__FROG_CONN__->prepare($set_permissions);
             $stmt->execute();
             // We also need to add the profile settings into DB
             $addprofile = "INSERT INTO " . TABLE_PREFIX . "user_profile (`id`,`firstlogin`,`subscribe`,`sysnotifications`,`haspic`,`profile_blurb`) VALUES ('{$id}','1','1','1','0','your public profile...');";
             $addprofile = $__FROG_CONN__->prepare($addprofile);
             $addprofile->execute();
             echo $welcome_message;
             $loadloginclass = new RegisteredUsers();
             $loadloginclass->login_page();
         } else {
             echo $message_notvalid_password;
         }
     }
 }
示例#2
0
文件: index.php 项目: julpi/FreshCMS
function ru_login_page()
{
    $registered_users_class = new RegisteredUsers();
    $loginpage = $registered_users_class->login_page();
    echo $loginpage;
}