diff --git a/README.md b/README.md
index d5c93ba..fdcc769 100644
--- a/README.md
+++ b/README.md
@@ -21,12 +21,13 @@ Download, unzip and just copy the content of the `sources` folder to any folder
## Setup
The setup is optional. If you leave it as is, there is a single unnamed room, opened to all users. If you want to customize the access control, edit the file `conf/setup.ini`. The interesting parameter is `auth` that indicates which user is authorized to which room.
-In this example `auth = John:Game,Mary:Game,John:Family,Tim:Family,admin:,:Public`,
-- John can access the Game room, the Family room and the Public room
-- Mary can access the Game room and the Public room
-- Tim can access the Family room and the Public room
-- admin can access all rooms
-- other users can only acccess the Public room
+In this example `auth = John:Game,John:Family,Mary:Game,Tim:Family,admin:*,*:Public,*:`,
+- `John:Game,John:Family' = John can access the Game room, the Family room and the Public room
+- `Mary:Game' = Mary can access the Game room and the Public room
+- `Tim:Family' = Tim can access the Family room and the Public room
+- `admin:*' = admin can access all rooms
+- `*:Public' = everybody can only acccess the Public room
+- `*:' = everybody can access the unnamed room
## Screen shot
![screenshot](https://raw.githubusercontent.com/chtixof/databank/master/minchat_ynh/minchat_ynh_screenshot01.gif)
diff --git a/sources/conf/setup.ini b/sources/conf/setup.ini
index e262533..c3ee2b8 100644
--- a/sources/conf/setup.ini
+++ b/sources/conf/setup.ini
@@ -6,6 +6,7 @@ interval = 2500 ; milliseconds
; :room with no user name is a room opened to any user name
; user: with no room name is a user allowed to every room
; default = single unnamed room and free user names
+auth=*:
; Example:
-;auth = John:Game,Mary:Game,John:Family,Tim:Family,admin:,:Public
+;auth = John:Game,John:Family,Mary:Game,Tim:Family,admin:*,*:Public,*:
diff --git a/sources/index.php b/sources/index.php
index 4eb8b30..44109f4 100644
--- a/sources/index.php
+++ b/sources/index.php
@@ -15,7 +15,7 @@ function deleteOldHistory() {
// init setup.ini parms
$ini = parse_ini_file('conf/setup.ini');
$interval= getarr($ini,'interval',2500);
- $auth= explode(',',getarr($ini,'auth',''));
+ $auth= explode(',',getarr($ini,'auth','*:'));
// read args
$name="";
@@ -35,14 +35,15 @@ if ($name.$room=="") {
// no args
$prompt = "Please fill in the form to continue:";
} else {
+// user name mandatory in any case
if ($name=="") {$prompt = "User name missing.";}
else if ($room=="") {
- if ($auth[0]==""){$prompt="";}
+// room not mandatory depending on setup
+ if (in_array("*:",$auth)||in_array($name.":",$auth)){$prompt="";}
else {$prompt="Room missing.";}
- }
- else if (in_array($name.":".$room,$auth)) {$prompt="";}
- else if (in_array(":".$room,$auth)) {$prompt="";}
- else if (in_array($name.":",$auth)) {$prompt="";}
+ }
+// here we have both room and user
+ else if (in_array($name.":".$room,$auth)||in_array("*:".$room,$auth)||in_array($name.":*",$auth)||in_array("*:*",$auth)) {$prompt="";}
else {$prompt="User not authorized to this room.";}
}