def dashboard(): #WORKS
    """
    - Redirects to login page if not logged in.
    - Displays dashboard page if logged in.
    """
    if request.method == 'GET':
        if 'user' not in session:
            return redirect(url_for("login_form"))
        else:
            is_admin = (requests.get(url='http://127.0.0.1:8080/is-admin/{}'.format(session['user'])).content).decode("utf-8") # Done
            if is_admin == "True":
                user_count = (requests.get(url='http://127.0.0.1:8080/user-count').content).decode("utf-8") # Done
                video_count = (requests.get(url='http://127.0.0.1:8080/video-count').content).decode("utf-8") # Done
                view_count = (requests.get(url='http://127.0.0.1:8080/view-count').content).decode("utf-8") # Done
                flag_count = (requests.get(url='http://127.0.0.1:8080/flag-count').content).decode("utf-8") # Done
                admin_dashboard = ((requests.get(url='http://127.0.0.1:8080/html/{}'.format('administrator_dashboard.html'))).content).decode("utf-8") # Done
                return render_template_string(admin_dashboard, user_count = user_count, video_count = video_count, view_count = view_count, flag_count = flag_count)
            else:
                username = session['user']
                video_count = (requests.get(url='http://127.0.0.1:8080/user-video-count/{}'.format(username)).content).decode("utf-8") # Done
                view_count = (requests.get(url='http://127.0.0.1:8080/user-view-count/{}'.format(username)).content).decode("utf-8") # Done
                best_vid_ID = (requests.get(url='http://127.0.0.1:8080/user-best-video/{}'.format(username)).content).decode("utf-8") # Done
                best_vid_title = ((requests.get(url='http://127.0.0.1:8080/title/{}'.format(best_vid_ID))).content).decode("utf-8") # Done
                fav_vid_ID = (requests.get(url='http://127.0.0.1:8080/user-fav-video/{}'.format(username)).content).decode("utf-8") # Done
                fav_vid_title = ((requests.get(url='http://127.0.0.1:8080/title/{}'.format(fav_vid_ID))).content).decode("utf-8") # Done
                user_dashboard = ((requests.get(url='http://127.0.0.1:8080/html/{}'.format('user_dashboard.html'))).content).decode("utf-8") # Done
                return render_template_string(user_dashboard, username = session['user'], view_count = view_count, video_count = video_count, high_video_ID = best_vid_ID, high_title = best_vid_title, fav_video_ID = fav_vid_ID, fav_title = fav_vid_title)