Solved

Restricting access to PHP/CGI scripts to only registered users in Joomla

Posted on 2009-07-04
2
483 Views
Last Modified: 2012-05-07
I run Joomla CMS on my Apache server (WAMP) with User Registration feature enabled. This means visitors can register and have accounts on the web site. I can restrict access to specific articles/sections from Joomla itself. Using the "Custom HTML" module, I added an HTML form to the web site; this HTML form sends its parameters to a PHP file (I created) located in the server.

The customized HTML form is restricted to only registered users. However, that does not prevent non-registered users from running my PHP file (If they knew its name).

How can I restrict access to my own PHP/CGI files to only registered users? Does Joomla provide such feature?
0
Comment
Question by:ISDCCC
2 Comments
 
LVL 108

Expert Comment

by:Ray Paseur
ID: 24778044
I am not sure if Joomla can do what you want all by itself, but it should be fairly easy to protect your action script.  Use a CAPTCHA image.  That way you will be able to know that anyone who access your PHP file came through your form and was human-enough to enter the CAPTCHA information correctly.

A good place to start is with ReCaptcha:
http://lmgtfy.com?q=ReCaptcha

Best regards, ~Ray
0
 
LVL 4

Accepted Solution

by:
stevepicks earned 500 total points
ID: 24778237

<body>
<?php //cortecy of lleo for joomla 1.5
$user =& JFactory::getUser();?>
<?php if ($user->id > 1) : ?>

<!-- user IS logged in so deliver normal template
     Your normal template HTML here -->

<?php else : ?>
<!--  Visitor is NOT logged in so deliver the login page -->

<jdoc:include type="modules" name="user9" />

    <?php if ($option == 'com_user') : ?>
         <jdoc:include type="component" />
    <?php endif; ?>
<?php endif; ?>

</body>
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now