Quote:
Originally Posted by TosaInu
I need to hide a html page until users are logged in. You start with making the page php, but HTML content is still visible. The HTML also contains some Javascript and it would be nice if this could be shielded permanently. Wrapping the whole HTML content inside <?php tags make it invisible, but also stops it from working.
How do I block the whole page until the user is logged in, also when viewing sourcecode?
|
Just wrap the HTML inside PHP as you tried.
However, you must do it correctly else it wont work.
They must be put either in PRINT or ECHO statements.
Example:
PHP Code:
<?php echo("
<div class=\"content\">
<H1>Paintball ?</H1>
<H2>Paintball? What's that?</H2>
<p>Paintball is an intense,
...blah, blah, blah..
</div>
"); ?>
One important note.
See If you use quotes within PHP code you MUST escape them with \ else it will give you an error.
For example I had quotes in my enclosed HTML above so I did this
HTML Code:
<div class=\"content\">
Hope that makes sense
No need to read on from here, but there is another way which you may prefer.
You could always just add the html as an include when required.
For example.
PHP Code:
if ($usergroup == '6' )
{include("/home/xxx/public_html/include/menu.inc");}
The file menu.inc is just straight HTML content.
It has no body, title, header tags etc, just straight HTML content.