Jump to content

PHP includes side menu help


wezze

Recommended Posts

Hi

im trying to get this into an include

<?php 
/*********************** MYACCOUNT MENU ****************************
This code shows my account menu only to logged in users. 
Copy this code till END and place it in a new html or php where
you want to show myaccount options. This is only visible to logged in users
*******************************************************************/
if (isset($_SESSION['user_id'])) {?>
<div class="myaccount">
  <p><strong>My Account</strong></p>
  [<a href="myaccount.php">My Account</a>]<br>
  [<a href="mysettings.php">Settings</a>]<br>
  [<a href="../filmen_leden.php">Filmen</a>]<br>
    [<a href="logout.php">Logout </a>]

  <p></p></div>
  <p> </p>
  <p> </p>
  <p> </p>
<?php }
if (checkAdmin()) {
/*******************************END**************************/
?>
      <p> [<a href="admin.php">Admin CP </a>]</p>
  <?php } ?>
	[<a href="../links.php">links</a>]<br>
        [<a href="../gastenboek/admin/index.php">Gastenboek</a>]<br>
        [<a href="../livre d'or/admin/index.php">livre d'or</a>]<br>
    [<a href="../upload_kalender/upload.form.php">upload kalender</a>]<br>
  
  </td>

 

but it doesnt show in my side menu this is the original code

 

<table width="100%" border="0" cellspacing="0" cellpadding="5" class="main">
  <tr> 
    <td colspan="3"> </td>
  </tr>
  <tr> 
    <td width="160" valign="top">
<?php 
/*********************** MYACCOUNT MENU ****************************
This code shows my account menu only to logged in users. 
Copy this code till END and place it in a new html or php where
you want to show myaccount options. This is only visible to logged in users
*******************************************************************/
if (isset($_SESSION['user_id'])) {?>
<div class="myaccount">
  <p><strong>My Account</strong></p>
  [<a href="myaccount.php">My Account</a>]<br>
  [<a href="mysettings.php">Settings</a>]<br>
  [<a href="../filmen_leden.php">Filmen</a>]<br>
    [<a href="logout.php">Logout </a>]

  <p></p></div>
  <p> </p>
  <p> </p>
  <p> </p>
<?php }
if (checkAdmin()) {
/*******************************END**************************/
?>
      <p> [<a href="admin.php">Admin CP </a>]</p>
  <?php } ?>
	[<a href="../links.php">links</a>]<br>
        [<a href="../gastenboek/admin/index.php">Gastenboek</a>]<br>
        [<a href="../livre d'or/admin/index.php">livre d'or</a>]<br>
    [<a href="../upload_kalender/upload.form.php">upload kalender</a>]<br>
  
  </td>
    <td width="732" valign="top"><p> </p>
      <h3 class="titlehdr">Welcome <?php echo $_SESSION['user_name'];?></h3>  
  <?php	
      if (isset($_GET['msg'])) {
  echo "<div class=\"error\">$_GET[msg]</div>";
  }
  	  
  ?>
      <p>This is the my account page</p>


      </td>
    <td width="196" valign="top"> </td>
  </tr>
  <tr> 
    <td colspan="3"> </td>
  </tr>
</table>

 

any ideas?

 

thx

Link to comment
Share on other sites

what do you mean with session[user_id] is not set?

<?php 
<?php if( isset($_SESSION['user_id'] ): ?>


  <p><strong>My Account</strong></p>
[<a href="myaccount.php">My Account</a>]<br>
[<a href="mysettings.php">Settings</a>]<br>
[<a href="../filmen_leden.php">Filmen</a>]<br>
  
  <p> </p>
    [<a href="logout.php">Logout </a>]

  
  <p> </p>
  <p> </p>
  <p> </p>
<?php endif; ?>

<?php if( checkAdmin ): ?>
      <p>[<a href="admin.php">Admin CP </a>]</p>

	[<a href="../links.php">links</a>]<br></li>
        [<a href="../gastenboek/admin/index.php">Gastenboek</a>]<br>
        [<a href="../livre d'or/admin/index.php">livre d'or</a>]<br>
    [<a href="../upload_kalender/upload.form.php">upload kalender</a>]<br>
<?php endif; ?>

is this what you mean with the conditionals and loops?

 

thx

Link to comment
Share on other sites

what do you mean with session[user_id] is not set?

Your condition checks to see if the $_SESSION key user_id is set, and if so, permits the output of that code.  If the code is not being output, it is because the isset failed.

 

is this what you mean with the conditionals and loops?

Yes it is.  Much easier to read, isn't it?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.