Search code examples
phpnestedincludeserver-side-includes

My includes dont seem to be working now that i have uploaded the files to the production server


They were all working fine on my XAMMP sandbox but now nothing.

Something im doing wrong.

Here is the code:

index.php

Contains mass include, which basically has all the includes in it.

<?php

//Starting session

session_start();

//Includes mass includes containing all the files needed to execute the full script
//Also shows homepage elements without customs

include ("includes/mass.php");

//Login Form

$login = 


         "<form id='signin' action = 'login.php' method = 'POST'>
         Username<input type= 'text' name= 'username'>
         Password<input type= 'password' name= 'password'>
         <input type= 'submit' value='login' name='submit'>
         </form>";

//Calculate number of users online

$num_users_sql = mysql_query("SELECT * FROM user WHERE loggedin = '1' ", $con);

$num_online_users = mysql_num_rows($num_users_sql);

//user bash link

$user = "<a href='user.php'>User</a><br>";  

//Register Form Link     

$registerlink = "<a id='signup' href='register.php'>Sign Up</a>";

//Logged In User Links 

$logoutlink   = "<a id='logoutlink' href='logout.php'>Log out</a>";

$message = "<div id='welcome'>"."Hello"." ".$_SESSION['username']."!"."</div>";

$num_users_online = "<div id='users_online'><h2>There are ".$num_online_users." Users On Readnotes Right nw!</h2>"."</div>";

         if (isset($_SESSION['username']))

          //If user is logged in

            {

                echo $message;

                echo $user;

                echo "</br>";

                echo $num_users_online;

                echo $logoutlink;

            }

         //If user is logged out

         else

            {   
                echo $login;

                echo $registerlink;  

            }


?>

Mass include

contains all of my includes

<?php

/*Mass include - mass.php*
*Includes all thing needed for operations to start*/


//Grab Header design & details

    require("header.html");

//Grab Footer design & details

    require("footer.html");

//Grab include to connect to the database!

    require("dbcon.php");


?>

Thanx.


Solution

  • The production server may not have . in include_path. To fix this, add it to the includes, e.g. ./header.html.