So, I had my PHP working earlier, but I was an idiot and changed something without knowing it. The thing is, I have and index.php file that has an include_header.php file included into it. In the include file, it gives three header options based on who the user it. That part it working fine. The problem is in the client header (which was working fine earlier). When it is not included in the index.php file, it works fine, but when it is with it, it doesn’t. This was working earlier, but I can’t figure out why. I never touched that client header file, and that’s the weird part.
Anyways, heres the codes:
The index.php:
<?php
session_start();
if(!$_SESSION['username2009']){
include ("http://www.essentialaudioinc.com/login");
exit();
}
include_once('include_header.php');
$username = "fghfgh";
$password = "fghfgh";
$database = "fghfgh";
$hostname = "dfghfgh";
//connection to the database
$handle = mysql_connect($hostname, $username, $password, $database)
or die("");
echo "";
//select a database to work with
$selected = mysql_select_db("fghfgh",$handle)
or die("Could not select fghfgh");
$variable = $_SESSION['username2009'];
$result = mysql_query("SELECT * FROM users WHERE username = '$variable'")
or die(mysql_error());
//Take the data from the SQL query and put it into seperate
//variables
$rows = mysql_fetch_array($result);
$salesperson = $rows['salesperson'];
$client = $rows['client'];
$project = $rows['project'];
$projecttype = $rows['projecttype'];
$type = $rows['type'];
$address = $rows['address'];
$city = $rows['city'];
$state = $rows['state'];
$zip = $rows['zip'];
$contactname1 = $rows['contactname1'];
$contactphone1 = $rows['contactphone1'];
$contactemail1 = $rows['contactemail1'];
$contactname2 = $rows['contactname2'];
$contactphone2 = $rows['contactphone2'];
$contactemail2 = $rows['contactemail2'];
$status = $rows['status'];
$stage = $rows['stage'];
?>
The include_header.php:
<?php
session_start();
$username = "ghjghj";
$password = "ghjghj";
$database = "ghjghj";
$hostname = "ghjghj";
//connection to the database
$handle = mysql_connect($hostname, $username, $password, $database)
or die("");
echo "";
//select a database to work with
$selected = mysql_select_db("fghfgh",$handle)
or die("Could not select ghjghj");
$variable = $_SESSION['username2009'];
$result = mysql_query("SELECT is_admin FROM users WHERE username = '$variable'")
or die(mysql_error());
$data = mysql_fetch_array($result, MYSQL_BOTH);
if ( $data['is_admin'] == 0 ) {
include_once('header.php');
echo $data['is_admin'];
}
else if ( $data['is_admin'] == 1) {
include_once('header_admin.php');
}
else if ( $data['is_admin'] == 2) {
include_once('http://www.essentialaudioinc.com/admin/client_header.php?username={$variable}');
}
?>
and the client_header.php:
<?php
session_start();
$username = "gfhfgh";
$password = "fghfgh";
$database = "dfghfgh";
$hostname = "fghfgh";
//connection to the database
$handle = mysql_connect($hostname, $username, $password, $database)
or die("");
echo "";
//select a database to work with
$selected = mysql_select_db("fghfgh",$handle)
or die("Could not select fghfgh");
$variable = $_SESSION['username2009'];
$result = mysql_query("SELECT stage FROM users WHERE username = '$variable'")
or die(mysql_error());
$data = mysql_fetch_array( $result, MYSQL_BOTH);
if ( $data['stage'] == 0 ) {
echo '<img src="http://www.essentialaudioinc.com/stages/1.jpg">';
}
else if ( $data['stage'] == 1) {
echo '<img src="http://www.essentialaudioinc.com/stages/1.jpg">';
}
else if ( $data['stage'] == 2) {
echo '<img src="http://www.essentialaudioinc.com/stages/2.jpg">';
}
else if ( $data['stage'] == 3) {
echo '<img src="http://www.essentialaudioinc.com/stages/3.jpg">';
}
else if ( $data['stage'] == 4) {
echo '<img src="http://www.essentialaudioinc.com/stages/4.jpg">';
}
else if ( $data['stage'] == 5) {
echo '<img src="http://www.essentialaudioinc.com/stages/5.jpg">';
}
else if ( $data['stage'] == 6) {
echo '<img src="http://www.essentialaudioinc.com/stages/6.jpg">';
}
else if ( $data['stage'] == 7) {
echo '<img src="http://www.essentialaudioinc.com/stages/7.jpg">';
}
?>