Example #1
0
				$DB->query("SELECT MAX(TreeID) FROM invite_tree");
				list($TreeID) = $DB->next_record();
				$TreeID++;
				$InviterID = 0;
				$TreePosition=1;
				$TreeLevel=1;
			}
			
			// Create invite tree record
			$DB->query("INSERT INTO invite_tree 
				(UserID, InviterID, TreePosition, TreeID, TreeLevel) VALUES
				('$UserID', '$InviterID', '$TreePosition', '$TreeID', '$TreeLevel')");
			
			include(SERVER_ROOT.'/classes/class_templates.php');
			$TPL=NEW TEMPLATE;
			$TPL->open(SERVER_ROOT.'/templates/new_registration.tpl');
			
			$TPL->set('Username',$_REQUEST['username']);
			$TPL->set('TorrentKey',$torrent_pass);
			$TPL->set('SITE_NAME',SITE_NAME);
			$TPL->set('SITE_URL',SITE_URL);

			send_email($_REQUEST['email'],'New account confirmation at '.SITE_NAME,$TPL->get(),'noreply');
			$Sent=1;
		}
		
	} elseif($_GET['invite']) {
		// If they haven't submitted the form, check to see if their invite is good
		$DB->query("SELECT InviteKey FROM invites WHERE InviteKey='".db_string($_GET['invite'])."'");
		if($DB->record_count() == 0){
			error('Invite not found!');
Example #2
0
 $Validate->SetFields('email', '1', 'email', 'You entered an invalid email address.');
 if (!empty($_REQUEST['email'])) {
     // User has entered email and submitted form
     $Err = $Validate->ValidateForm($_REQUEST);
     if (!$Err) {
         // Form validates correctly
         $DB->query("\n\t\t\t\t\tSELECT\n\t\t\t\t\t\tID,\n\t\t\t\t\t\tUsername,\n\t\t\t\t\t\tEmail\n\t\t\t\t\tFROM users_main\n\t\t\t\t\tWHERE Email = '" . db_string($_REQUEST['email']) . "'\n\t\t\t\t\t\tAND Enabled = '1'");
         list($UserID, $Username, $Email) = $DB->next_record();
         if ($UserID) {
             // Email exists in the database
             // Set ResetKey, send out email, and set $Sent to 1 to show success page
             $ResetKey = Users::make_secret();
             $DB->query("\n\t\t\t\t\t\tUPDATE users_info\n\t\t\t\t\t\tSET\n\t\t\t\t\t\t\tResetKey = '" . db_string($ResetKey) . "',\n\t\t\t\t\t\t\tResetExpires = '" . time_plus(60 * 60) . "'\n\t\t\t\t\t\tWHERE UserID = '{$UserID}'");
             require SERVER_ROOT . '/classes/templates.class.php';
             $TPL = new TEMPLATE();
             $TPL->open(SERVER_ROOT . '/templates/password_reset.tpl');
             // Password reset template
             $TPL->set('Username', $Username);
             $TPL->set('ResetKey', $ResetKey);
             $TPL->set('IP', $_SERVER['REMOTE_ADDR']);
             $TPL->set('SITE_NAME', SITE_NAME);
             $TPL->set('SITE_URL', NONSSL_SITE_URL);
             Misc::send_email($Email, 'Password reset information for ' . SITE_NAME, $TPL->get(), 'noreply');
             $Sent = 1;
             // If $Sent is 1, recover_step1.php displays a success message
             //Log out all of the users current sessions
             $Cache->delete_value("user_info_{$UserID}");
             $Cache->delete_value("user_info_heavy_{$UserID}");
             $Cache->delete_value("user_stats_{$UserID}");
             $Cache->delete_value("enabled_{$UserID}");
             $DB->query("\n\t\t\t\t\t\tSELECT SessionID\n\t\t\t\t\t\tFROM users_sessions\n\t\t\t\t\t\tWHERE UserID = '{$UserID}'");
Example #3
0
                 $TreeLevel++;
                 // Create invite tree record
                 $DB->query("INSERT INTO invite_tree \n\t\t\t\t\t\t(UserID, InviterID, TreePosition, TreeID, TreeLevel) VALUES\n\t\t\t\t\t\t('{$UserID}', '{$InviterID}', '{$TreePosition}', '{$TreeID}', '{$TreeLevel}')");
             }
         } else {
             // No inviter (open registration)
             $DB->query("SELECT MAX(TreeID) FROM invite_tree");
             list($TreeID) = $DB->next_record();
             $TreeID++;
             $InviterID = 0;
             $TreePosition = 1;
             $TreeLevel = 1;
         }
         include 'class_templates.php';
         $TPL = new TEMPLATE();
         $TPL->open('new_registration.tpl');
         $TPL->set('Username', $_REQUEST['username']);
         $TPL->set('TorrentKey', $torrent_pass);
         $TPL->set('SITE_NAME', SITE_NAME);
         $TPL->set('SITE_URL', SITE_URL);
         send_email($_REQUEST['email'], 'New account confirmation at ' . SITE_NAME, $TPL->get(), 'noreply');
         $Sent = 1;
     }
 } elseif (isset($_GET['invite']) && !empty($_GET['invite'])) {
     // If they haven't submitted the form, check to see if their invite is good
     $DB->query("SELECT InviteKey FROM invites WHERE InviteKey='" . db_string($_GET['invite']) . "'");
     if ($DB->record_count() == 0) {
         error('Invite not found!');
     }
 }
 include ASSETS . '/register_step1.php';
Example #4
0
 /**
  * Initiate a password reset
  *
  * @param int $UserID The user ID
  * @param string $Username The username
  * @param string $Email The email address
  */
 public static function resetPassword($UserID, $Username, $Email)
 {
     $ResetKey = Users::make_secret();
     G::$DB->query("\n\t\t\tUPDATE users_info\n\t\t\tSET\n\t\t\t\tResetKey = '" . db_string($ResetKey) . "',\n\t\t\t\tResetExpires = '" . time_plus(60 * 60) . "'\n\t\t\tWHERE UserID = '{$UserID}'");
     require SERVER_ROOT . '/classes/templates.class.php';
     $TPL = new TEMPLATE();
     $TPL->open(SERVER_ROOT . '/templates/password_reset.tpl');
     // Password reset template
     $TPL->set('Username', $Username);
     $TPL->set('ResetKey', $ResetKey);
     $TPL->set('IP', $_SERVER['REMOTE_ADDR']);
     $TPL->set('SITE_NAME', SITE_NAME);
     $TPL->set('SITE_URL', NONSSL_SITE_URL);
     Misc::send_email($Email, 'Password reset information for ' . SITE_NAME, $TPL->get(), 'noreply');
 }