Why the php code in html files?

Why the php code in html files?

by Gabriel Dias -
Number of replies: 1
Hi to all, today looking at the moodle code i realized there are a lot of php code in html files.
For example look at the /backup/backup_form.html file (it looks like the attached image).
There is a call to require_login() function that doesn't appear to make any sense because the server doesn't interpret these kind of files as the php ones.
Isn't there any problem or security risk that anybody can see the php code from the browser? I know if you download the code you can see the whole moodle code, but supose you make a modification to this file, and for any reason don't want to let anybody to see that code.

Besides i think that change the server's parameters to tell it to interpret html files as php is not a solution because of the innecesary overhead.

I just want to know your opinion, thanks for any reply!guiño
Attachment Pantallazo-2.jpg
Average of ratings: -
In reply to Gabriel Dias

Re: Why the php code in html files?

by Josep Barceló -

I think that these html files with php tags are usually called from a php file (using an include sentence), so the php tags are interpreted without changing the server's settings.


If, for some security reason, you want to change the php tags in these html files and keep the changes secret, I guess you can rename the files from xyz.html to xyz.php and change accordingly all include sentences that invoke the files.


Anyway, I admit that it could have been better to store these files as *.php in the official Moodle version.