Timers in php?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • fb

    #1

    Timers in php?

    Hello. I was working on a .php page that asks a user a question, then,
    after the submit the answer (multiple choice) it takes data from a
    database and makes a new question. Let's say that they have 10
    questions to answer. I'd like to give them a time limit to answer these
    10 questions. I was wondering if it is possible to make a timer in php,
    that counts down and won't reset every time a new question is pulled
    from the database (it seems this causes a refresh).

    If this is possible, could you please point me towards some code
    snippets? Many thanks

    fb
    --
    Disclaimer: I am in no way responsible for any of the statements
    made in the above text. For all I know I might be
    drugged or something..
    No I'm not paranoid. You all think I'm paranoid, don't you !
  • Jerry Stuckle

    #2
    Re: Timers in php?

    fb wrote:
    Hello. I was working on a .php page that asks a user a question, then,
    after the submit the answer (multiple choice) it takes data from a
    database and makes a new question. Let's say that they have 10
    questions to answer. I'd like to give them a time limit to answer these
    10 questions. I was wondering if it is possible to make a timer in php,
    that counts down and won't reset every time a new question is pulled
    from the database (it seems this causes a refresh).
    >
    If this is possible, could you please point me towards some code
    snippets? Many thanks
    >
    fb
    While you probably could do it in PHP (i.e. set a cookie with the
    current time and check it when they answer), it might be better done
    with client-side scripting, i.e. javascript.

    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    • Jeff North

      #3
      Re: Timers in php?

      On Thu, 31 Jan 2008 03:15:34 GMT, in comp.lang.php fb <fb@noway.com >
      <q3boj.26676$4w .24243@pd7urf2n owrote:
      >| Hello. I was working on a .php page that asks a user a question, then,
      >| after the submit the answer (multiple choice) it takes data from a
      >| database and makes a new question. Let's say that they have 10
      >| questions to answer. I'd like to give them a time limit to answer these
      >| 10 questions. I was wondering if it is possible to make a timer in php,
      >| that counts down and won't reset every time a new question is pulled
      >| from the database (it seems this causes a refresh).
      >|
      >| If this is possible, could you please point me towards some code
      >| snippets? Many thanks
      >|
      >| fb
      The start and finish times need to be set within PHP.
      These values must be stored within session variables.
      On the web page use AJAX to get the current time every second.
      If the user is over the time limit then, on the web page, alert the
      user to this fact then, on a click of a button, move to the next
      question.

      Your ISP might send you a not so nice notice to stop abusing the
      system.
      -- -------------------------------------------------------------
      jnorthau@yourpa ntsyahoo.com.au : Remove your pants to reply
      -- -------------------------------------------------------------

      Comment

      • Jerry Stuckle

        #4
        Re: Timers in php?

        Jeff North wrote:
        On Thu, 31 Jan 2008 03:15:34 GMT, in comp.lang.php fb <fb@noway.com >
        <q3boj.26676$4w .24243@pd7urf2n owrote:
        >
        >| Hello. I was working on a .php page that asks a user a question, then,
        >| after the submit the answer (multiple choice) it takes data from a
        >| database and makes a new question. Let's say that they have 10
        >| questions to answer. I'd like to give them a time limit to answer these
        >| 10 questions. I was wondering if it is possible to make a timer in php,
        >| that counts down and won't reset every time a new question is pulled
        >| from the database (it seems this causes a refresh).
        >|
        >| If this is possible, could you please point me towards some code
        >| snippets? Many thanks
        >|
        >| fb
        The start and finish times need to be set within PHP.
        These values must be stored within session variables.
        On the web page use AJAX to get the current time every second.
        If the user is over the time limit then, on the web page, alert the
        user to this fact then, on a click of a button, move to the next
        question.
        >
        Your ISP might send you a not so nice notice to stop abusing the
        system.
        -- -------------------------------------------------------------
        jnorthau@yourpa ntsyahoo.com.au : Remove your pants to reply
        -- -------------------------------------------------------------
        >
        Or, if you're going to be using Javascript anyway, no need for the trip
        to the server. Just do a client-side timer.

        --
        =============== ===
        Remove the "x" from my email address
        Jerry Stuckle
        JDS Computer Training Corp.
        jstucklex@attgl obal.net
        =============== ===

        Comment

        • Jeff North

          #5
          Re: Timers in php?

          On Thu, 31 Jan 2008 07:41:00 -0500, in comp.lang.php Jerry Stuckle
          <jstucklex@attg lobal.net>
          <5fSdnR2QXIfWXz zanZ2dnUVZ_ovin Z2d@comcast.com wrote:
          >| Jeff North wrote:
          >| On Thu, 31 Jan 2008 03:15:34 GMT, in comp.lang.php fb <fb@noway.com >
          >| <q3boj.26676$4w .24243@pd7urf2n owrote:
          >| >
          >| >| Hello. I was working on a .php page that asks a user a question, then,
          >| >| after the submit the answer (multiple choice) it takes data from a
          >| >| database and makes a new question. Let's say that they have 10
          >| >| questions to answer. I'd like to give them a time limit to answer these
          >| >| 10 questions. I was wondering if it is possible to make a timer in php,
          >| >| that counts down and won't reset every time a new question is pulled
          >| >| from the database (it seems this causes a refresh).
          >| >|
          >| >| If this is possible, could you please point me towards some code
          >| >| snippets? Many thanks
          >| >|
          >| >| fb
          >| The start and finish times need to be set within PHP.
          >| These values must be stored within session variables.
          >| On the web page use AJAX to get the current time every second.
          >| If the user is over the time limit then, on the web page, alert the
          >| user to this fact then, on a click of a button, move to the next
          >| question.
          >| >
          >| Your ISP might send you a not so nice notice to stop abusing the
          >| system.
          >|
          >| Or, if you're going to be using Javascript anyway, no need for the trip
          >| to the server. Just do a client-side timer.
          That would allow for the person to change their system clock and
          'upset' the timing.
          -- -------------------------------------------------------------
          jnorthau@yourpa ntsyahoo.com.au : Remove your pants to reply
          -- -------------------------------------------------------------

          Comment

          • Hendri Kurniawan

            #6
            Re: Timers in php?

            Jeff North wrote:
            On Thu, 31 Jan 2008 07:41:00 -0500, in comp.lang.php Jerry Stuckle
            <jstucklex@attg lobal.net>
            <5fSdnR2QXIfWXz zanZ2dnUVZ_ovin Z2d@comcast.com wrote:
            >
            >| Jeff North wrote:
            >| On Thu, 31 Jan 2008 03:15:34 GMT, in comp.lang.php fb <fb@noway.com >
            >| <q3boj.26676$4w .24243@pd7urf2n owrote:
            >| >
            >| >| Hello. I was working on a .php page that asks a user a question, then,
            >| >| after the submit the answer (multiple choice) it takes data from a
            >| >| database and makes a new question. Let's say that they have 10
            >| >| questions to answer. I'd like to give them a time limit to answer these
            >| >| 10 questions. I was wondering if it is possible to make a timer in php,
            >| >| that counts down and won't reset every time a new question is pulled
            >| >| from the database (it seems this causes a refresh).
            >| >|
            >| >| If this is possible, could you please point me towards some code
            >| >| snippets? Many thanks
            >| >|
            >| >| fb
            >| The start and finish times need to be set within PHP.
            >| These values must be stored within session variables.
            >| On the web page use AJAX to get the current time every second.
            >| If the user is over the time limit then, on the web page, alert the
            >| user to this fact then, on a click of a button, move to the next
            >| question.
            >| >
            >| Your ISP might send you a not so nice notice to stop abusing the
            >| system.
            >|
            >| Or, if you're going to be using Javascript anyway, no need for the trip
            >| to the server. Just do a client-side timer.
            >
            That would allow for the person to change their system clock and
            'upset' the timing.
            -- -------------------------------------------------------------
            jnorthau@yourpa ntsyahoo.com.au : Remove your pants to reply
            -- -------------------------------------------------------------
            You can make a note of the starting time in PHP to the session, that way
            whatever the client do to their clock,
            PHP still knows how long it has been.

            Hendri Kurniawan

            Comment

            • Jerry Stuckle

              #7
              Re: Timers in php?

              Hendri Kurniawan wrote:
              Jeff North wrote:
              >On Thu, 31 Jan 2008 07:41:00 -0500, in comp.lang.php Jerry Stuckle
              ><jstucklex@att global.net>
              ><5fSdnR2QXIfWX zzanZ2dnUVZ_ovi nZ2d@comcast.co mwrote:
              >>
              >>| Jeff North wrote:
              >>| On Thu, 31 Jan 2008 03:15:34 GMT, in comp.lang.php fb <fb@noway.com >
              >>| <q3boj.26676$4w .24243@pd7urf2n owrote:
              >>| | >| Hello. I was working on a .php page that asks a user a
              >>question, then, | >| after the submit the answer (multiple choice)
              >>it takes data from a | >| database and makes a new question. Let's
              >>say that they have 10 | >| questions to answer. I'd like to give
              >>them a time limit to answer these | >| 10 questions. I was
              >>wondering if it is possible to make a timer in php, | >| that
              >>counts down and won't reset every time a new question is pulled | >>
              >>| from the database (it seems this causes a refresh).
              >>| >| | >| If this is possible, could you please point me towards
              >>some code | >| snippets? Many thanks
              >>| >| | >| fb
              >>| The start and finish times need to be set within PHP.
              >>| These values must be stored within session variables.
              >>| On the web page use AJAX to get the current time every second.
              >>| If the user is over the time limit then, on the web page, alert the
              >>| user to this fact then, on a click of a button, move to the next
              >>| question.
              >>| | Your ISP might send you a not so nice notice to stop abusing the
              >>| system.
              >>| | Or, if you're going to be using Javascript anyway, no need for
              >>the trip | to the server. Just do a client-side timer.
              >>
              >That would allow for the person to change their system clock and
              >'upset' the timing.
              >-- -------------------------------------------------------------
              >jnorthau@yourpa ntsyahoo.com.au : Remove your pants to reply
              >-- -------------------------------------------------------------
              >
              You can make a note of the starting time in PHP to the session, that way
              whatever the client do to their clock,
              PHP still knows how long it has been.
              >
              Hendri Kurniawan
              >
              Eggzaggley.

              --
              =============== ===
              Remove the "x" from my email address
              Jerry Stuckle
              JDS Computer Training Corp.
              jstucklex@attgl obal.net
              =============== ===

              Comment

              Working...