Adding protection to MOODLE quizzes---

Re: Adding protection to MOODLE quizzes---

by Timothy Takemoto -
Number of replies: 9

I implemented the anti-copying function supplied by Rob Butner and Indjana Dzons. Thank you both very much.

The instructions are alread available but I have made some very minor changes.

1) Insert

<?php include("common.php") ?>

Into header.php in your theme. I put it at the second to last line before the <!-- END OF HEADER --> because that enables me to put a warning at the top of the quiz (see 4 below)

2) create a file common.php in your theme folder (Indjana Dzons had it somewhere else but I think it is helpful to have it inside the theme folder since that is the one folder that one copies accross when updating Moodle.)

<?php
if (stristr($_SERVER['SCRIPT_FILENAME']."X", "attempt.phpX")) {
  include("blockit.html"); }
  ?>

One could add other pages (other than attempt.php) to the above if one wants to prevent students from copying other files but since the above prevents both the quiz attempt screen and the feedback screen, which is also created by attempt.php, it is enough for me.

3) Create a file blockit.html in your theme folder. Include the super-java script blocker supplied by Rob Butner here

I just used the code between <SCRIPT Xlanguage="JavaScript"><!-- and the last </SCRIPT>
This is an encoded javascript so I guess it makes it more difficult to beat. It prevents students from copying by interfering drastically with the clipboard and select. I think that the clipboard and the select range is emptied at a high rate. It becomes impossible to copy anything on any window on ones computer. BE WARNED: JUST OPENING ROB BUTNERS SCRIPT IN YOUR BROWSER CAUSES MAJOR LIMITATIONS TO YOUR ABILITY TO COPY. USE "view source" or save and open the header.php in a text editor or you will not be able to copy it.
Control P appears to work at first but in fact all that is printed out is a blank page. This is a mystery to me.

4) At the top of the blockit.html page I included
<meta http-equiv="Content-Type" content="text/html; charset=x-euc-jp">
<br /><table align="center"  class="generalbox" border="0" cellpadding="5" cellspacing="0"><tr><td bgcolor="pink" class="generalboxcontent">Copying and printing during the Test is prohibited</td></tr></table><center><br /> 
Change the content statement to
content="text/html; charset=x-euc-jp"
If using Japanese.

It seems to work very well but

1) It still seems possible to download source. The determined copier could use this method of copying the quiz.

2) I cannot seem to get the above Rob Butner"Super-encoded-anti-copyiing-Javascript to work in Tandem with the Rob Butner provided Simpler-Javascript given above on this forum. The one above on this forum prevents use of the right click and gives warnings about the way that the browser functionality has been changed. The "Super-encoded" version seems just to work in the background which has the result that the student will not know why the functions are not working. I would like to be able to use both. 
Part of the problem was that I was using
"<scriptxxx" but in fact it should be script l a n g u a g e without the spaces as Genner explains above. But all the same, I still can't get security.js above to work.

3) If one saves the quiz then it is impossible to view that quiz simply in a browser. "aboutblack" is displayed. But it is still possible to view it in a text editor.

But of course, this functionality is a great help.

Tim
takemoto
 

In reply to Timothy Takemoto

Re: Adding protection to MOODLE quizzes---

by Timothy Takemoto -

Oops, I am really sorry, blocking only attempt.php does not block the feedback since it is review.php that powers the feedback screen. Hence I have made common.php into

<?php
if (stristr($_SERVER['SCRIPT_FILENAME']."X", "attempt.phpX")) {
  include("blockit.html"); }
  if (stristr($_SERVER['SCRIPT_FILENAME']."X", "review.phpX")) {
  include("blockit.html"); }
  ?>

But perhaps
if (stristr($_SERVER['SCRIPT_FILENAME']."X", "attempt.phpX" or "review.phpX")) {
  include("blockit.html"); }
  ?>
would work? "or"?

I also changed "Copying and printing during the Test is prohibited" to "Copying and printing while viewing the Test is prohibited"

Tim

In reply to Timothy Takemoto

Re: Adding protection to MOODLE quizzes---

by Timothy Takemoto -
I used to use Chris U's timer because, my boss wanted one, language should be readily accessable rather than slowly accessible, I thought that the timer made the test look rather serious and exam like, I thought that perhaps it would reduce on cheating.

However, having applied the above lobotomy to my students' browsers, I find that students are taking about 3 times longer over the homework!

Is this because they are swearing and cursing me as they use paper dictionaries rather than copying and pasting to one online?

Or is this because they are less like to copy from friends? Or is it just that the text is longer this week? Hmm...

They are doing pretty well too. I will let readers know of the student response this evening after the lesson.

Tim
In reply to Timothy Takemoto

Re: Adding protection to MOODLE quizzes---

by Edson Pfützenreuter -
I don't know so much of java and PHP, but know how to follow instructions. I did exactly what you is written in your messagem, but it didn't work.

Is there any other thing to set up.
In reply to Edson Pfützenreuter

Re: Adding protection to MOODLE quizzes---

by Timothy Takemoto -
Dear Edson Pfutzenreuter
Sorry I did not see this sooner. That's strange. Perhaps I left something out. If you care to share you passwords with me I will take a look. It is working fine for me.
Tim
In reply to Timothy Takemoto

Re: Adding protection to MOODLE quizzes---

by Steven Geggie -
When you make these sorts of changes to the source code, how are you managing to re-integrate them into future releases?
In reply to Steven Geggie

Re: Adding protection to MOODLE quizzes---

by Timothy Takemoto -

The good thing about the above hack is that it takes place entirely in the themes folder. The themes folder is the only one (plust config.php, sorry) that you have to move accross to future releases.

However perhpas there will have to be a rewrite when it comes to a new templated Moodle 2.0.

I have not used many of the other quiz hacks because they require changes outside the themes folder.

Perhaps it would be possible to have a "hacks" subdirectory within the themes folder such that any core moodle file that one wants to change, is placed in that hacks directory and moodle would look in there first. Trouble is...the hacks become non-compatible. I would really like to use the open quiz in new window hack but I don't for this reason.

Tim

In reply to Timothy Takemoto

Re: Adding protection to MOODLE quizzes---

by Scott Bartley -
Does this still work? I'm using 1.8.3. I want to have the clipboard constantly cleared, and the pages made unprintable and unsaveable with taking a quiz or viewing quiz results. My moodle can only be accessed for computers on our LAN which have no admin privileges, so I don't have to worry about them installing Snagit, etc.
In reply to Scott Bartley

Re: Adding protection to MOODLE quizzes---

by Timothy Takemoto -

I think that the above copy protection should work in any version of Moodle.

However while it will flush the clipboard, it does not work on Snagit which seems to use its own keepboard. I have Snagit and I just tried it, and I could copy the quiz screen. 

It will workon "Printscreen," which uses the normal clipboard however.

OOps stop press...the following does not seem to work. I am working on it now.

Also, and this is the reason why almost a year later I am returning to this thread, I have made a minor modification to the file "common.php" in the above theme, such that the copy-protection does not apply to administrators or teachers

common.php is now
 <?php
  if (!isadmin() && !isteacher()) { //so that copy protection does not apply to teachers
  if (stristr($_SERVER['SCRIPT_FILENAME']."X", "attempt.phpX")) {
  include("blockit.html"); }
  if (stristr($_SERVER['SCRIPT_FILENAME']."X", "review.phpX")) {
  include("blockit.html"); }
  }
  ?>

I think that perhaps all admins are teachers, but I am not sure, so I included both isadmin and isteacher. The above makes my life (and editing quizzes) a lot easier.

Enjoy,

Tim