Example #1
0
<?php

session_start();
if (isset($_SESSION['sessionid'])) {
    header('Location:lockans.php');
}
include 'header.php';
echo '<body>' . formGenerator() . '</body></html>';
function formGenerator()
{
    $r = '';
    if (isset($_SESSION['loginStatus'])) {
        if ($_SESSION['loginStatus'] == 'failed') {
            $r .= '<div class="signup-message">Incorrect Username/Password</div>';
            $_SESSION['loginStatus'] = '';
        }
    }
    $r .= '<form  method="post" class="myForm2" action="loginprocess.php">
    <h1>Login Form</h1>
    
    <h2><span class="circle">-></span>Enter Your Details</h2>
    <label for="email">Roll no.:</label></br>
	<input type="text" id="email" name="emailid" value=""></input>
	</br>
	</br>
	<label for="password">Password:</label></br>
    <input type="password" id="password" name="password"></input>
</br></br>
<button id="submit">Submit</button>';
    return $r;
}
Example #2
0
  <?php 
session_start();
//if no session has been created redirect to login page;
if (!isset($_SESSION['sessionid'])) {
    //echo '<div style="color:#fff">'.$_SESSION['sessionkey'].'</div>';
    header('Location: login.php');
}
//get time remaining;
$currtime = time();
$currtime = 1800 - ($currtime - $_SESSION['initTime']);
$time = '<div id="currtime" style="display:none;">' . $currtime . '</div>';
echo $time;
//generate the html;
include 'header.php';
$_SESSION['currentLevel'] = 1;
$form = '<body>' . formGenerator();
echo $form;
//echo '<div>'.$_SESSION['found'].'</div>';
echo '<script>
var seconds = parseInt(document.getElementById("currtime").innerHTML);
function secondPassed() {
    var minutes = Math.floor(seconds/60);
    var remainingSeconds = seconds % 60;
    if (remainingSeconds < 10) {
        remainingSeconds = "0" + remainingSeconds;  
    }
    document.getElementById("countdown").innerHTML = minutes + ":" + remainingSeconds;
    if (seconds <= 0) {
        clearInterval(countdownTimer);
        document.getElementById("countdown").innerHTML = "Time Over";
		window.location="lockans.php";
Example #3
0
<?php

session_start();
//if no session has been created redirect to login page;
///*danerous*/$_SESSION['sessionid']='13104032';
if (!isset($_SESSION['sessionid'])) {
    //echo '<div style="color:#fff">'.$_SESSION['sessionkey'].'</div>';
    header('Location: login.php');
}
//generate the html;
include 'header.php';
$_SESSION['currentLevel'] = '5';
$form = '<body class="special">' . formGenerator();
echo $form;
function formGenerator()
{
    $servername = "localhost";
    $username = "******";
    $password = "******";
    // Create connection
    $connection = mysqli_connect($servername, $username, $password);
    // Check connection
    if (!$connection) {
        die("Connection failed: " . mysqli_connect_error());
        return 'Error in fetching the question';
    }
    $query = 'select * from `mysql`.`result` where roll_no=' . $_SESSION['sessionid'] . '';
    //echo'<div>'.$query.'</div>';
    $result = mysqli_query($connection, $query);
    $row = mysqli_fetch_array($result);
    $query1 = 'select ans from `mysql`.`questions` where q_id=' . $row[1] . '';