Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Display log out link if user is logged in.


Guest

Recommended Posts

How would I display log out link if user is logged in.

 

Here is the code, Just need to check if user is logged in.

 

<?php echo ' <a href="' . tep_href_link(FILENAME_LOGOFF, '', 'SSL') . '">' . MY_ACCOUNT_LOGOFF . '</a>'; ?>

 

Thanks

 

Link to comment
Share on other sites

<?php
 if ( tep_session_is_registered('customer_id') ) {
echo ' <a href="' . tep_href_link(FILENAME_LOGOFF, '', 'SSL') . '">' . MY_ACCOUNT_LOGOFF . '</a>';
 }
?>

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Thanks Jim.

 

I searched the forum and didn't find anything. Then decide to Google it and found it a few pages down.

 

I ended up with what you have.

 

<?php if (tep_session_is_registered('customer_id')) {

echo ' <a href="' . tep_href_link(FILENAME_LOGOFF, '', 'SSL') . '">Log out</a>';

    } 

    else 

   {
}
?>

Thanks,

Link to comment
Share on other sites

OK it couldn't be that easy.

 

Now how can i add this to the information box.

 

This doesn't work.

 

<!-- information //-->
         <tr>
           <td>
<?php
 $info_box_contents = array();
 $info_box_contents[] = array('text' => BOX_HEADING_INFORMATION);

 new infoBoxHeading($info_box_contents, false, false);

 $info_box_contents = array();
 $info_box_contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_SHIPPING) . '">' . BOX_INFORMATION_SHIPPING . '</a><br>' .
                                        '<a href="' . tep_href_link(FILENAME_PRIVACY) . '">' . BOX_INFORMATION_PRIVACY . '</a><br>' .
                                        '<a href="' . tep_href_link(FILENAME_FEATURED_PRODUCTS) . '">' . BOX_CATALOG_FEATURED_PRODUCTS . '</a><br>' .
                                        '<a href="' . tep_href_link(FILENAME_CONDITIONS) . '">' . BOX_INFORMATION_CONDITIONS . '</a><br>' .
if (tep_session_is_registered('customer_id')) {

                                echo ' <a href="' . tep_href_link(FILENAME_LOGOFF, '', 'SSL') . '">Log out</a>';

                              }

                            ?>

<?php

 new infoBox($info_box_contents);
?>


           </td>
         </tr>
<!-- information_eof //-->

 

Thanks

Link to comment
Share on other sites

<!-- information //-->
 <tr>
   <td>
<?php
 $info_box_contents = array();
 $info_box_contents[] = array('text' => BOX_HEADING_INFORMATION);

 new infoBoxHeading($info_box_contents, false, false);
 $info_box_contents = array();
 if ( tep_session_is_registered('customer_id') ) {
   $info_box_contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_SHIPPING) . '">' . BOX_INFORMATION_SHIPPING . '</a><br>' .
                                                              '<a href="' . tep_href_link(FILENAME_PRIVACY) . '">' . BOX_INFORMATION_PRIVACY . '</a><br>' .
                                                              '<a href="' . tep_href_link(FILENAME_FEATURED_PRODUCTS) . '">' . BOX_CATALOG_FEATURED_PRODUCTS . '</a><br>' .
                                                              '<a href="' . tep_href_link(FILENAME_CONDITIONS) . '">' . BOX_INFORMATION_CONDITIONS . '</a><br>' .
                                                              '<a href="' . tep_href_link(FILENAME_LOGOFF, '', 'SSL') . '">Log out</a>');
 } else {
   $info_box_contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_SHIPPING) . '">' . BOX_INFORMATION_SHIPPING . '</a><br>' .
                                                              '<a href="' . tep_href_link(FILENAME_PRIVACY) . '">' . BOX_INFORMATION_PRIVACY . '</a><br>' .
                                                              '<a href="' . tep_href_link(FILENAME_FEATURED_PRODUCTS) . '">' . BOX_CATALOG_FEATURED_PRODUCTS . '</a><br>' .
                                                              '<a href="' . tep_href_link(FILENAME_CONDITIONS) . '">' . BOX_INFORMATION_CONDITIONS . '</a>');
 }
 new infoBox($info_box_contents);
?>
   </td>
 </tr>
<!-- information_eof //-->

Backup the file before editing.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

<?php
 if ( tep_session_is_registered('customer_id') ) {
echo '<a href="' . tep_href_link(FILENAME_LOGOFF, '', 'SSL') . '">Logoff</a>';
 }
?>

There's the code.

 

Put it where you want it.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

<?php
 if ( tep_session_is_registered('customer_id') ) {
echo '<a href="' . tep_href_link(FILENAME_LOGOFF, '', 'SSL') . '">Logoff</a>';
 }
?>

There's the code.

 

Put it where you want it.

 

i can put it in the index.php anywhere?

Link to comment
Share on other sites

Anywhere outside existing PHP tags.

 

If you want it inside existing tags remove the opening and closing PHP tags.

 

Backup any file before making any edits.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

