For the site i am creating, i've created a file called 'auth.php' which i include at the start of my scripts to prevent unauthorised access to certain pages.<br>
But i find that on one of the pages, it seems to stop one of the images at the side of the template from appearing!<br>
Cheers, as you might notice, i've set the script to draw all of the releveant html should the user be logged in [this includes all of the text, the orange buttons at the top, and the links e.g. 01, 02, 03 etc].
but i dont think theres anything in there about the picture on the right
could you please post your entire code, or at least the code of the auth.php page. There's no problem with the echo of the html, so i can't help you atm
if you only want to show parts when the user is logged in, you should copy that part, and past it in the auth.php page where it says that you're logged in. like this:
PHP Code:
<?php session_start();
if (!isset($_SESSION["username"])) { echo "<h1>You must be logged in to view this page</h1>"; exit; }else{ // viewable when logged in content here ?>
ahhh i realised it might be easier for me to just make a page telling the user to log in, and have auth.php have a header re-direct thingy that sends the user to it if theyre not logged in.
although i cant really figure out how to do the code properly, at the moment i have something like this:
but it doesnt seem to work because it comes up with an error saying that the headers have already been sent. although i dont have any html on auth.php so i cant figure out why it doesnt work?
Could you not as a easy fix tweak the could in the middle of the file to
PHP Code:
<div align="center">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<?php
if (!isset($_SESSION["username"])) {
echo "<h1>You must be logged in to view this page</h1>";
} else {
echo <<< loggedin
<tr>
<td width="55%" valign="top"><h1 align="left">Members home </h1>
<p align="left">Hi
<?php
echo "<b>".$_SESSION["username"]."</b>";
?>
, use the links above to navigate through the members area. Here you can:</p>
<p align="left">-Edit your profile<br />
-Make your skate crew recognised or join an existing one<br />
-View all of the <span class="logodark">Roll</span><span class="logolight">North</span> community!</p></td>
<td width="45%" valign="top"><div align="right"><a href="members_view_profile.php"><img src="Images/01.gif" width="200" height="23" border="0" /></a><br />
<img src="Images/02.gif" width="200" height="22" /><br />
<a href="members_pic_upload.html"><img src="Images/03.gif" width="200" height="26" border="0" /></a><br />
</div></td>
</tr>
loggedin;
}
?>
</table>
</div>
Sorry not very pretty as I've scrapped it out of your post