Welcome Guest, Not a member yet? Register   Sign In
Drop in a folder of html, css and images but have them password protected
#1

[eluser]charlie656[/eluser]
Hi all,

I am in the early stages of designing a new e-learning app.

What I would like to be able to do is have it so that I can add new courses as folders of html, css and images.

I would like to have the html and css work as usual with relative links so it can be built like any other set of web pages however I would like it protected so only logged in users can access it.

Im asking here since I plan on building this with codeigniter.

This sounds like it should be easy to do but I dont think it is. Could anyone recommend an approach.

thanks,

Graeme
#2

[eluser]phpserver[/eluser]
Hi,an e-learning application would probably require a database backed authentication because of returning readers.This is how we protect entire folders.Protecting entire folders in php
There is more where that came from.
#3

[eluser]charlie656[/eluser]
Yes, I will authenticate via a login and DB.

What I am aiming for is that the courses will only require pure html+css without any php.

However I would like to make it so only users that have authenticated via a login form on a page can view the content.

Do you think dynamically writing .htaccess .htpasswd files might be a valid approach. Can php take submitted login details and log the user in so that the .htaccess wont throw up its pop-up login window.

Thanks for any help.
#4

[eluser]charlie656[/eluser]
I think that I will have to let the goal of having just html slip and make the courses php with the first line
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');?>

Since there is no content so far this wont be a problem.
It will still be possible to view images if you have the correct URL.

If anyone has some wisdom to impart on this however, then id still be interested to hear it.

Thanks

Graeme
#5

[eluser]charlie656[/eluser]
A good enough solution for me is to set a cookie when the user logs in and check this with an htaccess in the folder of protected stuff.

RewriteEngine on
RewriteCond %{HTTP_COOKIE} !your-cookie-name=your-cookie-value
RewriteRule .* login.php




Theme © iAndrew 2016 - Forum software by © MyBB