Please log in to access this page.

'; exit(); } else { echo('

You are logged in as ' . $_SESSION['username'] . '. Log out.

'); } // Connect to the database $dbc = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD) or die ('Error connecting to MySQL Server.'); $db = mysql_select_db(DB_NAME, $dbc); // Grab the profile data from the database if (!isset($_GET['user_id'])) { $query = "SELECT first_name, last_name, company, address_1, address_2, city, state, zip_code, bs_phone, email FROM users WHERE user_id = '" . $_SESSION['user_id'] . "'"; } else { $query = "SELECT first_name, last_name, company, address_1, address_2, city, state, zip_code, bs_phone, email FROM users WHERE user_id = '" . $_SESSION['user_id'] . "'"; } $data = mysql_query($query, $dbc); if (mysql_num_rows($data) == 1) { // The user row was found so display the user data $row = mysql_fetch_array($data); echo ''; if (!empty($row['username'])) { echo ''; } if (!empty($row['first_name'])) { echo ''; } if (!empty($row['last_name'])) { echo ''; } if (!empty($row['address_1'])) { echo ''; } if (!empty($row['address_2'])) { echo ''; } if (!empty($row['city'])) { echo ''; } if (!empty($row['state'])) { echo ''; } if (!empty($row['zip_code'])) { echo ''; } if (!empty($row['bs_phone'])) { echo ''; } if (!empty($row['email'])) { echo ''; } echo '
Username:' . $row['username'] . '
First name:' . $row['first_name'] . '
Last name:' . $row['last_name'] . '
Address 1:' . $row['address_1'] . '
Address 2:' . $row['address_2'] . '
City:' . $row['city'] . '
State:' . $row['state'] . '
Zip Code:' . $row['zip_code'] . '
Bs. Phone:' . $row['bs_phone'] . '
Email:' . $row['email'] . '
'; // if (!isset($_GET['user_id']) || ($_SESSION['user_id'] == $_GET['user_id'])) { // echo '

Would you like to edit your //profile?

'; // echo '

Would you like to return to Home //Page?

'; // } } // End of check for a single row of user results else { echo '

There was a problem accessing your profile.

'; } mysql_close($dbc); ?>