function actionSignup($httpData) { $this->view->head(); if (isset($httpData["username"]) && isset($httpData["password"])) { $um = new FreemapUserManager($this->conn); $res = $um->processSignup($httpData['username'], $httpData['password'], $httpData['email']); if (is_int($res)) { $this->view->displaySignupForm($res); } else { $this->view->displaySignupConfirmation(); } } else { $this->view->displaySignupForm(); } $this->view->closePage(); }
function write_login() { echo "<div id='logindiv'>"; if (!isset($_SESSION['gatekeeper'])) { echo "<p>"; echo '<form method="post" ' . 'action="user.php?action=login&redirect=index.php">'; ?> <label for="username">Username</label> <br/> <input name="username" id="username" /> <br/> <label for="password">Password</label> <br/> <input name="password" id="password" type="password" /> <br/> <input type='submit' value='go' id='loginbtn'/> </form> </p> <p> <a href= 'user.php?action=signup&redirect=http://www.fixmypaths.org/index.php'>Sign up</a> </p> <?php } else { echo "<em>Logged in as {$_SESSION['gatekeeper']}</em> "; $conn = new PDO("pgsql:host=localhost;dbname=gis;", "gis"); $um = new FreemapUserManager($conn); $u = $um->getUserFromUsername($_SESSION["gatekeeper"]); if ($u->isAdmin()) { echo "<a href='admin.php'>Admin</a> "; } echo "<a href='user.php?action=logout'>Logout</a>"; } echo "</div>"; }