diff options
author | Mark Campbell-Smith <mcampbellsmith@gmail.com> | 2014-04-01 17:28:27 +1100 |
---|---|---|
committer | Mark Campbell-Smith <mcampbellsmith@gmail.com> | 2014-04-01 17:28:27 +1100 |
commit | 0ef0b52f3a8c45d8222729c1423f6139edf0695c (patch) | |
tree | 14db3bbfc3c0a7a162ce5ee93b925e28edd89576 /auth.php | |
parent | 5a6901161d9680a36871d77f63c60acfe5e2703a (diff) | |
download | RunnerUpLive-0ef0b52f3a8c45d8222729c1423f6139edf0695c.zip |
add admin user
Diffstat (limited to 'auth.php')
-rwxr-xr-x | auth.php | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -74,13 +74,12 @@ if ($require_authentication) { </form> <div id="error">'.(($auth_error==1) ? $lang_authfail : "").'</div> </div> - </body> </html>'; $mysqli->close(); exit; } - + // username submited if ((!$auth) && ($user)){ $query = $mysqli->prepare("SELECT ID,username,password FROM users WHERE username=? LIMIT 1"); @@ -90,6 +89,7 @@ if ($require_authentication) { $query->fetch(); $query->free_result(); //correct pass + if (($user==$rec_user) && ($pass==$rec_pass)) { // login successful //delete old session @@ -98,8 +98,12 @@ if ($require_authentication) { // start new session session_name('trackme'); session_start(); - $_SESSION['auth'] = $rec_ID; - + if (($user==$admin_user) and ($admin_user != "")) { + $_SESSION['auth'] = $admin_user; + } + else { + $_SESSION['auth'] = $rec_ID; + } $url = str_replace("//", "/", $_SERVER['HTTP_HOST'].dirname($_SERVER['SCRIPT_NAME'])."/index.php"); header("Location: $ssl://$url"); exit; @@ -117,7 +121,7 @@ if ($require_authentication) { header("Location: $ssl://$url$error"); exit; } - } + } /* end of authentication */ } ?> |