EVOLUTION-MANAGER
Edit File: global_nav.php
<div id="topNav" class="navbar navbar-static-top"> <div> <div class="container-fluid"> <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </a> <a class="brand" href="index.php">TalkToMeNow</a> <div class="tagline">Express your heart's desire with your beautiful friends</div> <div class="nav-collapse pull-right"> <ul class="nav"> <li><a href="indexold.php">Order Medicine</a></li> <?php if(!isUserLoggedIn()) { if(!empty($_POST)) { $errors = array(); $username = sanitize(trim($_POST["username"])); $password = trim($_POST["password"]); //Perform some validation //Feel free to edit / change as required if($username == "") { $errors[] = lang("ACCOUNT_SPECIFY_USERNAME"); } if($password == "") { $errors[] = lang("ACCOUNT_SPECIFY_PASSWORD"); } if(count($errors) == 0) { //A security note here, never tell the user which credential was incorrect if(!usernameExists($username)) { $errors[] = lang("ACCOUNT_USER_OR_PASS_INVALID"); } else { $userdetails = fetchUserDetails($username); //See if the user's account is activated if($userdetails["active"]==0) { $errors[] = lang("ACCOUNT_INACTIVE"); } else { //Hash the password and use the salt from the database to compare the password. $entered_pass = generateHash($password,$userdetails["password"]); if($entered_pass != $userdetails["password"]) { //Again, we know the password is at fault here, but lets not give away the combination incase of someone bruteforcing $errors[] = lang("ACCOUNT_USER_OR_PASS_INVALID"); } else { //Passwords match! we're good to go' //Construct a new logged in user object //Transfer some db data to the session object $loggedInUser = new loggedInUser(); $loggedInUser->email = $userdetails["email"]; $loggedInUser->user_id = $userdetails["id"]; $loggedInUser->hash_pw = $userdetails["password"]; $loggedInUser->title = $userdetails["title"]; $loggedInUser->displayname = $userdetails["display_name"]; $loggedInUser->username = $userdetails["user_name"]; //Update last sign in $loggedInUser->updateLastSignIn(); $_SESSION["userCakeUser"] = $loggedInUser; //Redirect to user account page header("Location: index.php"); die(); } } } } } ?> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Login <b class="caret"></b></a> <ul class="dropdown-menu"> <form class="form-horizontal" id="loginForm" name="login" action="index.php" method="post"> <?php echo resultBlock($errors,$successes);?> <div class="control-group"> <label class="control-label" for="inputEmail">Email</label> <div class="controls"> <input type="text" id="inputEmail" name="username" placeholder="email"> </div> </div> <div class="control-group"> <label class="control-label" for="inputPassword">Password</label> <div class="controls"> <input type="password" id="inputPassword" name="password"> </div> </div> <p><input type="submit" value="Login" class="btn btn-primary"/> <a class="btn btn-link" href="register.php">Register</a></p> </form> </ul> </li> <?php } else {?> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown"><?php echo $loggedInUser->displayname; ?> <b class="caret"></b></a> <ul class="dropdown-menu"> <li><a href="account.php">Settings</a></li> <li><a href="logout.php">Logout</a></li> </ul> </li> <?php } ?> <li><a href="how-it-works.php">How It Works</a></li> <li><a href="about.php">About Us</a></li> <li><a href="contact.php">Contact Us</a></li> </ul> </div><!--/.nav-collapse --> </div> </div> </div>