Find this useful? Enter your email to receive occasional updates for securing PHP code.

Signing you up...

Thank you for signing up!

PHP Decode

<?php include_once('commen.php'); $con = mysqli_connect("localhost", "root", "", "pepa..

Decoded Output download

<?php 
include_once('commen.php'); 
 
$con = mysqli_connect("localhost", "root", "", "pepar_web"); 
if (!$con) { 
    die("Connection failed: " . mysqli_connect_error()); 
} 
 
// Updated query to include a join with the topics table 
$questionQuery = " 
    SELECT  
        questions.id,  
        topics.name AS name,  
        questions.question,  
        questions.marks  
    FROM questions  
    JOIN topics ON questions.topic_id = topics.id 
"; 
 
$questionResult = mysqli_query($con, $questionQuery); 
if (!$questionResult) { 
    die("Error fetching questions: " . mysqli_error($con)); 
} 
?> 
 
<div class="content-wrapper"> 
    <section class="content-header"> 
        <div class="container-fluid"> 
            <div class="row mb-2"> 
                <div class="col-sm-12"> 
                    <ol class="breadcrumb float-sm-right"> 
                        <a href="addQuestions.php" class="btn btn-primary">Add Question</a> 
                    </ol> 
                </div> 
            </div> 
        </div> 
    </section> 
 
    <section class="content"> 
        <div class="container-fluid"> 
            <h3>Questions</h3> 
            <table class="table table-bordered"> 
                <thead> 
                    <tr> 
                        <th>Question ID</th> 
                        <th>Topic</th> 
                        <th>Question</th> 
                        <th>Marks</th> 
                    </tr> 
                </thead> 
                <tbody> 
                    <?php if (mysqli_num_rows($questionResult) > 0): ?> 
                        <?php while ($row = mysqli_fetch_assoc($questionResult)): ?> 
                            <tr> 
                                <td><?= htmlspecialchars($row['id']) ?></td> 
                                <td><?= htmlspecialchars($row['name']) ?></td> 
                                <td><?= htmlspecialchars($row['question']) ?></td> 
                                <td><?= htmlspecialchars($row['marks']) ?></td> 
                            </tr> 
                        <?php endwhile; ?> 
                    <?php else: ?> 
                        <tr> 
                            <td colspan="4">No questions found</td> 
                        </tr> 
                    <?php endif; ?> 
                </tbody> 
            </table> 
        </div> 
    </section> 
</div> 
 
<?php 
include_once('footer.php'); 
mysqli_close($con); 
?> 

Did this file decode correctly?

Original Code

<?php
include_once('commen.php');

$con = mysqli_connect("localhost", "root", "", "pepar_web");
if (!$con) {
    die("Connection failed: " . mysqli_connect_error());
}

// Updated query to include a join with the topics table
$questionQuery = "
    SELECT 
        questions.id, 
        topics.name AS name, 
        questions.question, 
        questions.marks 
    FROM questions 
    JOIN topics ON questions.topic_id = topics.id
";

$questionResult = mysqli_query($con, $questionQuery);
if (!$questionResult) {
    die("Error fetching questions: " . mysqli_error($con));
}
?>

<div class="content-wrapper">
    <section class="content-header">
        <div class="container-fluid">
            <div class="row mb-2">
                <div class="col-sm-12">
                    <ol class="breadcrumb float-sm-right">
                        <a href="addQuestions.php" class="btn btn-primary">Add Question</a>
                    </ol>
                </div>
            </div>
        </div>
    </section>

    <section class="content">
        <div class="container-fluid">
            <h3>Questions</h3>
            <table class="table table-bordered">
                <thead>
                    <tr>
                        <th>Question ID</th>
                        <th>Topic</th>
                        <th>Question</th>
                        <th>Marks</th>
                    </tr>
                </thead>
                <tbody>
                    <?php if (mysqli_num_rows($questionResult) > 0): ?>
                        <?php while ($row = mysqli_fetch_assoc($questionResult)): ?>
                            <tr>
                                <td><?= htmlspecialchars($row['id']) ?></td>
                                <td><?= htmlspecialchars($row['name']) ?></td>
                                <td><?= htmlspecialchars($row['question']) ?></td>
                                <td><?= htmlspecialchars($row['marks']) ?></td>
                            </tr>
                        <?php endwhile; ?>
                    <?php else: ?>
                        <tr>
                            <td colspan="4">No questions found</td>
                        </tr>
                    <?php endif; ?>
                </tbody>
            </table>
        </div>
    </section>
</div>

<?php
include_once('footer.php');
mysqli_close($con);
?>

Function Calls

None

Variables

None

Stats

MD5 e407468c9be5aa01c07c4c4dfb30e835
Eval Count 0
Decode Time 76 ms