0

I am using wampsever and it allows me to use php function to check if I am logged in but it is ignoring the tags inside of the html which calls a function, here is my code.

<?PHP
require_once("./include/membersite_config.php");
require_once("./include/fg_membersite.php");
if(!$fgmembersite->CheckLogin())
{
    $fgmembersite->RedirectToURL("login.php");
    exit;
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<head>
      <meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
      <title>Home page</title>
      <link rel="STYLESHEET" type="text/css" href="style/fg_membersite.css">
</head>
<body>

<div class='h1'>
<div class="Top_Logo">
</div>
</div>
<div id='fg_membersite_content'>
<h2>Home Page</h2>
Welcome back
<!-- This is what it ignores, but it uses the php above perfectly fine-->
<?= $fgmembersite->UserFullName(); ?>!

<p><a href='change-pwd.php'>Change password</a></p>

<p><a href='access-controlled.php'>A sample 'members-only' page</a></p>
<br><br><br>
<p><a href='logout.php'>Logout</a></p>
</div>
</body>
</html>
3
Contributors
7
Replies
8
Views
5 Years
Discussion Span
Last Post by LastMitch
0

@garyjohnson

I am using wampsever and it allows me to use php function to check if I am logged in but it is ignoring the tags inside of the html which calls a function,

May I ask is $fgmembersite a file or just a variable?

In order for an function to work inside of <html>

You have to add <?php?> or <? include(""); ?>

I don't know what is $fgmembersite? So:

For your old code:

<?= $fgmembersite->UserFullName(); ?>!

To your new code:

<?php $fgmembersite->UserFullName(); ?>

this should work.

Edited by LastMitch: grammer

0

$fgmembersite is a file, which is located in a sub folder. but when this code was on a hosting site like godaddy it worked fine. When is displays this code on the screen it shows this

UserFullName(); ?>

It disregards these tags <?= $fgmembersite->

0

That must be the problem, thank you, but how do I call a function if I need to use php 5.2.xx?

0

LastMitch already showed you how, but missed the echo.

<?= $fgmembersite->UserFullName(); ?>

would become:

<?php echo $fgmembersite->UserFullName(); ?>

Edited by pritaeas

0

@garyjohnson

<? include(" $fgmembersite->UserFullName();"); ?>

that's wrong. May I ask what are you trying to do?

if you used <? include(""); ?> it has to be a file. $fgmembersite is not a file!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.