A client has asked us to add an editable page to their site which they can update via external cms. No drama there; I can call this easily with the include "filename.php"; function but where I'm getting stuck is this external file needs to be behind a login so unless I include it as part of an existing $usermessage variable it's just constantly displayed whether logged in or not.
I'm having to edit an existing, previously built site (which is a few years old) so I am kinda stuck with the current way it's setup but is there a way I can include the file as part of the $usermessage?
See code below and thanks for any help...
<?php
require_once "header.php";
#require_once "onlinearchive.php";
if (isset($_SESSION['loginid']) && isset($_SESSION['email']))
{
$session_email = $_SESSION['email'];
$query = sprintf("SELECT name FROM login WHERE email = '%s' LIMIT 1",
mysql_real_escape_string($session_email));
$result = mysql_query($query);
$username = '';
$usermessage = '';
$intevents = '';
while ($row = mysql_fetch_array( $result )) {
// Print out the contents of each row into a table
$username = $row['name'];
}
if ($username)
{
$username = 'Welcome ' . $username;
}
$usermessage = '<p><span class="green"><strong>'.$username.'</strong></span>
<strong> to the Member’s Area. </strong><br><br>Here you’ll be able to view
news and notifications unique to IPA Members, so please check back regularly
for updates.<br><br></p>';
}
else
{
$usermessage = '<p><span class="green"><strong>To access the Member’s Area,
please <a href="login.php">Log in</a> or <a href="login.php">register</a>
</strong></span><br>';
}
?>
<div id="page-title"><p>IPA Member’s Area</p></div>
<div id="container" class="clearfix">
<div id="content">
<?php echo $usermessage; ?>
</div> <!--end content-->