-
Notifications
You must be signed in to change notification settings - Fork 0
/
Header.php
58 lines (54 loc) · 3.62 KB
/
Header.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php session_start();
if (!isset($_SESSION['type'])){
$_SESSION['type'] = "g";
//g=guest a=admin c=customer e=employee
}
//setcookie(name, value, expire, path, domain);
//setcookie("user", "Jake", time()+3600);
?>
<html>
<meta charset="UTF-8">
<head>
<link href="coolstyle.css" type="text/css" rel="stylesheet">
</head>
<p>
<?php
$logtext = $_SESSION['type'] . ': ' . $_SESSION['name'];
if ($_SERVER['REQUEST_URI'] == "/CarRental/profile.php"){
if ($_SESSION['type'] == 'E'){
echo '<div align="right"><a class=loginbutton style="margin-right:10px" href="employeeOptions.php">Employee functions</a><a onmouseover="this.innerHTML=\'Log out\'" onmouseout="this.innerHTML=\''.$logtext.'\'" href="logout.php" class="loginButton">' . $logtext . '</a></div>'; //login button that changes to 'logout' when you hover over it (only when logged in)
}
elseif ($_SESSION['type'] == 'A'){
echo '<div align="right"><a class=loginbutton style="margin-right:10px" href="adminOptions.php">Admin functions</a><a onmouseover="this.innerHTML=\'Log out\'" onmouseout="this.innerHTML=\''.$logtext.'\'" href="logout.php" class="loginButton">' . $logtext . '</a></div>'; //login button that changes to 'logout' when you hover over it (only when logged in)
}
else {
echo '<div align="right"><a onmouseover="this.innerHTML=\'Log out\'" onmouseout="this.innerHTML=\''.$logtext.'\'" href="logout.php" class="loginButton">' . $logtext . '</a></div>';
}
}
elseif ($_SESSION['type'] == 'C'){
echo '<div align="right"><a onmouseover="this.innerHTML=\'View Profile\'" onmouseout="this.innerHTML=\''.$logtext.'\'" href="profile.php" class="loginButton">' . $logtext . '</a></div>'; //login button that changes to 'logout' when you hover over it (only when logged in)
}
elseif ($_SESSION['type'] == 'E'){
echo '<div align="right"><a class=loginbutton style="margin-right:10px" href="employeeOptions.php">Employee functions</a><a onmouseover="this.innerHTML=\'View Profile\'" onmouseout="this.innerHTML=\''.$logtext.'\'" href="profile.php" class="loginButton">' . $logtext . '</a></div>'; //login button that changes to 'logout' when you hover over it (only when logged in)
}
elseif ($_SESSION['type'] == 'A'){
echo '<div align="right"><a class=loginbutton style="margin-right:10px" href="adminOptions.php">Admin functions</a><a onmouseover="this.innerHTML=\'View Profile\'" onmouseout="this.innerHTML=\''.$logtext.'\'" href="profile.php" class="loginButton">' . $logtext . '</a></div>'; //login button that changes to 'logout' when you hover over it (only when logged in)
}
else {
echo '<div align="right"><a href="login.php" class="loginButton">Log in</a></div>';
}?>
<div align="left"><a href="/CarRental/index.php"><img src="logo.png" height="90"></a></div>
</p>
<div align="center">
<a href="cars.php" class="titleButton">Rent</a>
<a href="rates.php" class="titleButton">Rates</a>
<a href="location.php" class="titleButton">Locations</a>
<a href="AboutUs.php" class="titleButton">About Us</a>
</div>
<body>
<?php
$con=mysqli_connect("localhost","root","root","rent_a_car");
if (mysqli_connect_errno($con))
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}