Current location: Hot Scripts Forums » Programming Languages » PHP » PHP interfering with Dreamweaver templates?


PHP interfering with Dreamweaver templates?

Reply
  #1 (permalink)  
Old 02-26-07, 04:45 PM
kkillgasmm kkillgasmm is offline
Newbie Coder
 
Join Date: Feb 2007
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Question PHP interfering with Dreamweaver templates?

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>

Here are a couple of screenshots to explain...

http://pic4.picturetrail.com/VOL749/.../233647768.jpg

http://pic4.picturetrail.com/VOL749/.../233647767.jpg

the bottom shows how the image at the side has dissappeared when the user isnt logged in [however the orange buttons are meant to dissapear].

Does anyone know why it might do this?? It doesnt seem to happen on any other pages
Reply With Quote
  #2 (permalink)  
Old 02-26-07, 04:52 PM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
would you mind posting your code. There can be thousands of reasons why this isn't working
Reply With Quote
  #3 (permalink)  
Old 02-27-07, 01:31 AM
kkillgasmm kkillgasmm is offline
Newbie Coder
 
Join Date: Feb 2007
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
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

Code:
<?php
						include "auth.php";
							echo '<table width="100%" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                      <td><table width="400" border="0" align="right" cellpadding="0" cellspacing="0">
                          <!-- fwtable fwsrc="members_draft.png" fwbase="members_home.gif" fwstyle="Dreamweaver" fwdocid = "965887728" fwnested="0" -->
                          <tr>
                            <td><img src="Templates/Images/spacer.gif" alt="" name="undefined_2" width="100" height="1" border="0" id="undefined_2" /></td>
                            <td><img src="Templates/Images/spacer.gif" alt="" name="undefined_2" width="100" height="1" border="0" id="undefined_2" /></td>
                            <td><img src="Templates/Images/spacer.gif" alt="" name="undefined_2" width="100" height="1" border="0" id="undefined_2" /></td>
                            <td><img src="Templates/Images/spacer.gif" alt="" name="undefined_2" width="100" height="1" border="0" id="undefined_2" /></td>
                            <td><img src="Templates/Images/spacer.gif" alt="" name="undefined_2" width="1" height="1" border="0" id="undefined_2" /></td>
                          </tr>
                          <tr>
                            <td><a href="members_home.php"><img name="home" src="Images/home.gif" width="100" height="20" border="0" id="home" alt="" /></a></td>
                            <td><a href="members_view.php"><img name="view" src="Images/view.gif" width="100" height="20" border="0" id="view" alt="" /></a></td>
                            <td><img name="crews" src="Images/crews.gif" width="100" height="20" border="0" id="crews" alt="" /></td>
                            <td><a href="register.htm"><img name="sign" src="Images/sign.gif" width="100" height="20" border="0" id="sign" alt="" /></a></td>
                            <td><img src="Templates/Images/spacer.gif" alt="" name="undefined_2" width="1" height="20" border="0" id="undefined_2" /></td>
                          </tr>
                      </table></td>
                    </tr>
                  </table><p>';
?>
Reply With Quote
  #4 (permalink)  
Old 02-27-07, 02:09 AM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
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

UnrealEd
Reply With Quote
  #5 (permalink)  
Old 02-27-07, 06:33 AM
kkillgasmm kkillgasmm is offline
Newbie Coder
 
Join Date: Feb 2007
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
ahhhh ok! there is quite a lot though so finding the problem might be a little tough:

members_home.php:
Code:
<?php session_start();?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/home.dwt" codeOutsideHTMLIsLocked="false" -->
<head>


<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>RollNorth: Strengthening the northern inline scene</title>
<!-- InstanceEndEditable -->
<link href="Templates/CSS/styles.css" rel="stylesheet" type="text/css" />
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
<link href="CSS/styles.css" rel="stylesheet" type="text/css" />
</head>

<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr></tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="99%" background="Images/banner_bg.gif">&nbsp;</td>
        <td width="1%"><div align="right"><img src="Images/banner.gif" width="780" height="128" /></div></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="1%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="5">
          <tr>
            <td><p>&nbsp;
              </p>
              <p>
                <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="181" height="296" title="nav">
                  <param name="movie" value="Flash/nav.swf" />
                  <param name="quality" value="high" />
                  <embed src="Flash/nav.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="181" height="296"></embed>
                </object>
                </p></td>
          </tr>
        </table></td>
        <td width="99%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="5">
          <tr>
            <td><a href="login.htm">Login</a> | <a href="register.htm">Register</a> | <a href="help.html">Help out</a> | <a href="advertising.html">Advertising</a> | <a href="contact.html">Contact us</a></td>
          </tr>
          <tr>
            <td><!-- InstanceBeginEditable name="content" -->
              <table width="100%" border="0" cellspacing="0" cellpadding="0">
                
                <tr>
                  <td><?php
						include "auth.php";
							echo '<table width="100%" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                      <td><table width="400" border="0" align="right" cellpadding="0" cellspacing="0">
                          <!-- fwtable fwsrc="members_draft.png" fwbase="members_home.gif" fwstyle="Dreamweaver" fwdocid = "965887728" fwnested="0" -->
                          <tr>
                            <td><img src="Templates/Images/spacer.gif" alt="" name="undefined_2" width="100" height="1" border="0" id="undefined_2" /></td>
                            <td><img src="Templates/Images/spacer.gif" alt="" name="undefined_2" width="100" height="1" border="0" id="undefined_2" /></td>
                            <td><img src="Templates/Images/spacer.gif" alt="" name="undefined_2" width="100" height="1" border="0" id="undefined_2" /></td>
                            <td><img src="Templates/Images/spacer.gif" alt="" name="undefined_2" width="100" height="1" border="0" id="undefined_2" /></td>
                            <td><img src="Templates/Images/spacer.gif" alt="" name="undefined_2" width="1" height="1" border="0" id="undefined_2" /></td>
                          </tr>
                          <tr>
                            <td><a href="members_home.php"><img name="home" src="Images/home.gif" width="100" height="20" border="0" id="home" alt="" /></a></td>
                            <td><a href="members_view.php"><img name="view" src="Images/view.gif" width="100" height="20" border="0" id="view" alt="" /></a></td>
                            <td><img name="crews" src="Images/crews.gif" width="100" height="20" border="0" id="crews" alt="" /></td>
                            <td><a href="register.htm"><img name="sign" src="Images/sign.gif" width="100" height="20" border="0" id="sign" alt="" /></a></td>
                            <td><img src="Templates/Images/spacer.gif" alt="" name="undefined_2" width="1" height="20" border="0" id="undefined_2" /></td>
                          </tr>
                      </table></td>
                    </tr>
                  </table><p>';