<?php
 if ( tep_session_is_registered('customer_id') ) {
echo '<div align="left"><a style="font:verdana;" href="' . tep_href_link(FILENAME_LOGOFF, '', 'SSL') . '">Logoff</a></div>';
 }
?>

Change the font name to one of your choosing.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

<?php
 if ( tep_session_is_registered('customer_id') ) {
echo '<div align="left"><a style="font:verdana;" href="' . tep_href_link(FILENAME_LOGOFF, '', 'SSL') . '">Logoff</a></div>';
 }
?>

Change the font name to one of your choosing.

 

when i use left or right it gets exactly to the edge. What code should i use to make it displayed exactly under the shopping cart? thanks once again. also changing the font to "arial" is not making any changes :S

Link to comment
Share on other sites

Learn HTML

 

I can't answer your questions without seeing your site.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Post the code from this file:

 

/includes/boxes/information.php

 

At least I think that's where you'll find it.

 

It has all the other links in it too (Shipping & Returns, Privacy Notice, Conditions of Use, Contact Us)

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

I managed to make it out :) but now a new error arised which 'corrupted' all the others:

 

Not Found

 

The requested URL /home/FILENAME_YURA_INFO was not found on this server.

 

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Link to comment
Share on other sites

I saw that in the HTML source.

 

You're missing the define for that in /includes/filenames.php

 

And I haven't a clue what it's supposed to be..

:huh:

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

i'm using this code to show log out like the others but how can i add the if statement to detect whether the customer is logged in?

 

 

<td><a href=""' . tep_href_link(FILENAME_LOGOFF, '', 'SSL') . '" class="iinfo">' . HEADER_TITLE_LOGOFF. '</a><br></td>
}

Link to comment
Share on other sites

<?php
 if ( tep_session_is_registered('customer_id') ) {
?>
<td><a href=""' . tep_href_link(FILENAME_LOGOFF, '', 'SSL') . '" class="iinfo">' . HEADER_TITLE_LOGOFF. '</a><br></td>
<?php
 }
?>

Now give it a break for a while will ya?

<_<

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Sorry to get back to the forums asking :( :blush:

 

I have this code which displays log in and log out at the same time. I would like to add that if statement you kindly suggested so that log in is displayed when user is not logged in (and so log out does not appear when log in appears), and log out appears when log in doesn't appear because user is logged. Any help please?

 

																								<tr align="left" valign="middle" style="background-image:url(images/line222.jpg); background-position:bottom; background-repeat:repeat-x ">
																							<td width="26" height="26" class="ST3"><img src="images/marker400.jpg" style="margin-left:10px"></td>
																							<td><a href=""' . tep_href_link(FILENAME_LOGOFF) . '" class="iinfo">' . HEADER_TITLE_LOGOFF. '</a><br></td>


																							<tr align="left" valign="middle" style="background-image:url(images/line222.jpg); background-position:bottom; background-repeat:repeat-x ">
																							<td width="26" height="26" class="ST3"><img src="images/marker400.jpg" style="margin-left:10px"></td>
																							<td><a href=""' . tep_href_link(FILENAME_LOGIN, '', 'SSL') . '" class="iinfo">' . HEADER_TITLE_LOGIN. '</a><br></td>

Link to comment
Share on other sites

Manage to do it :) would like to share to code for those who would like to show log in when user is not logged in and show log out when user is in

<?php
 if ( tep_session_is_registered('customer_id') ) {
echo ' <tr align="left" valign="middle" style="background-image:url(images/line222.jpg); background-position:bottom; background-repeat:repeat-x ">
											<td width="26" height="26" class="ST3"><img src="images/marker400.jpg" style="margin-left:10px"></td>
											<td><a href="' . tep_href_link(FILENAME_LOGOFF) . '" class="iinfo">' . HEADER_TITLE_LOGOFF. '</a><br></td> </tr>';
 }
else {
echo ' <tr align="left" valign="middle" style="background-image:url(images/line222.jpg); background-position:bottom; background-repeat:repeat-x ">
											<td width="26" height="26" class="ST3"><img src="images/marker400.jpg" style="margin-left:10px"></td>
											<td><a href="' . tep_href_link(FILENAME_LOGIN) . '" class="iinfo">' . HEADER_TITLE_LOGIN. '</a><br></td> </tr>';
}
?>

Link to comment
Share on other sites

  • 5 weeks later...

PLEASE PLEASE PLEASE HELP!

I have added the code to just about every single Index.php file on the site and still can not get a log out !

I am trying to run some tests but can't switch between accounts to test the Domestic & Int'l shipping because I can't get logged out of the Int'l account I was testing first :huh:

 

I have been researching this site all day and now into evening, you posts seem like they are what I'm looking for but can someone PLEASE post the EXACT location of the file and the EXACT place to put the code if I want the Log Out option ANYWHERE in the top part of the page?

 

Here is my site :

http://www.NothingButRomance.com

 

 

Please oh please help someone asap before I start ripping my hair out or go back to smoking (been 20 yrs!) !!!!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...