$json['login_html'] = get_login_link(); // there is no else because the login_error would be set in the function user_logged_in echo json_encode($json); } elseif ($_POST['action'] == 'logout') { if (logged_out() == true) { $json['login_html'] = get_login_link(); } echo json_encode($json); } // end if login } // end if action set } else { ob_start(); echo "<p>"; $mySQLi->print_error(); echo "</p>\n"; $json['login_error'] = ob_get_clean(); } } catch (Exception $e) { $json['login_error'] = 'Session_mgr exception: ' . $e->getTraceAsString(); echo json_encode($json); } //*********************************************// // Function: logged_out // // params: none.. either logout or fail. // // return: (bool) success. False indicates // // a failure occured, and should not // // happen. // //*********************************************// function logged_out()