Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Different navigation menu when different user logins
Old 02-08-2006, 11:41 AM Re: Different navigation menu when different user logins
Super Talker

Posts: 145
Trades: 0
I found something that might help to solve the problem so i will post it and if anyone can help i will glad to read any suggestions.As i saw the problem is that the user details are being validated but the menu cannot be displayed.When the user enters the correct details it just appears a blank page.if the user enters wrong details it just display that "Your password is not correct. Please log on again!"So this is working what is no working is that when the user is being validated it doesn't display the menu.I think that the problem might be in the "password_input.php" page and specially with the "header()" function. The strange thing is that if i put the correct details and click submit the blank page will appear but if afterwards i add in the url the address
"http://www.domain.com/Staff/check_login.php" and manually redirect, it displays the correct menu.

thanks,
Xenia
xenia is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-08-2006, 12:00 PM Re: Different navigation menu when different user logins
neroux's Avatar
Ultra Talker

Posts: 284
Trades: 0
Although I wouldnt think of it as cause of the error, maybe try to insert a space between the colon and the URL and add an exit call.

PHP Code:
header("Location: http://www.domain.com/Staff/check_login.php");
exit; 
__________________

Please login or register to view this content. Registration is FREE
- The world at your fingertips
• Share your city with the world

--
Please login or register to view this content. Registration is FREE
neroux is offline
Reply With Quote
View Public Profile
 
Old 02-08-2006, 12:27 PM Re: Different navigation menu when different user logins
Super Talker

Posts: 145
Trades: 0
Finnaly , i manage to solve it by putting in the page password_input.php
include instead of header.I am also including the code, the orange code is what i changed:

PHP Code:

<?
   session_start
();

   include 
"dbconnect.php";

   if(empty(
$_POST['uname'])||empty($_POST['passwd'])){
                  include(
"loginform.php");
;
   }

    
$uname$_POST['uname'];
    
$query "SELECT * FROM Webusers WHERE username='$uname'";
    
$result mysql_query($query);
    
$row mysql_fetch_array($result);
    
$encrypted_password md5($_POST['passwd']);

    if(
$encrypted_password!=$row['password']){
         echo 
"<h3>Your password is not correct. Please log on again!</h3>";
         include(
"loginform.php");
    }else{


         
$_SESSION['username']=$uname;
         
$_SESSION['isAdmin']=$row['admin']=='yes';

         
//when i added the include function it worked
         
include("check_login.php");
        
// header("Location: http://www.domain.com/Staff/check_login.php");

    
}

//Check the output of the variable $_SESSION
//var_dump($_SESSION);
?>
Thank you all very much. neroux appreciate your help.
Can i put any comments or in this forum there is no any grading?

Xenia
xenia is offline
Reply With Quote
View Public Profile
 
Old 02-08-2006, 12:34 PM Re: Different navigation menu when different user logins
neroux's Avatar
Ultra Talker

Posts: 284
Trades: 0
Quote:
Originally Posted by xenia
Can i put any comments or in this forum there is no any grading?
Sorry, what do you mean?
__________________

Please login or register to view this content. Registration is FREE
- The world at your fingertips
• Share your city with the world

--
Please login or register to view this content. Registration is FREE
neroux is offline
Reply With Quote
View Public Profile
 
Old 02-09-2006, 06:41 AM Re: Different navigation menu when different user logins
Super Talker

Posts: 145
Trades: 0
I mean are we allow to put comments for any answers that it helped to solve the problem?
In other forums you have to comment the answers of the users.
xenia is offline
Reply With Quote
View Public Profile
 
Old 02-09-2006, 07:03 AM Re: Different navigation menu when different user logins
neroux's Avatar
Ultra Talker

Posts: 284
Trades: 0
I am sorry again, but I still did not understand.

Which answer would you like to comment?
__________________

Please login or register to view this content. Registration is FREE
- The world at your fingertips
• Share your city with the world

--
Please login or register to view this content. Registration is FREE
neroux is offline
Reply With Quote
View Public Profile
 
Old 02-09-2006, 08:43 AM Re: Different navigation menu when different user logins
Super Talker

Posts: 145
Trades: 0
Even i thought that the problem was solved i have another problem related to the navigation menu.I would appreciate your help to solve this problem.

I am trying to put the code
PHP Code:
session_start();
if(
$_SESSION['username']){
        echo 
"Welcome ".$_SESSION['username']."!""Logon time is: ".Date("m/d/Y");
                                  include(
$_SESSION['isAdmin']?'logoffheaderAdmin.php':'logoffheader.php'); 
in every page of the website in order to check if the user is administrator or a regular user.In two pages i manage to do it but for the rest it doesn't appear any menu regarding which user it is.
I will display an example of the code that i want the menu to appear:

PHP Code:
<?
include "../dbconnect.php";



//This is the new code i add to check if the user is admin or not
session_start();
if(
$_SESSION['username'])
{echo 
"Welcome ".$_SESSION['username']."!""Logon time is: ".Date("m/d/Y");
 include(
$_SESSION['isAdmin']?'logoffheaderAdmin.php':'logoffheader.php');





/* This was what i had previous in order to display the menu for the regular user amd it was working
session_start();
if (session_is_registered('username')) {
echo "Welcome "."$username"."!"."  Logon time is : ".Date("m/d/Y");
require("../logoffheader.php");
*/




?>
<form action="search1.php" method="get" name="Searchform">
<table width="100%" height="100%" border="0" bordercolor="#DCCA23" bgcolor="#DCCA23">
<tr bordercolor="#DCCA23" bgcolor="#DCCA23">
<td height="10%" colspan="2"><font size="4" face="Perpetua">
<h3><strong>Search Form </strong></h3>
</td>
</tr>
<tr bordercolor="#DCCA23" bgcolor="#DCCA23">
<td height="10%" colspan="2"> <size="2" face="Perpetua">
<h4>Search:
<input name="searchval" type="text" id="searchval" size="40">
<input type="submit" name="Search" value="Search">
</h4>
</td>
</tr>
<tr>
<td><a href="advancesearch.php">Advanced Search</a></td>
</tr>
</table>
</form>
<?
}
else
{
header("Location:http://www.domain.com/Staff"); die();
};
?>
It is very annoying as i though i had solve it but i can't use this command.
So please anyone?

Thanks,
Xenia
xenia is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Different navigation menu when different user logins

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.90519 seconds with 11 queries