Prof. Takemoto,
I know this post is really old but it has still come to much use to me. I tried to embed the code in a 1.8.3 edition and everything worked fine. By the way, since someone else has already mentioned it, you have indeed missed a parenthesis at the end of the if clause. The corrected code is this:
<?php
//secure quiz module
if(stristr($_SERVER['SCRIPT_FILENAME']."X", "attempt.phpX") || stristr($_SERVER['SCRIPT_FILENAME']."X", "review.phpX"))
{
include("blockit.html");
}
?>
However, my initial goal was other than securing the quiz module. I want to secure the lesson module. When I try to modify the code as follows...
<?php
//secure quiz module
if(stristr($_SERVER['SCRIPT_FILENAME']."X", "attempt.phpX") || stristr($_SERVER['SCRIPT_FILENAME']."X", "review.phpX"))
{
include("blockit.html");
}
//secure lesson module
if(stristr($_SERVER['SCRIPT_FILENAME']."X", "lesson.phpX"))
{
include("blockit.html");
}
?>
...nothing happens; you can right-click in any lesson.
I have "some" experience on php and javascript; enough, that is, to basically understand what the code does. However, I feel I am doing something terribly wrong.
If you or any other moodle user could enlighten me on the matter, I would be really grateful. For the time being, all I can think about is wheather the "lesson.php" file is the one I should protect.
Best regards,
Theodore.