PHP - Password Protect Extension

Do you want to share WYSIWYG Web Builder tips, tricks, tutorials or useful HTML code? You can post it here...
(no questions or problems please, this section is not monitored by support).
Forum rules
This section is to share tips, tricks and tutorials related to WYSIWYG Web Builder.
Please do not post questions or problems here. They will not be answered.

PLEASE READ THE FORUM RULES BEFORE YOU POST:
viewtopic.php?f=12&t=1901
Post Reply
madjamonline
 
 
Posts: 51
Joined: Tue Jun 19, 2007 4:27 pm
Location: United Kingdom
Contact:

PHP - Password Protect Extension

Post by madjamonline »

Hi There,
This little tweak allows you to edit the Password Protect code displayed on the page: http://www.wysiwygwebbuilder.com/password_protect.html

This tweak allows you to view some text. It would say you are not logged in if you aren't logged in and if you are logged in, it would say welcome so and so.

To tweak the password protect sample, follow the instructions below.

1. On the pages you want, type this code in the start of page section.

Code: Select all

<?php
$notloggedin_text = "You are currently not logged in.";
$loggedin_text = "Welcome ".$_SESSION["username"]"! <a href=logout.php>Logout.</a>";

# No edits beyond this line
// This code is an extension of the password protect sample
// The above text is not credit, it is help!
// No edits beyond this line

if($_SESSION["username"])
{
$specification = "MD EXTENSION: 0837_log";
}
if($_SESSION["username"] == "guest")
{
$specification = "MD EXTENSION: 9276_log";
$specification = "MD EXTENSION:";
}
?>
Now insert this bit in the area where you want the text to be displayed.

Code: Select all

<?php
if($_SESSION["username"])
{
echo $loggedin_text;
}
else
{
echo $notloggedin_text;
}
echo '<font face="arial" size=1>';
echo $specification;
echo '</font>'
?>
If there are any problems with the above code, please say so! :D

Note that this extension will not work if you have edited the main section in the verify page.

Extension gathered by Jamie.[/code]
Post Reply