Authentication from sub-folder non-wp cookie WordPress

Here is a quick function I had lying around that does exactly what your talking about. It uses some core WP functions to get the job done and you’ll have to modify it to fit your needs, maybe double-check on the security of the thing but it should give you a head start.

function auto_function() {
    if ( isset( $_GET['username'] ) && isset( $_GET['email'] ) ){

        $user_name   = $_GET['username'];
        $user_email  = $_GET['email'];

        $user_id = username_exists( $user_name );
        if ( ! $user_id and email_exists( $user_email ) == false ) {
            $random_password = wp_generate_password( $length=12, $include_standard_special_chars=false );
            $user_id         = wp_create_user( $user_name, $random_password, $user_email );

            $creds = array();
            $creds['user_login'] = $user_name;
            $creds['user_password'] = $random_password;
            $creds['remember'] = true;
            $user = wp_signon( $creds, false );

            $meta_key = 'some_meta_key';
            $meta =& get_user_meta($user, $meta_key, true);
            $site_allowance = 3;

            add_user_meta( $user->id, $meta_key, $site_allowance , TRUE );

            #Redirect to help page
            wp_redirect( site_url('/user-profile/') ); exit;

        } else {
            $random_password = __('User already exists.  Password inherited.');
        }
    }
}