Beispiel #1
0
    $query;
    if ($_SESSION['is_admin'] || $_SESSION['is_superadmin']) {
        $query = "select * from users";
    } else {
        die;
    }
    $result = $db->query($query);
    if ($result) {
        $num_results = $result->num_rows;
        $fw = new framework();
        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.";
    }
    $db->close();
    ?>
	</body>
</html>

<?php 
} else {
        unset($_SESSION['search_go']);
        exit;
    } else {
        $search = "Based on the default search criteria <br />";
        $query = "select * from scales where status != 'Complete' AND status != 'Delivered' AND status != 'Non-repairable' AND status != 'Replaced the Scale'";
    }
    $result = $db->query($query);
    if ($result) {
        $num_results = $result->num_rows;
        $fw = new framework();
        echo "\n\t\t\t\t<p>Number of matches found: " . $num_results . "</p>\n\t\t\t\t{$search}";
        if ($num_results > 0) {
            $output = "\n\n\t\t<table id=\"sort\" 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>~</th>\n" . "\t\t\t\t\t<th>ID</th>\n" . "\t\t\t\t\t<th>Status</th>\n" . "\t\t\t\t\t<th>Date</th>\n" . "\t\t\t\t\t<th>Customer Name</th>\n" . "\t\t\t\t\t<th>Tag</th>\n" . "\t\t\t\t\t<th>Indicator Manufact</th>\n" . "\t\t\t\t\t<th>Indicator Model</th>\n" . "\t\t\t\t\t<th>Indicator Serial</th>\n" . "\t\t\t\t\t<th>Capacity</th>\n" . "\t\t\t\t\t<th>Divisions</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>" . "<a href=\"viewScale.php?id=" . $row['id'] . "\" class=\"button\">View</a>" . "</td>\n" . "\t\t\t\t\t<td>" . $fw->clean_output($row['id']) . "</td>\n" . "\t\t\t\t\t<td>" . $fw->clean_output($row['status']) . "</td>\n" . "\t\t\t\t\t<td>" . $fw->clean_output(substr($row['date'], 0, 10)) . "</td>\n" . "\t\t\t\t\t<td>" . $fw->clean_output($row['companyname']) . "</td>\n" . "\t\t\t\t\t<td>" . $fw->clean_output($row['indicator_tag']) . "</td>\n" . "\t\t\t\t\t<td>" . $fw->clean_output($row['indicator_manu']) . "</td>\n" . "\t\t\t\t\t<td>" . $fw->clean_output($row['indicator_model']) . "</td>\n" . "\t\t\t\t\t<td>" . $fw->clean_output($row['indicator_serial']) . "</td>\n" . "\t\t\t\t\t<td>" . $fw->clean_output($row['scale_capacity']) . "</td>\n" . "\t\t\t\t\t<td>" . $fw->clean_output($row['scale_divisions']) . "</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.";
    }
    $db->close();
    ?>
	</body>
</html>

<?php 
} else {