} elseif (isset($_COOKIE['usertoken'])) { $res = login2($_COOKIE['usertoken']); if ($res['msg'] == 'OK') { $user = $_SESSION['userid']; } } $postdata = file_get_contents("php://input"); if (!empty($postdata)) { $_POST = json_decode($postdata, TRUE); } if (!empty($_GET['search'])) { $res = search(urldecode($_GET['search'])); } elseif (!empty($_GET['show'])) { $res = getShow($_GET['show'], isset($_GET['force']), isset($_GET['q'])); } elseif (isset($_GET['usershows'])) { $res = getUserShows(); } elseif (!empty($_POST['addshow'])) { $res = addShow($_POST['addshow']); } elseif (!empty($_POST['delshow'])) { $res = delShow($_POST['delshow']); } elseif (!empty($_POST['updateshow'])) { $res = updateShow($_POST['updateshow']); } elseif (!empty($_POST['username']) && !empty($_POST['password'])) { $res = login($_POST['username'], $_POST['password'], isset($_POST['stay']) && $_POST['stay']); } elseif (!empty($_POST['token'])) { $res = login2($_POST['password']); } elseif (isset($_POST['logout'])) { $res = logout(); } elseif (!empty($_POST['registername']) && !empty($_POST['password'])) { $res = register($_POST['registername'], $_POST['password']); } else {
<html ng-app="TVShowManager"> <head> <title>TV Show Manager</title> <meta charset="utf-8"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap-theme.min.css"> <link rel="stylesheet" href="style.css"> <script type="text/javascript"> var userid, username, usershows = []; <?php if ($user != 0) { echo "userid = {$user};"; echo "username = '******';"; echo 'usershows = ' . json_encode(getUserShows()) . ';'; } ?> </script> </head> <body ng-controller="GlobalController"> <div class="container"> <div class="panel panel-default"> <nav class="navbar navbar-default" role="navigation"> <div class="navbar-header"> <span class="navbar-brand">TV Show Manager</span> </div> <div class="collapse navbar-collapse"> <ul class="nav navbar-nav navbar-right"> <li ng-if="!user.loggedin">