Jump to content

Recommended Posts

Iam making a quiz page for which i want people to answer it in given time of 3 minutes. Is it possible that i can get the time spent on the page right after opening it. So that i can make sure, they submitted in time and no one got answers from google.

 

Can i trace ip of the comp? So that i can find if same person is not posting again.

 

I get "10-05-31 02:15:10" in place of ip when used $ip = $_SERVER['REMOTE_ADDR'];

 

If there are easier ways, plz let me know. :)

Link to comment
https://forums.phpfreaks.com/topic/203451-a-quiz-page-time/
Share on other sites

<?php
//page time:
session_start();
if(!isset($_SESSION['time'])) {
$_SESSION['time'] = time();
}
else {
if(isset($_SESSION['failed'])) {
echo 'You have failed to complete this test in a timely manner.';
}
elseif((time() - $_SESSION['time']) > 180) {
  echo 'Timer has run out!';
  unset($_SESSION['time']);
  $_SESSION['failed'] = 1;
}
}

 

Or, something along those lines.

Link to comment
https://forums.phpfreaks.com/topic/203451-a-quiz-page-time/#findComment-1065845
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.