[SOLVED] Restricted acces

Post Reply
Posts: 1
Joined: Sat Apr 30, 2022 2:13 pm

[SOLVED] Restricted acces

Post by ics01 »

Hello, the WCMS team !

Perhaps this idea do not need a special plugin, but should be implemented in WonderCMS as a simple evolution ? : the ability to grant a restricted access to the entire site, via a simple password (or a couple code/password, but I think a simple password should be enough, as WCMS is not intended to work with different users and specific rights).

Here is a simple code that should be integrated on WCMS'index.html :

Code: Select all

if (isset($_SESSION['count']) && ($_SESSION['count'] > 4)) {
	header('Location: https://www.wondercms.com/');
} else {
<!DOCTYPE html>
<meta charset="UTF-8" />
	$password = 'motdepasse';
	if ((isset($_POST['password']) && ($_POST['password'])) != $password) {
		if (!isset($_SESSION['count'])) {
			$_SESSION['count'] = 0;
		} else {
<form name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"> 
<p><label for="password">Password</label> <input type="password" title="Please type password" name="password" /></p> 
<p><input type="submit" name="submit" value="Connexion" /></p> 
	} else { ?> 
<p>Here is the text.</p>
A simple field should be added in parameters to enter password, for example like the image below, and that's all.
2022-04-30_162330.jpg (48.46 KiB) Viewed 10142 times
Isn't it a good idea ? :idea:

Thanks for your attention.

Etienne, France.
User avatar
Posts: 749
Joined: Sat Oct 30, 2010 12:23 am

Re: Restricted acces

Post by wiz »

Hey ics01, this is an interesting take. Is this something you implemented in the theme.php file?
I would suggest wrapping it in an extra statement and checking if the user is logged in instead of counting the session.

How are you liking WonderCMS so far? :)
Post Reply