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/content-sp/work-sp/oly_wiris_image_sec.php
<?php
ini_set('display_errors', 1);
error_reporting(E_ALL);
include 'config.php';
$mType = 'oly';

include 'str_replace_type.php';
$protocol = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
$root_link = $protocol . $_SERVER['HTTP_HOST'] . '/';
$offset = $_REQUEST['off'] != '' ? $_REQUEST['off'] : '1';


// $count = $conn->query("SELECT count(sqm.id) as c FROM csp_sp_question_medium_wise as sqm LEFT JOIN csp_sp_question as sq on sq.question_id=sqm.question_id WHERE  (sqm.question_statement LIKE '%showimage.php%' OR sqm.option_1 LIKE '%showimage.php%' OR sqm.option_2 LIKE '%showimage.php%' OR sqm.option_3 LIKE '%showimage.php%' OR sqm.option_4 LIKE '%showimage.php%' OR sqm.question_solution LIKE '%showimage.php%') and sq.question_of LIKE '%csc-olympiad%'");
// $f = $count->fetch_assoc();
// echo $f['c'];

// die();


$query = $conn->query("SELECT sqm.id,sqm.question_statement,sqm.option_1,sqm.option_2,sqm.option_3,sqm.option_4,sqm.question_solution FROM csp_sp_question_medium_wise as sqm LEFT JOIN csp_sp_question as sq on sq.question_id=sqm.question_id WHERE (sqm.question_statement LIKE '%showimage.php%' OR sqm.option_1 LIKE '%showimage.php%' OR sqm.option_2 LIKE '%showimage.php%' OR sqm.option_3 LIKE '%showimage.php%' OR sqm.option_4 LIKE '%showimage.php%' OR sqm.question_solution LIKE '%showimage.php%') and sq.question_of LIKE '%csc-olympiad%' limit $offset,500");

?>
<table border="1">
    <tr>
        <th>S.no</th>
        <th>Question Id</th>
        <th>Statement</th>
        <th>Option 1</th>
        <th>Option 2</th>
        <th>Option 3</th>
        <th>Option 4</th>
        <th>Sol</th>
        <!-- <th>Src</th>
        <th>PathRead</th> -->
    </tr>
    <?php $i = 1 + $offset;
    foreach ($query as $q) {

        $question = str_replace('../', $root_link, $q['question_statement']);
        $question = str_replace($spaceArray, $replaceSpaceArray, $question);


        $question_solution = str_replace('../', $root_link, $q['question_solution']);
        $question_solution = str_replace($spaceArray, $replaceSpaceArray, $question_solution);


        $option1 = str_replace('../', $root_link, $q['option_1']);
        $option1 = str_replace($spaceArray, $replaceSpaceArray, $option1);
        $option2 = str_replace('../', $root_link, $q['option_2']);
        $option2 = str_replace($spaceArray, $replaceSpaceArray, $option2);

        if ($q['option_3']) {
            $option3 = str_replace('../', $root_link, $q['option_3']);
            $option3 = str_replace($spaceArray, $replaceSpaceArray, $option3);
        } else {
            $option3 = "";
        }

        if ($q['option_4']) {
            $option4 = str_replace('../', $root_link, $q['option_4']);
            $option4 = str_replace($spaceArray, $replaceSpaceArray, $option4);
        } else {
            $option4 = "";
        }

        // $doc = new DOMDocument();
        // $doc->loadHTML($question);
        // $xpath = new DOMXPath($doc);
        // $imgSrc = $xpath->evaluate("string(//img/@src)");
    ?>
        <tr>
            <td><?php echo $i; ?></td>
            <td>
                <a href="nqb_question_edit_secondary?action=edit&quesId=<?php echo $q['id']; ?>&mType=oly" target="_blank" rel="noopener noreferrer">
                    <?php echo $q['id']; ?>
                </a>
            </td>
            <td><?php echo $question; ?></td>
            <td><?php echo $option1; ?></td>
            <td><?php echo $option2; ?></td>
            <td><?php echo $option3; ?></td>
            <td><?php echo $option4; ?></td>
            <td><?php echo $question_solution; ?></td>
            <!-- <td><?php //echo $imgSrc; 
                        ?></td>
            <td><?php //readfile($imgSrc); 
                ?></td> -->
        </tr>
    <?php $i++;
    } ?>
</table>

<style>
    table {
  border: 1px solid #ccc;
  border-collapse: collapse;
  margin: 0;
  padding: 0;
  width: 100%;
  table-layout: fixed;
}

table caption {
  font-size: 1.5em;
  margin: .5em 0 .75em;
}

table tr {
  background-color: #f8f8f8;
  border: 1px solid #ddd;
  padding: .35em;
}

table th,
table td {
  padding: .625em;
  text-align: center;
}

table th {
  font-size: .85em;
  letter-spacing: .1em;
  text-transform: uppercase;
}

@media screen and (max-width: 600px) {
  table {
    border: 0;
  }

  table caption {
    font-size: 1.3em;
  }
  
  table thead {
    border: none;
    clip: rect(0 0 0 0);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
  }
  
  table tr {
    border-bottom: 3px solid #ddd;
    display: block;
    margin-bottom: .625em;
  }
  
  table td {
    border-bottom: 1px solid #ddd;
    display: block;
    font-size: .8em;
    text-align: right;
  }
  
  table td::before {
    /*
    * aria-label has no advantage, it won't be read inside a table
    content: attr(aria-label);
    */
    content: attr(data-label);
    float: left;
    font-weight: bold;
    text-transform: uppercase;
  }
  
  table td:last-child {
    border-bottom: 0;
  }
}
/* general styling */
body {
  font-family: "Open Sans", sans-serif;
  line-height: 1.25;
}
</style>