Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8104719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T23:55:45+00:00 2026-06-05T23:55:45+00:00

I have this welcome.php which the administrator is redirected when he is authenticated, i

  • 0

I have this welcome.php which the administrator is redirected when he is authenticated, i have this other hostess.php which i want it to be displayed only to the administrator, i mean, noone should have access unless he or her is logged in.

The file of welcome.php contains this small code:

How can i insert hostess.php there?

<?php include('lock.php'); ?> 
<body> 
<div id="menu">  
<ul> 
<li><a href="logout.php">log out</a></li> 
</ul> 
</div> 
<h1> Welcome <?php echo $login_session; ?> </h1>
</body>

login page code:

<?php
include("config.php");
session_start();
if($_SERVER["REQUEST_METHOD"] == "POST")
{
// username and password sent from Form
$myusername=addslashes($_POST['username']);
$mypassword=addslashes($_POST['password']);

$sql="SELECT id FROM admin WHERE username='$myusername' and passcode='$mypassword'";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
$active=$row['active'];
$count=mysql_num_rows($result);


// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1)
{
session_register("myusername");
$_SESSION['login_user']=$myusername;

header("location: welcome.php");
}
else
{
$error="Your Login Name or Password is invalid";
}
}
?>
<form action="" method="post">
<label>UserName :</label>
<input type="text" name="username"/><br />
<label>Password :</label>
<input type="password" name="password"/><br/>
<input type="submit" value=" Submit "/><br />
</form>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T23:55:46+00:00Added an answer on June 5, 2026 at 11:55 pm

    If you want to do conditional includes then you should just add a check to see if the user is logged in and include the file if they are. I don’t know how you implemented the login and authentication stuff but based on the info you provided it would be like so:

    <body> 
        <?php include('lock.php'); 
        if($login_session != 'admin') { // or however else you would check the login status
            echo "<h1> Please Log In </h1>";
        } else {
            include('hostess.php'); // include and display all the rest of the stuff
            // display the stuff
        ?>
        <div id="menu">  
            <ul> 
                <li><a href="logout.php">log out</a></li> 
            </ul>
        </div>
        <h1> Welcome <?php echo $login_session; ?> </h1>
        <?php } // close else ?>
    </body>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a php page which dynamically produces this; ... <select name='sales_id'> <option> <option
I have a file called init.php which I want to get automatically included in
I have this html structure <div class=top_menu> <ul> <li class=left><a href= class=family-filter>asdas</a></li> <li class=welcome>Welcome
I have this array in PHP: array( [0] => array( 'username' => 'user1' )
We have this software that has a webservices component. Now, the administrator of this
I have this DependencyProperty which holds an entity with a property that is a
I have a web-site based on PHP, to which I would like to add
I have page register.php, which is used to get user informations, after completion of
I have this code which getting html code of page and than replace all
i have this bit of html. (Link at bottom) Its output of php code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.