Log in status...looking for best solution

Discussion in 'Customization & add-ons' started by jechilt, Jul 18, 2007.

  1. jechilt

    jechilt New Member

    Joined:
    Jul 16, 2007
    Messages:
    22
    Greetings,

    I am new to aMember. I built my site header file in php. I want to use the same header file within the aMember system but am stuck because of how php is called. Within aMember, to call php, we use {php}. There is no problem calling another php file but the called file does not properly parse the php files within the aMember system.
    I am wondering if I can create a function withing site.inc.php to call the php files I created that will properly parse my files.
    If not, I may have to create the header 2 times. For every header update, I have to update 2 locations...not something I want to do.

    Scenario:
    On the main web page, I run several include files to ease management of the site.
    File 1: check_login.php
    PHP:
    <?php
    session_start
    ();
    if (
    $au=$_SESSION['_amember_user']){ // user is logged-in 
        
    $user 1;
    } else { 
    // user is not logged-in 
        
    $user 0;

    ?>
    File 2: header.php (uses variable $user from file 1)
    This creates a nice little box on the top of the page that provides the login status and ability to subscribe or go to the member area if logged in.
    PHP:
    <?php include("check_login.php");?>
    <div id="top" style="width:800;height:80;" align="center">
    <table height="80px" width="800" border="0" align="center" cellpadding="0" cellspacing="0" id="header-table">
        <tr>
            <td width="400" id="logo-area"><a href="index.php"><img src="images/Logo.GIF" width="326" height="80" border="0"></a></td>
            <td width="400" align="right" id="dashboard-area">
                <!-- ### Dashboard ### -->
                <table border="0" cellspacing="0" cellpadding="0" class="dashboard-off">
                    <tr class="heading">
                        <td class="user" colspan="2">
                            <?php 
                            
    if($user==1) {
                                echo 
    "<img src='images/_loginY.gif'> Welcome $au[name_f]";
                                }else{
                                echo 
    "<img src='images/_loginN.gif'> Welcome Visitor!";
                            } 
    ?>
                        </td>
                    </tr>
                    <tr class="main">
                        <td align="left">
                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                <tr valign="middle">
                                    <td height="30" align="center" valign="middle" nowrap="nowrap">
                                        <?php if($user==1) { ?>
                                            <a onClick="javascript:location.href='logout.php';" style="cursor:pointer;"><img src='images/_padlock.gif' width="16" height="16"> Log Out</a>
                                        <?php }else{ ?>
                                            <a onClick="javascript:location.href='member.php';" style="cursor:pointer;"><img src='images/_key.gif' width="16" height="16"> Login</a>
                                        <?php ?>                                            </td>
                                    <td height="30" align="center" valign="middle" nowrap="nowrap">
                                        <?php if($user==1) { ?>
                                            <a onClick="javascript:location.href='member.php';" style="cursor:pointer;">Go to Member Area</a>
                                        <?php }else{ ?>
                                            <a onClick="javascript:location.href=signup.php';" style="cursor:pointer;"><img srcimages/_createnew.gif" width="20" height="20" border="0"> Subscribe </a>
                                        <?php ?>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
    </div>
    Any ideas on how to get this file to parse properly in the aMember system or do I have to recreate for the aMember system?

    thanks!
    John
  2. jechilt

    jechilt New Member

    Joined:
    Jul 16, 2007
    Messages:
    22
    Resolved

    We opted to have 2 header files. One for the aMember system and the other for the main site.

Share This Page