I forgot to mention that I am a newbie. I found this code on the internet somewhere and was trying to make it work. I guess, no more php coding for me.
Since that is out of the way, one more related question then - what I was trying to do with the above code was to prevent direct url access to my files. Based on what I have read on several forums, it is best to move the files outside of the root directory to prevent hotlinking and direct access.
Do you have any recommendations on how to make the files available for paid members only on my site? I am planning on using either memberpress or membermouse as the membership plugin.
I have looked at Wordpress Download Manager, WP Document Revisions, etc but they don't work for me as each of my courses is saved into multiple files in a data folder and a .html file that refers to all the files in the data folder.
Thanks.