:: **Zploit** v1.0 | Current Path: **/home/kreativepixelz/www/crm/quatation/**
:: Editing File: vcard_media_list.php
<?php // =============================== // PAGE TITLE // =============================== $page_title = "VCard Media"; include 'header.php'; include 'breadcrumb.php'; include 'menu.php'; ?> <div class="page-body"> <div class="container-fluid"> <div class="row"> <div class="col-sm-12"> <div class="card"> <div class="row"> <!-- =============================== PAGE HEADING =============================== --> <div class="col-sm-10"> <div class="card-header pb-0 card-no-border"> <h2>VCard Media</h2> </div> </div> <!-- =============================== ADD BUTTON =============================== --> <div class="col-sm-2"> <div class="card-header pb-0 card-no-border text-end"> <a href="vcard_media_add.php" class="btn btn-primary btn-sm"> <i class="fa fa-plus"></i> Add Media </a> </div> </div> <!-- =============================== TABLE =============================== --> <div class="card-body"> <div class="dt-ext table-responsive"> <table class="display" id="export-button"> <thead> <tr> <th>#</th> <th>VCard</th> <th>Type</th> <th>Preview</th> <th>Status</th> <th>Action</th> </tr> </thead> <tbody> <?php $sr = 1; $sql = " SELECT m.*, v.full_name, v.card_slug FROM vcard_media m LEFT JOIN vcards v ON v.id = m.vcard_id ORDER BY m.created_at DESC "; $result = mysqli_query($conn, $sql); if ($result && mysqli_num_rows($result) > 0) { while ($row = mysqli_fetch_assoc($result)) { // Get VCard name $vcard_q = mysqli_query( $conn, "SELECT full_name FROM vcards WHERE id='{$row['vcard_id']}'" ); $vcard = mysqli_fetch_assoc($vcard_q); // Create slug $slug = strtolower(trim( preg_replace('/[^A-Za-z0-9-]+/', '-', $vcard['full_name']) )); // Base directory $base_dir = "uploads/vcard/" . $slug . "/media/"; /* STATUS */ $status = ($row['status'] == 1) ? "<span class='badge bg-success'>Active</span>" : "<span class='badge bg-danger'>Inactive</span>"; /* PREVIEW */ $preview = "<span class='text-muted'>N/A</span>"; if (!empty($row['image_path'])) { // $file_url = "/kreativecrm/uploads/vcard/{$}/media/{$row['image_path']}"; $file_url = "{$base_dir}{$row['image_path']}"; $preview = "<img src='{$file_url}' style='height:50px;border-radius:6px;'>"; } /* URL */ $url = !empty($row['url']) ? "<a href='{$row['url']}' target='_blank'>Open Link</a>" : "<span class='text-muted'>—</span>"; echo "<tr>"; echo "<td>{$sr}</td>"; echo "<td>" . htmlspecialchars($row['full_name'] ?? 'N/A') . "</td>"; echo "<td>" . strtoupper($row['type']) . "</td>"; echo "<td>{$preview}</td>"; echo "<td>{$status}</td>"; echo "<td class='text-center'> <a href='vcard_media_edit.php?id={$row['id']}' class='btn btn-info btn-sm me-1'> <i class='fa fa-pencil'></i> </a> <a href='vcard_media_delete.php?id={$row['id']}' class='btn btn-danger btn-sm' onclick=\"return confirm('Delete this media item?');\"> <i class='fa fa-trash'></i> </a> </td>"; echo "</tr>"; $sr++; } } else { echo "<tr> <td colspan='8' class='text-center text-muted'> No media found </td> </tr>"; } ?> </tbody> </table> </div> </div> </div> </div> </div> </div> </div> </div> <?php include 'footer.php'; ?>