Hello, I'm having a totally brain freeze on how to do something that I believe is relatively simple but I'm having such a stupid moment that I don't even know what to google at the moment.
What I'm creating is a book catalogue for a school project.
It opens to a start page and I was thinking of using some default username to allow access to the database.
What I need is for this default username to be overwritten if a person logs in.
ie: I'm at the search page, I hit the login and get redirected to my control panel. The control panel has a link back to the search page.
The search pages allows access to the database with a default user that had limited privileges. If a person has logged in I need it to change these variables to whatever they are currently logged in as and change the 'login' button to 'logout'. And I'm entirely blanking on how to do this, I can't even form a simple sentence to search in google... It's rather early I think my brain is still asleep.
Anyway thanks for the help. Sorry if its incoherent.
Oh code would probably be nice, I know it doesn't work this way since I have the values hard coded. Like I said, brain freeze.
<?php
include 'C:\wamp\www\Catalogue\html\Search.html';
ini_set('session.cache_limiter','private');
session_start();
$_SESSION['username']="default";
$_SESSION['password']="password";
$_SESSION['hostname']="localhost";
$_SESSION['db']="bookcatalogue";
@mysql_connect($_SESSION['hostname'],$_SESSION['username'],$_SESSION['password']) or die("Access to db server denied");
@mysql_select_db($_SESSION['db']) or die("Access to library denied");
$username = $_SESSION['username'];
if($username == "admin"){
echo "<div class=\"menubar\"><a href = \"http://localhost/logout.html\"></div>";
}
else{
echo "<div class=\"menubar\"><input type='button' name='Login' value='login' onclick= \"javascript:toggleLayer('loginBox');\"></div> ";
}
?>