Exemplo n.º 1
0
        $query = "select * from users";
    } else {
        die;
    }
    $result = $fw->query($query);
    if ($result) {
        $num_results = $result->num_rows;
        echo "<p>Number of matches found: " . $num_results . "</p>";
        if ($num_results > 0) {
            $output = "\n\n\t\t<table class=\"table-striped table-style table-hover search-results\">\n" . "\t\t\t<thead>\n" . "\t\t\t\t<tr>\n" . "\t\t\t\t\t<th>ID</th>\n" . "\t\t\t\t\t<th>Username</th>\n" . "\t\t\t\t\t<th>Full Name</th>\n" . "\t\t\t\t\t<th>Email</th>\n" . "\t\t\t\t\t<th>is_user</th>\n" . "\t\t\t\t\t<th>is_admin</th>\n" . "\t\t\t\t\t<th>is_super</th>\n" . "\t\t\t\t</tr>\n" . "\t\t\t</thead>\n" . "\t\t\t<tbody>\n";
            for ($i = 0; $i < $num_results; $i++) {
                $row = $result->fetch_assoc();
                $output .= "\t\t\t\t<tr>\n" . "\t\t\t\t\t<td>" . $fw->clean_output($row['id']) . "</td>\n" . "\t\t\t\t\t<td>" . $fw->clean_output($row['username']) . "</td>\n" . "\t\t\t\t\t<td>" . $fw->clean_output($row['fullname']) . "</td>\n" . "\t\t\t\t\t<td>" . $fw->clean_output($row['email']) . "</td>\n" . "\t\t\t\t\t<td>" . $fw->clean_output($row['is_user']) . "</td>\n" . "\t\t\t\t\t<td>" . $fw->clean_output($row['is_admin']) . "</td>\n" . "\t\t\t\t\t<td>" . $fw->clean_output($row['is_superadmin']) . "</td>\n" . "\t\t\t\t</tr>\n";
            }
            $output .= "\t\t\t</tbody>\n" . "\t\t</table>\n";
            echo $output;
            $result->free();
        }
    } else {
        echo "An error occured while trying to perform your search.  Please try again.";
    }
    $fw->close();
    ?>
	</body>
</html>

<?php 
} else {
    echo "You must be logged in to view this page.";
    header("Location: login.php");
}