示例#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;
			}
		}
示例#2
0
	//determine return script
	switch( $tb ){
		case 'u':
			$return = 'users';
			break;
		default:
			$return = 'home';
			break;
	}

	if( $uid ){
		$user = User::getByID($uid);
	}
	else{
		$user = false;
	}

	if( $_SESSION['roleid'] == 1 ){
		if( User::deleteByID($user->userid) ){
			header('Location: /' . $return . '.php?code=3');
		}
		else{
			header('Location: /' . $return . '.php?code=4&ec=CASCADE_DELETE_FAIL--' . $user->userid);
		}
	}
	else{
		header('Location: /index.php?code=2');
	}
?>