1<?php 2 3session_start(); 4 5require_once '../include/prepend.php'; 6 7if (!empty($_SESSION['user'])) { 8 redirect('index.php'); 9} 10 11response_header('Login'); 12 13if (isset($_POST['user'])) { 14 $referer = $_POST['referer']; 15 16 bugs_authenticate($user, $pwd, $logged_in, $user_flags); 17 18 if ($logged_in === 'developer') { 19 if (!empty($_POST['referer']) && 20 preg_match("/^{$site_method}:\/\/". preg_quote($site_url) .'/i', $referer) && 21 parse_url($referer, PHP_URL_PATH) != '/logout.php') { 22 redirect($referer); 23 } 24 redirect('index.php'); 25 } else { 26?> 27 <div style="background: #AB1616; padding: 3px; width: 300px; color: #FFF; margin: 3px;">Wrong username or password! <a href="https://main.php.net/forgot.php">Forgot your password?</a></div> 28<?php 29 } 30} else { 31 $referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : ''; 32} 33 34?> 35 36<form method="post" action="login.php"> 37<input type="hidden" name="referer" value="<?php print htmlspecialchars($referer); ?>"> 38<table> 39 <tr> 40 <th align="right">Username:</th> 41 <td><input type="text" name="user" value="<?php print isset($user) ? htmlspecialchars($user) : ''; ?>">@php.net 42 </tr> 43 <tr> 44 <th align="right">Password:</th> 45 <td><input type="password" name="pw" value="<?php print isset($pwd) ? htmlspecialchars($pwd) : ''; ?>"> 46 </tr> 47 <tr> 48 <td align="center" colspan="2"><input type="submit" value="Login"></td> 49 </tr> 50</table> 51</form> 52 53<?php 54response_footer(); 55?> 56