Ejemplo n.º 1
0
		public static function add($fname, $lname, $identity, $pass, $roleid){
			$okay = Authentication::checkIdentity($identity);
			
			if( $okay === 0 ){
				$user = new User(null, $fname, $lname, null);
				$res = $user->save();

				if( $res ){
					$auth = Authentication::addForUser($res->userid, $identity, $pass, $roleid);
					$cont = Contact::addForUserID($res->userid, $identity);
					
					if( $auth && $cont ){
						return $res;
					}
					else{
						if( User::deleteByID($res->userid) ){
							return false;
						}
						else{
							//you are just totally screwed
						}
					}
				}
			}
			else{
				return false;
			}
		}
Ejemplo n.º 2
0
		public static function add($fname, $lname, $ident, $pass, $roleid)
		{
			$okay = Authentication::checkIdentity($ident);
			
			if( $okay === 0 )
			{
				$user = new User(null, $fname, $lname);
				$res = $user->save();
				
				if( $res )
				{
					$auth = Authentication::addForUser($res->userid, $ident, $pass, $roleid);
					if( $auth )
					{
						return $res;
					}
					else
					{
						$status = User::delete($res->userid);
						
						if( $status )
						{
							return false;
						}
						else
						{
							//you are just totally screwed
						}
					}
				}
			}
			else
			{
				return false;
			}
		}
Ejemplo n.º 3
0
	require_once('Authentication.php');
	require_once('User.php');
	require_once('Session.php');
	require_once('Quick_Login.php');
	require_once('Mail.php');
	setSession(0, '/');

	$password = isset($_POST['password']) ? $_POST['password'] : null;
	$vp = isset($_POST['vpass']) ? $_POST['vpass'] : null;
	$data['email'] = isset($_POST['email']) ? $_POST['email'] : null;
	$data['vemail'] = isset($_POST['vemail']) ? $_POST['vemail'] : null;
	$data['fname'] = isset($_POST['fname']) ? $_POST['fname'] : null;
	$data['lname'] = isset($_POST['lname']) ? $_POST['lname'] : null;

	if( ($password == $vp) && ($data['email'] == $data['vemail']) && ($password != null) && ($data['email'] != null) ){
		if( Authentication::checkIdentity($data['email']) == 0 ){
			//create user
			$user = User::add($data['fname'],$data['lname'],$data['email'],$password,3);
			if( $user ){
				$auth = $user->authentication;
				$auth->resetPassword = 0;
				$auth->disabled = 1;
				$auth->save();

				//create login hash
				$hash = hash('whirlpool', $user->authentication->identity . time() . (time() / 64));
				if( !Quick_Login::add($hash, $user->userid, time() + 3600, 0) ){
					// die
				}

				//load email template