The following warnings occurred:
Warning [2] Undefined array key "threadviews_countguests" - Line: 745 - File: showthread.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php 745 errorHandler->error_callback
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 861 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 1121 build_postbit
Warning [2] Undefined property: MyLanguage::$thread_modes - Line: 46 - File: showthread.php(1650) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php(1650) : eval()'d code 46 errorHandler->error_callback
/showthread.php 1650 eval




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Password Protected Page
#1
Anyone have any ideas for how to create a password protected page? Or possibly a redirect to a "hidden" page (not listed in the menu)? or a Plugin?

thanks!
Reply
#2
Hey,

This is how I did it on one of my sites, needed some quick and easy.
You'll need Customfields plugin installed... setup a new field as a dropdown with one option"protected"
and a second textfield called "password"


Change your template file where you echo the page content to

Code:
if (returnCustomField('pagetype')=="protected"){
                include "protected.php";
            }
             else {
                get_page_content();
            }

The content of protected.php is

Code:
<?php

$password=(isset($_POST['password']) && $_POST['password']!= '') ? $_POST['password'] : '';
$realPassword=returnCustomField('password');
$err="";

if ($password!="" && $password!=$realPassword){
    $err="Password Incorrect";
}

if ($password==$realPassword){

get_page_content();
    
} else {


?>
<div style="text-align:center;"><br/> <br/>
<h2 style="margin-right:0px;">Welcome to the VIP area.</h2>
<br/>

<br/>
<form action="index.php?id=vip" method="post">
Please enter your Password:
<br/> <br/>
<input type="password" name="password" id="password"  /><br/>
<input type="submit" value="Enter" />
</form>
<?php
if ($err){
    echo "<p class='passFail'>".$err."</p>";    
}
?>

</div>

<?php
}
?>



Could probably be coded a lot better but he needed something fast and this works for him...

Hope it helps...

Mike....
My Github Repos: Github
Website: DigiMute
Reply
#3
n00dles101 Wrote:Hope it helps...

As ever, awesome! Thanks - will try it out.
Reply




Users browsing this thread: 1 Guest(s)