I have a page on my site which contains a java chat room and I would like to password-protect it so only users of the site can get into it. The url is basically http://www.mysite.com/chatroom.php - so it's not a node but a php page. Is there a way to do this? I checked out simple access but it only works for nodes from what it looks like, and it's not out for 5.0 either.

Any help is super appreciated.

Comments

wmostrey’s picture

Put the content of chatroom.php in a node with php input type, and only allow registered users access to it, for instance by putting this at the top:

global $user;
if ($user->uid)==0) exit;

Or you could display a friendly error message.

Or use taxonomy_access and create a 'Private' tag (or a 'Premium' tag for a more exclusive feel).

triangleman85’s picture

When I insert that code, I get the following message:

Parse error: syntax error, unexpected T_IS_EQUAL in /usr/local/psa/home/vhosts/route146.org/httpdocs/wyldrydewebchat.php on line 3

Because of the nature of the php, I'm unable to put it into a node.

jaminh’s picture

The syntax error is because there is a missing parentheses.

if ($user->uid)==0) exit;

should be

if (($user->uid)==0) exit;

nancydru’s picture

triangleman85’s picture

I have menu per role already installed, but it doesn't stop someone who knows the url to the chat page from accessing it. It just keeps it out of their menu.

nancydru’s picture

That's why I use both TAC_lite and Menu_per_Role.

Nancy W.
now running 5 sites on Drupal so far
Drupal Cookbook (for New Drupallers)
Adding Hidden Design or How To notes in Your Database

slosa’s picture