Jump to content

[SOLVED] login & nav functions not working


envexlabs

Recommended Posts

Hey,

 

in my index.php i have included a functions.php file.

 

my index.php has:

 

<?php 

display_login();

display_nav(); 

?>

 

the functions in functions.php

 

function display_login(){

echo('<div id="login" style="display: none;">
<form method="post" action="../amember/login.php">
<p>User Name: <input class="login" type="text" name="amember_login" />
Password: <input class="login" type="password" name="amember_pass" />
<input type="image" style="height: 38px; width: 38px; vertical-align: bottom;" src="images/go.gif" alt="go" title="Go!" />
<input type="checkbox" name="remember_login" value="1">
<span class="small">Remember me</span></p>
</form>
</div> <!-- login div -->
                             
<div id="welcome">');
                
if ($au=$_SESSION['_amember_user']){ // user is logged-in
    print "<p>Hello $au[name_f] $au[name_l]!</p><br>";
    print "<a href='../amember/logout.php'>Logout</a>";
} 
else { // user is not logged-in
    print '<p>Hello!</p>
    <a href="javascript:login_fade();">Login</a>';


}

            
echo('</div> <!-- welcome div -->');


}

function display_nav(){

    global $au;
    
    $nav_display = mysql_query('SELECT * FROM `amember_payments` WHERE `member_id` = "' . $au[member_id] . '"');
    $nav = mysql_fetch_row($nav_display);
    
    //renders out the navigation depending on the user
    if($nav[2] == 1)
    {
        //user
        user_nav();
    }
    elseif($nav[2] == 2 || $nav[2] == 3)
    {
        //store
        store_nav();
    }
    else{
        //guest
        guest_nav();
    }
    
}

 

if i include JUST THE CODE from display_login() in my index.php, the navigation displays properly. If i try and use the function, it only displays the guest nav. $nav isn't being recognized when i use the function, thus display the else, which is guest_nav();

 

I seem to be having alot of problems with these functions, which has been helped here, so sorry for all the posts :P

 

Any help is appreciated!

Link to comment
https://forums.phpfreaks.com/topic/57105-solved-login-nav-functions-not-working/
Share on other sites

Archived

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

×
×
  • 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.