?>
                    <div align="center">
                        <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                          <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>
                        </table>
                      </div></td>
                </tr>
              </table>
            <!-- InstanceEndEditable --></td>
          </tr>
        </table></td>
        <td width="1%" valign="top"><div align="right">
          <p><img src="Images/deco_pic.gif" alt="deco" width="130" height="45" /><br />
                  <img src="Images/pics_home.gif" alt="home" width="100" height="172" /></p>
          </div></td>
      </tr>
      <tr>
        <td colspan="3" valign="top"><table width="100%" border="0" cellspacing="5" cellpadding="0">
          <tr>
            <td width="163"><img src="Images/deco_bar_top_l1.gif" width="163" height="30" /></td>
            <td width="10" background="Images/deco_bg.gif">&nbsp;</td>
            <td width="27"><img src="Images/deco_bar_top_l2.gif" width="27" height="30" /></td>
            <td background="Images/deco_bg.gif">&nbsp;</td>
            <td width="27"><img src="Images/deco_bar_top_r2.gif" width="27" height="30" /></td>
            <td width="10" background="Images/deco_bg.gif">&nbsp;</td>
            <td width="163"><img src="Images/deco_bar_top_r1.gif" width="163" height="30" /></td>
          </tr>
        </table>
              <table width="60%" border="0" align="center" cellpadding="0" cellspacing="5">
                <tr>
                  <td width="1%"><div align="left"><img src="Images/deco_bar_top_l3.gif" width="163" height="20" /></div></td>
                  <td width="98%" background="Images/deco_bg.gif">&nbsp;</td>
                  <td width="1%"><div align="right"><img src="Images/deco_bar_top_r3.gif" width="163" height="20" /></div></td>
                </tr>
              </table>
          <br />
              <table width="100%" border="0" cellspacing="2" cellpadding="0">
                <tr>
                  <td width="40%" background="Images/deco_bg.gif">&nbsp;</td>
                  <td width="300"><div align="center"><span class="logodark">Roll</span><span class="logolight">North</span> 2007 </div></td>
                  <td width="40%" background="Images/deco_bg.gif">&nbsp;</td>
                </tr>
            </table></td>
      </tr>
    </table></td>
  </tr>
</table>
</body>
<!-- InstanceEnd --></html>
auth.php:
PHP Code:

<?php
session_start
();

if (!isset(
$_SESSION["username"]))
    {
        echo 
"<h1>You must be logged in to view this page</h1>";
        exit;
    }
?>
thanks again

Last edited by UnrealEd; 02-27-07 at 07:36 AM. Reason: please use [php] wrappers when posting php code
Reply With Quote
  #6 (permalink)  
Old 02-27-07, 06:57 AM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
you see the "exit;"
this tells php to stop parsing the rest of the page, including the images.

If you remove the "exit;", it will work

UnrealEd
Reply With Quote
  #7 (permalink)  
Old 02-27-07, 07:05 AM
kkillgasmm kkillgasmm is offline
Newbie Coder
 
Join Date: Feb 2007
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Hmmm I've just tried but then it allows all of the conent that should be blocked to those who arent logged in.

any ideas? should i try placing the 'exit' part somewhere else ?
Reply With Quote
  #8 (permalink)  
Old 02-27-07, 07:35 AM
UnrealEd's Avatar
UnrealEd UnrealEd is offline
Community Liaison
 
Join Date: May 2005
Location: Antwerp, Belgium
Posts: 3,165
Thanks: 4
Thanked 25 Times in 25 Posts
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
?>
Reply With Quote
  #9 (permalink)  
Old 02-27-07, 04:31 PM
kkillgasmm kkillgasmm is offline
Newbie Coder
 
Join Date: Feb 2007
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
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:

Code:
<?php session_start();
header('location: redir.html'); ?>
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?
Reply With Quote
  #10 (permalink)  
Old 02-27-07, 06:35 PM
daveganley daveganley is offline
Newbie Coder
 
Join Date: Jun 2003
Location: London UK
Posts: 99
Thanks: 0
Thanked 0 Times in 0 Posts
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
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP Include not working in some of my templates Tomi PHP 11 01-16-07 03:48 AM
PHP Programmer Needed for my free web templates project zanary Job Offers & Assistance 16 08-07-06 02:18 PM
PHP multi-dimensional array sorting issue aqw PHP 2 06-24-05 11:09 PM
PHP / Graphic Developers someotherguy582 Job Offers & Assistance 1 06-05-05 07:40 PM
Question about dreamweaver and php? chinablack1480 PHP 0 12-07-03 10:16 PM


All times are GMT -5. The time now is 05:57 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.