Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to lock out other web pages
    primarykey
    data
    text
    <p>I have an exam application where for the user to create an exam they have to go through these pages:</p> <ul> <li>create_session.php </li> <li>QandATable.php</li> <li>indivdiualmarks.php</li> <li>penalty.php</li> <li>complete.php</li> </ul> <p>Now what I am worried about is the user can complete some of these pages but then either abandonded creating the exam by leaving out the other pages or they start creating an exam going trough some of the pages above but then be able to either go back on a previous page or pevious pages or skip pages by entering url of other pages which are coming up ahead.</p> <p>So my question is that is there a way where I can stop the user skipping ahed pages or going back to previous pages? In other words they have to follow the exact steps of going through the five pages above in the exact order to create the exam.</p> <p>For example if the user is on the the <code>QandATable.php page</code>, they cannot go back to the create_session.php page or they cannot skip ahead to the other pages until the <code>QandATable.php</code> has been successfully submitted? In other words lock out the other pages except the current page. Once the user has accessed the <code>complete.php</code> page then exam is completed and the <code>create_session.php</code> can be removed from the lockout as that is the first page.</p> <p>If the user abandons a page such as the individualmarks.php, and the user goes back straight to the indivdualmarks.php page, then that is fine, but if they try to access another page, I am thinking of sending a prompt box or something similar stating:</p> <blockquote> <p>You already have an exam currently in creation, to continue with creating the current exam click on this link (link to current page user is on)</p> <p>If you want to create a new exam then please click on this link (link to the create_session.php page).</p> </blockquote> <p>I know what I am asking is not very simple but I don't want the user to mess up creating the exam unless they follow each step (each page) in the correct order so it doesn't mess with any data. Does anyone have a simple sample on how this could be achieved?</p> <p>I am working with IE, Chrome. Safari, Firefox and Opera</p> <p>Thanks</p> <p><strong>UPDATE:</strong></p> <pre><code>&lt;?php session_start(); ?&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;link rel="stylesheet" type="text/css" href="stepsStyle.css"&gt; &lt;title&gt;Follow Steps&lt;/title&gt; &lt;script type="text/javascript"&gt; //if user selects "Create New Assessment" Link, then use jquery/ajax below //code below will access removesession.php where it will remove exam details which will be overwritten $(function() { var link = $("#createLink"); link.click(function() { $.ajax({ url: "removesession.php", async: false, type: "POST", success: function() { window.location.href = link.attr("href"); } }); //cancels the links true action of navigation return false; }); ); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;?php $steps = array('create_session.php', 'QandATable.php', 'individualmarks.php', 'penalty.php', 'complete.php'); $latestStep = $_SESSION['latestStep']; // Track $latestStep in either a session variable or the DB and retrieve accordingly // $currentStep will be dependent upon the page you're on $currentIdx = array_search($currentStep, $steps); $latestIdx = array_search($latestStep, $steps); if ($currentIdx - $latestIdx &gt; 1 ) { ?&gt; //set up a div box to display message on wether use should contine or not &lt;div class="boxed"&gt; You already have an exam currently in creation, to continue with creating the current exam click on this link: &lt;br/&gt;&lt;a href=""&gt;Continue with Current Assessment&lt;/a&gt; &lt;br/&gt; If you want to create a new exam then please click on this link: &lt;br/&gt;&lt;a href="create_session.php" id="createLink"&gt;Create New Assessment&lt;/a&gt; &lt;/div&gt; &lt;? } else { // let the user do the step } ?&gt; </code></pre> <p>Got couple of questions regarding code above:</p> <ol> <li>What should <code>$currentStep</code> variable equal to?</li> <li>How do I link to its current page if user wants to continue with current exam?</li> <li>Should I leave the else statement empty to let the user do the step?</li> </ol>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload