HEX
Server: Apache/2.4.58 (Ubuntu)
System: Linux ip-172-31-18-78 6.17.0-1017-aws #17~24.04.1-Ubuntu SMP Tue May 26 21:09:53 UTC 2026 aarch64
User: ubuntu (1000)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: /var/www/selfanalyse/emu-aptitude-test/test_instruction.php
<?php

/**
 * 
 * Title : Test Instruction Page
 * Developer : Gulfam Ali, Rohit Kashyap, Sumit Singh Rawat (Designer)
 * Date : 04 Mar,2020
 * Description : First page for instruction of test (Mock test or Practice test)
 * 
 */
?>
<!-- <body oncontextmenu="return false;"> -->
<title>
    Aptitude Test - ThinkEmu
</title>
<link rel="icon" href="/wp-content/themes/psychometrics/images/emu.ico" type="image/x-icon"/>
<body oncontextmenu="return false;">
    <?php
    // ini_set('display_error', 1);
    // ini_set('display_startup_errors', 1);
    // error_reporting(E_ALL);
    ?>

    <?php
    include_once('../wp-config.php');
    global $wpdb;
    $PSY_EXAMS = $wpdb->prefix . PSY_EXAMS;
    $PSY_SUBSCRIPTION = $wpdb->prefix . PSY_SUBSCRIPTION;
    $PSY_TEST_GEN_TEST_TAKEN = $wpdb->prefix . PSY_TEST_GEN_TEST_TAKEN;

    //$subscriptionId = 21;//$_POST['sID'];
    //$class_id = 12;//$_POST['class_id'];
    $subscriptionId = $_POST['sID'];
    $class_id = $_POST['class_id'];
    //$testType = 'new';

    global $current_user;
    if (is_user_logged_in()) {
        get_currentuserinfo();
        $user_id = $current_user->ID;  // print session USER_ID

        $checkTest = $wpdb->get_var("SELECT test_taken_id FROM $PSY_TEST_GEN_TEST_TAKEN where user_id='$user_id' and reference_id='$subscriptionId' and status='Y' and test_type='EMU-APT'");

        //if($checkTest == 0){

        $validSubscription = $wpdb->get_row("SELECT subscription_id, exam_id, test_type FROM $PSY_SUBSCRIPTION where subscription_id='$subscriptionId'");
        if ($validSubscription > 0) {
            if ($validSubscription->test_type == 'EMU-APT') {
                $exam_id = $validSubscription->exam_id;
                $examDetail = $wpdb->get_row("SELECT is_negative_marking,negative_marking_percent,question_weight,subject_choice,app_status,bilingual,section_bound,total_no_of_questions_in_exam,total_exam_time_in_minute,category_name FROM $PSY_EXAMS where exam_category_id='$exam_id'");

                $is_negative_marking = $examDetail->is_negative_marking;
                $negative_marking_percent = $examDetail->negative_marking_percent / 100;
                $quesWeight = $examDetail->question_weight;
                $subjectChoice = $examDetail->subject_choice;
                $app_status = $examDetail->app_status;
                $section_time_wise = $examDetail->section_bound;
                $totalQuestinInExam = $examDetail->total_no_of_questions_in_exam;
                $totalTimeForExam = $examDetail->total_exam_time_in_minute;
                $examName = $examDetail->category_name;

                $totalSections = $wpdb->get_results("SELECT exam_category_id from $PSY_EXAMS where parent_id='$exam_id'");
            }

            /***
             * 
             * Check for resume test
             */

            $test_id = $wpdb->get_var("SELECT test_taken_id FROM $PSY_TEST_GEN_TEST_TAKEN where user_id='$user_id' and reference_id='$subscriptionId' and status='N' and test_type='EMU-APT'");

            if ($test_id != 0) {
                $testType = 'old';
                $resume = 'Y';
                $start_test = $test_id;
            } else {
                $testType = 'new';
                $resume = 'N';
                $start_test = '0';
            }

            $totalMinute = $totalTimeForExam;
            $DisplayTime = $totalTimeForExam;
            $dispHr = floor($DisplayTime / 60);
            $dispmins = $DisplayTime % 60;
            if ($dispmins > 0) {
                $dispmin = $dispmins . ' minutes';
            } else {
                $dispmin = "";
            }
            if ($dispHr > 1) {
                $DisptimeInHour = $dispHr . ' hours ' . $dispmin;
            } else {
                $DisptimeInHour = $dispHr . ' hour ' . $dispmin;
            }
            if ($testType == "new" && $testTakenId == 0) // if test is new test
            {
                $totalDONE = $wpdb->get_var("SELECT count(*) from $PSY_TEST_GEN_TEST_TAKEN where user_id='$user_id' and exam_category_id='$exam_id'");
                /*------------ set the timer -------------*/
                $dateFormat = "d F Y -- g:i a";
                $targetDate = time() + ($totalMinute * 60); //Change the $totalMinute to however many minutes you want to countdown
                $actualDate = time();
                $secondsDiff = $targetDate - $actualDate;
                $remainingDay     = floor($secondsDiff / 60 / 60 / 24);
                $remainingHour    = floor(($secondsDiff - ($remainingDay * 60 * 60 * 24)) / 60 / 60);
                $remainingMinutes = floor(($secondsDiff - ($remainingDay * 60 * 60 * 24) - ($remainingHour * 60 * 60)) / 60);
                $remainingSeconds = floor(($secondsDiff - ($remainingDay * 60 * 60 * 24) - ($remainingHour * 60 * 60)) - ($remainingMinutes * 60));
                $totalTimeSpent = 0;
            }
            // $testIndex = array_search($testTakenId, $CompletedTest);
            // $totalDONE = $testIndex;
            // end calculation 

            $hours = floor($totalTimeForExam / 60);
            $minutes = $totalTimeForExam % 60;
            if ($minutes > 0) {
                $minute = $minutes . ' minutes';
            } else {
                $minute = "";
            }
            if ($hours > 1) {
                $timeInHour = $hours . ' hours ' . $minute;
            } else {
                $timeInHour = $hours . ' hour ' . $minute;
            }
            $typeExam = "Test";

    ?>
            <input type="hidden" value="<?php echo $remainingHour ?>" name="tt_hour" id="tt_hour" />
            <input type="hidden" value="<?php echo $remainingMinutes; ?>" name="tt_minute" id="tt_minute" />
            <input type="hidden" value="<?php echo $remainingSeconds; ?>" name="tt_second" id="tt_second" />
            <input type="hidden" value="<?php echo $totalTimeSpent; ?>" name="totalTimeSpent" id="totalTimeSpent" />
            <input type="hidden" name="subjectChoice" value="<?php echo $subjectChoice; ?>" id="subjectChoice">

            <link rel="stylesheet" type="text/css" href="tet_assign_test.css?v=<?php echo date('dmyhis'); ?>">

            <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700,900|Roboto:300,400,500,700,900&display=swap" title="default">

            <script src="js/jquery-1.12.4.js"></script>
            <script src="tet_assign_test.js?v=<?php echo date('dmyhis'); ?>"></script>
            <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
            <script src="js/bootstrap.min.js"></script>
            <link rel="stylesheet" href="css/font-awesome.min.css">
            <link rel="stylesheet" type="" href="css/toastr.min.css">
            <script src="js/toastr.min.js"></script>

            <input type="hidden" value="<?php echo ROOT_LINK; ?>" name="siteUrl" id="siteUrl" />
            <input type="hidden" value="<?php echo $app_status; ?>" id="app_status" />

            <!-- INSTRUCTION PAGE SECTION -->

            <section>
                <div class="container">
                    <div class="center" id="center" style="display: block;">

                        <div class="col-md-12 col-sm-12 col-xs-12 exam_name">
                            <h4 class="exam_title_dash" id="xam1">Test Name :
                                <span style="font-weight: 500;" id="name_eng">
                                    <?php echo $examName; ?>
                                </span>
                            </h4>
                        </div>

                        <div id="tet_loading_img" style="display: none;margin-top: 125px;text-align: center;">
                            <img src="<?php echo get_bloginfo('url') . '/aptitude-test/fancybox_loading.gif'; ?>" /><br>
                            <?php echo 'Loading...'; ?>..
                        </div>

                        <div class="col-md-12 col-sm-12 col-xs-12" id="instruction_area1">
                            <div id="eng">
                                <h4 class="gen_ins">General Instructions </h4>
                                <ol>
                                    <li>There are multiple options with each question.<br>
                                    </li>
                                    <li>Please choose your option by clicking the mouse.<br>
                                    </li>
                                    <li>There are three buttons / keys at the bottom.<br>
                                    </li>
                                    <li><button class="clr"> Clear Option </button> button will clear the selected option for that question.<br>
                                    </li>
                                    <li><button class="prv"> Previous </button> button will take you to the previous question.<br>
                                    </li>
                                    <li><button class="nxt"> Next </button> button will take you to the next question.<br>
                                    </li>
                                    <!-- <li><button class="rprt"> <i class="fa fa-exclamation-triangle"></i> </button> Report a Problem button will be helpful whenever you get stuck anywhere in the Test. Tell us the problem and we will help you.<br>
                                    </li> -->

                                    <li><button class="sub">Finish & Exit</button> This button will finish the test. Press only when you have completed all sub-tests.<br>
                                    </li>

                                    <li>We have <button class="das"> Questions Dashboard </button> on the right side of the page, once you click on it, you can view all your answered and un-answered questions.<br>
                                    </li>
                                    <li>You can go back or forward by clicking on the serial number of the question displayed on the Dashboard.<br>
                                    </li>
                                    <li>The answered questions will be displayed in green color and the un-answered questions will be displayed in grey color.<br>
                                    </li>
                                    <li>You can see the time clock on the top right corner of the exam page.<br>
                                    </li>
                                </ol>

                                <h4 class="gen_ins">Test Specific Instructions</h4>

                                <ol>
                                    <li>This test has few short sub-tests.Complete all sub tests to get the report.</li>
                                    <li>Each sub-test is a timed test.</li>
                                    <li>Each sub-test has a separate set of instructions to give you an idea about the type of questions asked in the test.</li>
                                    <li>Read instructions for each sub-test carefully.</li>
                                    <li>All questions are multiple choice questions.</li>
                                    <li>There is only 1 correct answer.</li>
                                    <li>There is NO negative marking.</li>
                                    <li>Your answers will be submitted automatically when the time for the sub-test is over and you will be directed to the instructions of the next sub-test.</li>
                                    <li>This test will help you know about your speciifc aptitudes in different areas. Please be honest and complete the test to the best of your ability.</li>

                                </ol>
                            </div>
                        </div>

                        <div class="col-md-12 col-sm-12 col-xs-12">
                            <div id="instruction_area2" style="display: none;" class="text-center">
                                <div style="text-align: center;padding-top: 95px;width: 100%;font-size: 14px;font-weight: bold; line-height: 2em;">
                                    Total allocated time (reading instructions + completing <?php echo sizeof($totalSections) ?> sections of the test) is <?php echo $totalTimeForExam ?> Minutes.
                                    <br>
                                    To complete <?php echo sizeof($totalSections) ?> sections of the test total time available is <?php echo $totalTimeForExam ?> min.
                                    <br>
                                    You must attempt this test in one go for accurate result.
                                </div>

                                <div style="text-align: center;padding-top: 10px;width: 100%">
                                    <a id="start_test" class="button noe" style="cursor:pointer;">Start</a>
                                </div>
                            </div>
                        </div>

                        <div class="container-fluid" id="checkbox_disc">
                            <div class="row">
                                <div class="mock_test_footer">
                                    <div class="col-md-12">
                                        <span id="chkMsg" style="color:#cc0000; width: 100%; float: left; font-size:15px;"></span>
                                        <h4 class="int_ti"><input id="chk_accept" class="check" type="checkbox" name="chk_accept" value="1"> <span id="instructions_eng"> I have read all Instructions.</span> <br />
                                            <span id="instructions_hnd" class="hide"> मैंने सभी निर्देश पढ़ लिए है|</span> </h4>
                                    </div>
                                    <div class="col-md-12">
                                        <a id="show_area2" style="cursor:pointer;">
                                            <button class="start_test">
                                                <span id="srt_eng">Start Test</span>
                                            </button>
                                        </a>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </section>

            <!-- END INSTRUCTION PAGE SECTION -->


            <!-- QUESTION AND ANSWER PAGE SECTION -->

            <section>
                <div id="question_div" style="display: none">
                    <div id="tet_loading_img" style="display: block;margin-top: 125px;text-align: center;">
                        <img src="<?php echo get_bloginfo('url') . '/aptitude-test/fancybox_loading.gif'; ?>" /><br>
                        <?php echo 'Loading...'; ?>..
                    </div>
                    <input type="hidden" value="<?php echo $exam_id; ?>" name="exam_category_id" id="exam_category_id" />
                    <input type="hidden" name="class_id" id="class_id" value="<?php echo $class_id; ?>">
                    <input type="hidden" name="test_view_type" id="test_view_type" value="<?php echo $validSubscription->test_type; ?>">
                    <input type="hidden" name="asign_ref_id" id="asign_ref_id" value="<?php echo $subscriptionId; ?>">
                    <input type="hidden" name="aptest_type" value="<?php echo $testType; ?>" id="test_type">
                    <input type="hidden" name="resume" id="resume" value="<?php echo $resume ?>">
                    <input type="hidden" name="old_test" id="old_test" value="<?php echo $start_test ?>">
                </div>
            </section>

            <!-- QUESTION AND ANSWER PAGE SECTION -->


        <?php
        } // end of valid subscription if
        else {
        ?>
            <script>
                window.location.href = 'http://www.thinkemu.com'
            </script>
        <?php
        }
        // }
        // else{
        ?>
        <!-- <script>window.location.href='/emu-aptitude-test/test-report?testId=<?php //echo $checkTest 
                                                                                    ?>'</script> -->
    <?php
        //}
    } // end of check login if
    else {
    ?>
        <script>
            window.location.href = 'http://www.thinkemu.com'
        </script>
    <?php
    }
    ?>


</body>