SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Member
    Join Date
    Feb 2013
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need help on php Scripts

    hey guys ive been trying to research about a php scripts that disables "alt tabbing" when you open the web page. Weve been trying to create an Online Examinaion System using php script, and for our security, disabling alt tab to prevent Users to "google" the answers.... Any help? Also new opinion on its security is also welcome and appreciated.. thanks

  2. #2
    From space with love silver trophy
    SpacePhoenix's Avatar
    Join Date
    May 2007
    Location
    Poole, UK
    Posts
    5,028
    Mentioned
    103 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by accvipers View Post
    hey guys ive been trying to research about a php scripts that disables "alt tabbing" when you open the web page. Weve been trying to create an Online Examinaion System using php script, and for our security, disabling alt tab to prevent Users to "google" the answers.... Any help? Also new opinion on its security is also welcome and appreciated.. thanks
    It probably won't work unless you're in control of the computers that are being used for an exam, if two different browsers are available, eg IE and FF then the other one could be used to google the answer. Also with the way that chrome opens a new process for each window that might make it harder to stop
    Community Team Advisor
    Forum Guidelines: Posting FAQ Signatures FAQ Self Promotion FAQ
    Help the Mods: What's Fluff? Report Fluff/Spam to a Moderator

  3. #3
    SitePoint Addict bronze trophy vectorialpx's Avatar
    Join Date
    Dec 2012
    Location
    Bucharest
    Posts
    247
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    You cannot control the browser in this way but you may use some javascript.
    Here it is a copy-paste example.
    However, you also need a protection for the javascript-disabled action (an ajax request each X seconds to check that the javascript is still on. If not, set test as failed)

    Code:
    <html>
    <head>
    	<title>Exam</title>
    	<style type="text/css">
    		html { background:#fff }
    		body { background:#eee; }
    	</style>
    	<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    </head>
    
    <body>
    <p id="hei" style="display:none">Get back to the page! Remained: <span id="rem"></span></p>
    <br /><br /><br /><br /><br /><br /><br />The test here<br /><br /><br /><br /><br /><br /><br />
    
    <script>
    	var intv = 0;
    	var counter = 0;
    	var maxAllowedSeconds = 10;
    	function startCounter() {
    		$('#hei').show();
    		counter = 0;
    		$('#rem').html(maxAllowedSeconds);
    		intv = setInterval(function(){
    			counter++;
    			$('#rem').html( parseInt(maxAllowedSeconds) - parseInt(counter) );
    			if( counter > maxAllowedSeconds ) {
    				location.href = 'http://www.google.com';
    			}
    		}, 1000);
    	}
    	function resetCounter() {
    		$('#hei').hide();
    		clearInterval(intv);
    		counter = 0;
    	}
    
    	$('body')
    		.mouseenter(function(){ resetCounter(); })
    		.mouseleave(function(){ startCounter(); })
    	;
    </script>
    
    </body>
    
    </html>

  4. #4
    SitePoint Member
    Join Date
    Feb 2013
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @victorial:thanks man... ill try this one... do i still need to download something?i got notepad[i dont really use other ones], phpmyadmin for database, and xamp...
    @spacephoenix: how can they open new browsers if they cant alt tab when they start the script xD
    if you guys know a better security for this system. please pm me. this is for our thesis ) and we got a defense on it next week..

  5. #5
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,174
    Mentioned
    190 Post(s)
    Tagged
    2 Thread(s)
    Windows and Tabs are in the control of the user not the website. for security reasons.

    IMHO the best solution is probably doing something like odesk does for it's online proficiency tests. i.e.

    The user is sequentially presented a number of random questions from a larger pool of questions.
    The test session is time limited

    The user could approach it as an "open book" test - but - since there is no foreknowledge of what the questions will be they can't be researched beforehand. and time taken to do research will result in later questions going unanswered and considered "wrong".

  6. #6
    SitePoint Member
    Join Date
    Feb 2013
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thats our other option in mind... could it be possible to time limit each question in a php script?..can you send me a sample script? im kinda new to php, so , i only know the basics..

  7. #7
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,174
    Mentioned
    190 Post(s)
    Tagged
    2 Thread(s)
    I don't have a sample script, I'd need to write it, which I don't have time for now.

    You could have one or more SESSION variables, eg. one for each question, one for the overall test.

    I would store the SESSION variable in a database that has a "time" field. checked on the subsequent page and compared with "now". If "less than X" OK, else "too long".

  8. #8
    SitePoint Member
    Join Date
    Feb 2013
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks.. btw is this online examination is existing already?.. i see many online exams but no databases..
    need also some unqie features..

  9. #9
    SitePoint Wizard bronze trophy Jeff Mott's Avatar
    Join Date
    Jul 2009
    Posts
    1,272
    Mentioned
    18 Post(s)
    Tagged
    0 Thread(s)
    Even if you could fully lock down the user's computer, how will you stop students from alt-tabbing to their iPhones.

    I think Mittineague's alternative approach is the only approach that will do any good.
    "First make it work. Then make it better."

  10. #10
    SitePoint Addict bronze trophy vectorialpx's Avatar
    Join Date
    Dec 2012
    Location
    Bucharest
    Posts
    247
    Mentioned
    8 Post(s)
    Tagged
    0 Thread(s)
    It's true that "time limited tests" is the safest method but you must design your questions in this way
    so on a simple google search you will not get relevant results.

    What are your questions about?

    However, the javascript needs protection (it can be disabled) and a complex development.
    The session timed development is way simpler to develop.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •