HEX
Server: Apache
System: Linux msm5694.mjhst.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: camjab_ssh (1000)
PHP: 5.3.29
Disabled: NONE
Upload Files
File: /home/httpd/html/naced.com/public_html/admin/performers.php
<?php
require "header.php";

$users_processed = 0;

if (isset($_POST['list']) && count($_POST['list']) > 0) {
    foreach ($_POST['list'] as $i) {
		switch ($_POST['action']) {
			case 'delete':
				$i = explode("|",mysqli_real_escape_string($dblink,$i)); 
				dbQuery("UPDATE performers SET status = 0, deleted = 1 WHERE `username` = '{$i[0]}' AND site = '{$i[1]}'");
				$users_processed++;
			break;
			case 'removeRecord':
				$i = explode("|",mysqli_real_escape_string($dblink,$i)); 
				dbQuery("DELETE FROM performers WHERE `username` = '{$i[0]}' AND site = '{$i[1]}'");
				$users_processed++;
			break;
		}
 
    }
}

if (isset($_POST['action']) && $users_processed > 0) {
    if ($_POST['action'] === 'delete') {
        $messages[] = "<div>$users_processed performers marked as deleted</div>";
    } 
}

$page = (isset($_GET['page']) && is_numeric($_GET['page'])) ? (int) $_GET['page'] : 1;
$max_results = (isset($_GET['setmax']) && $_GET['setmax'] > 0) ? (int) $_GET['setmax'] : 100;
$from = ($page * $max_results) - $max_results;
?>

<div class="content-page">

    <div class="header-area">

        <div class="breadcrumbs">  
            <a href="index.php">Admin Home</a>
            <?php
            $usersTitle = "Performers";
            $usersLink = "";
            ?>
            <span><a href="users.php<?php echo $usersLink; ?>">Manage <?php echo $usersTitle; ?></a></span>  
        </div>
    </div>    
    <div class="content-outer">

        <h2>Manage<strong>Performers</strong></h2>

        <div class="notification info">To find the performer you are looking for faster, you can enter either a whole or partial username into the search box below.</div>

        <?php if (is_array($errors) && count($errors) > 0) { ?>
            <div class="notification error"><?php echo implode('<br>', $errors); ?></div>
        <?php } ?>        

        <?php if (is_array($messages) && count($messages) > 0) { ?>
            <div class="notification success"><?php echo implode('<br>', $messages); ?></div>
        <?php } ?>

        <?php echo getMessages(); ?>

        <div class="content-inner">

            <form method="GET" action="" class="form" novalidate autocomplete="off">
                <table class="pagetable"> 
                    <thead>
                        <tr>
                            <th colspan="2">Search Performers</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td>Username</td>
                            <td><input type="text" name="q" value="<?php echo htmlentities($_GET['q']); ?>" /></td>
                        </tr>
						<tr>
							<td>API Source</td>
							<td>
								<select name="site">
									<option value="">--All APIs--</option>
									<? $result1 = dbQuery("SELECT * FROM paysites ORDER BY name ASC",false); ?>
									<? foreach($result1 as $row1) { ?>
										<option<? echo ($_REQUEST['site'] == $row1['record_num']) ? ' selected' : ''; ?> value="<? echo $row1['record_num']; ?>"><? echo $row1['name']; ?></option>
									<? } ?>
								</select>
							</td>
						</tr>
						<tr>
							<td>Status</td>
							<td>
								<select name="status">
									<option value="">--All--</option>
									<option<? echo ($_REQUEST['status'] == 'enabled') ? ' selected' : ''; ?> value="enabled">Enabled</option>
									<option<? echo ($_REQUEST['status'] == 'disabled') ? ' selected' : ''; ?> value="disabled">Disabled</option>
									<option<? echo ($_REQUEST['status'] == 'deleted') ? ' selected' : ''; ?> value="deleted">Deleted</option>
								</select>
							</td>
						</tr>
                        <tr class="item submit">
                            <td colspan="2">
                                <button type="submit" class="btn action-search">Search</button>
                            </td>
                        </tr>
                    </tbody>
                </table>
            </form>

            <form method="POST" action="" class="form" novalidate autocomplete="off">
                <table class="pagetable">
                    <thead>
                        <tr>
                            <th class="thumb">Thumb</th>
                            <th>Name</th>
                            <th>Site</th>
							<th>Status</th>
                            <th></th>
                            <th style="width:50px">
                                <label for="check-select-all-1" class="checkbox">
                                    <input type="checkbox" name="select_all" value="1" data-items="list[]" id="check-select-all-1">
                                    <i></i>
                                </label>
                            </th>
                        </tr>
                    </thead>
                    <?php
                    $where = '';
                    if ($_GET['q'] != "") {
                        $q = mysqli_real_escape_string($dbconn, $_GET['q']);
                        $where .= " AND (`username` LIKE '%$q%')";
                    }
					if($_GET['site']) { 
						$where .= " AND (`site` = '".(int)$_GET['site']."')";
					}
					
					if($_GET['status'] == 'enabled') { 
						$where .= " AND enabled = 1 AND deleted = 0";
					}
					if($_GET['status'] == 'disabled') { 
						$where .= " AND enabled = 0";
					}
					if($_GET['status'] == 'deleted') { 
						$where .= " AND deleted = 1";
					}
                    $result = dbQuery("SELECT performers.*, (SELECT paysites.name FROM paysites WHERE performers.site = paysites.record_num) AS paysiteName FROM `performers` WHERE 1=1 $where ORDER BY username ASC LIMIT $from,$max_results", false);
                    $total_results = dbValue("SELECT COUNT(*) AS `count` FROM performers WHERE 1=1 $where", 'count');
                    $total_pages = ceil($total_results / $max_results);
                    ?>
                    <tbody>
                        <?php if (!is_array($result) || count($result) == 0) { ?>
                            <tr><td colspan="4"><div class="notification alert">No performers found</div></td></tr>
                        <?php } else { ?>
                            <?php foreach ($result as $row) { ?>
                                <tr>
                                    <td><img src='<? echo $row['image_url']; ?>' style='max-width: 200px;' onerror="this.src='<? echo $basehttp; ?>/core/images/placeholder.jpg'"></td>
                                    <td><?php echo $row['username']; ?></td>
                                    <td><?php echo $row['paysiteName']; ?></td>
                                    <td>
									<?php 
									if($row['deleted'] == 1) { 
										echo '<strong>Deleted</strong>'; 
									} else { 
										if($row['enabled'] == 1) { 
											echo 'Enabled';
										} else { 
											echo 'Disabled'; 
										}
									}
									?>
									</td>
                                    <td class="options">
                                        <a href="edit_performer.php?id=<?php echo $row['username']; ?>&site=<?php echo $row['site']; ?>" title="Edit" class="btn btn-xs btn-orange"><i class="ion ion-edit icon-edit"></i></a>
                                    </td>
                                    <td>
                                        <label class="checkbox">
                                            <input type="checkbox" name="list[]" value="<?php echo $row['username']; ?>|<?php echo $row['site']; ?>" id="ids-<?php echo $row['record_num']; ?>"><i></i>
                                        </label>
                                    </td>
                                </tr>
                            <?php } ?>
                        <?php } ?>
                        <tr class="item submit">
                            <td colspan="4">

                                <?php if (is_array($result) && count($result) > 0) { ?>

                                    <div class="processing-option short">
                                        <select name="action" data-items="list[]" data-select-toggle="action-submit" class="processing-option short">
                                            <option value="delete">Delete</option>
											<option value="removeRecord">Remove Database Record</option>
                                          
                                        </select>
                                    </div>

                                   

                                   

                                    <button type="submit" class="btn action-process">Process Selected</button>

                                <?php } ?>

                            </td>
                        </tr>
                    </tbody>
                </table>
            </form>
            <div id="adminPagination"><?php echo showAdminPagination($total_pages); ?></div>
        </div>
    </div>

</div>

<?php require "footer.php"; ?>