0byt3m1n1
Path:
/
data
/
51
/
2
/
82
/
137
/
2408789.shuffle
/
user
/
2641263
/
htdocs
/
contest
/
uploads
/
[
Home
]
File: index.php
<?php $local_debug = true; $status = array ( 0 => 'new', 1 => 'opened', 2 => 'disqualified', 3 => 'not selected', 4 => 'finalist', 5 => 'winner', ); require('../../wp-load.php'); // set global debug options if ($local_debug) { $wpdb->show_errors(); } function assignPageTitle(){ return "Contest Entries - Union Bank"; } add_filter('wp_title', 'assignPageTitle'); function human_file_size($size) { $filesizename = array(" Bytes", " KB", " MB", " GB", " TB", " PB", " EB", " ZB", " YB"); return round($size/pow(1024, ($i = floor(log($size, 1024)))), 2) . $filesizename[$i]; } if (isset($_GET['del'])) { unlink($viewdir.'/'.$_GET['del']); } date_default_timezone_set('America/New_York'); get_header(); ?> <article> <h1 class="entry-title">Contest Entries</h1> <?php if (is_user_logged_in() && current_user_can('publish_pages')) { if (isset($_REQUEST['id']) && $_REQUEST['id']) { $participant = $wpdb->get_results(' SELECT * FROM ub_contest WHERE id = '. esc_sql($_REQUEST['id']). ' ', ARRAY_A); $entry = $participant[0]; // convert new to opened if (isset($_REQUEST['status']) && $_REQUEST['status']) { $wpdb->update( 'ub_contest', array ('status' => $_REQUEST['status']), array ('ID' => $entry['id']), '%d', '%d' ); $entry['status'] = $_REQUEST['status']; } else if ($entry['status'] == 0) { $wpdb->update( 'ub_contest', array ('status' => 1), array ('ID' => $entry['id']), '%d', '%d' ); $entry['status'] = 1; } echo '<ul>'; echo '<li><a href=".">Back to List</a></li>'; echo '</ul>'; echo '<h2>Participant</h2>'; echo '<table>'; echo '<tr>'; echo '<td>Name</td>'; echo '<td>'. $entry['name']. '</td>'; echo '</tr>'; echo '<tr>'; echo '<td>Address</td>'; echo '<td>'. $entry['address']. '<br />'; echo $entry['city']. ', '. $entry['state']. ' '. $entry['zip']. '</td>'; echo '</tr>'; echo '<tr>'; echo '<td>E-mail</td>'; echo '<td><a href="mailto:'. $entry['e-mail']. '">'. $entry['e-mail']. '</a></td>'; echo '</tr>'; echo '<tr>'; echo '<td>Phone</td>'; echo '<td>'. $entry['phone']. '</td>'; echo '</tr>'; echo '</table>'; echo '<h2>Photo</h2>'; if (pathinfo($entry['p_filename'], PATHINFO_EXTENSION)) { echo '<p><a href="'. $entry['p_filename']. '">'; echo wp_get_attachment_image( $entry['p_filename'], 'full' ); echo '</a></p>'; } echo '<table>'; echo '<tr>'; echo '<td>Link</td>'; echo '<td><a href="'. $entry['p_filename']. '">'. $entry['p_filename']. '</a></td>'; echo '</tr>'; $size = getimagesize ($entry['p_filename']); echo '<tr>'; echo '<td>Dimensions</td>'; echo '<td>'; echo 'width: '. $size[0]. 'px <br />'; echo 'height: '. $size[1]. 'px <br />'; $wppi = $size[0]/10; $hppi = $size[1]/8; $minppi = min($wppi, $hppi); echo 'Effective resolution (at 10"×8"): '. $minppi. ' PPI'; if ($size[0] < 3000 || $size[1] < 2400) { echo '<br /><strong>This image does not meet minimum size requirements.</strong>'; } echo '</td>'; echo '</tr>'; echo '<tr>'; echo '<td>Title</td>'; echo '<td>'. $entry['p_title']. '</td>'; echo '</tr>'; echo '<tr>'; echo '<td>Location</td>'; echo '<td>'. $entry['p_loc']. '</td>'; echo '</tr>'; echo '<tr>'; echo '<td>Description</td>'; echo '<td>'. $entry['p_desc']. '</td>'; echo '</tr>'; echo '<tr>'; echo '<td>Agree to release</td>'; echo '<td>'; if ($entry['agree']) { echo 'Yes'; } else { echo 'No'; } echo '</td>'; echo '</tr>'; echo '</table>'; echo '<h2>Meta</h2>'; echo '<table>'; echo '<tr>'; echo '<td>Status</td>'; echo '<td>'. $status[$entry['status']]. '</td>'; echo '</tr>'; echo '<tr>'; echo '<td>Timestamp</td>'; echo '<td>'. $entry['timestamp']. '</td>'; echo '</tr>'; echo '<tr>'; echo '<td>IP address</td>'; echo '<td>'. $entry['IP']. '</td>'; echo '</tr>'; echo '</table>'; echo '<h2>Actions</h2>'; echo '<ul>'; foreach ($status as $s_key => $s_val) { echo '<li><a href="?id='. $_REQUEST['id']. '&status='. $s_key. '">Set status to '. $s_val. '</li>'; } echo '</ul>'; echo '<ul>'; echo '<li><a href=".">Back to List</a></li>'; echo '</ul>'; } else { $all_participants = $wpdb->get_results(' SELECT id, name, status, timestamp FROM ub_contest ORDER BY timestamp DESC ', ARRAY_A); ?> <p>Total entries: <?php echo count($all_participants) ?></p> <p><a href="db-export.php">Export database as CSV table (Excel)</a></p> <p>Select an entry to view information. (Generated <?php echo date('Y-m-d H:i:s') ?>)</p> <table> <?php foreach ($all_participants as $row) { echo '<tr>'; echo '<td><a href="?id='. $row['id']. '">'. htmlentities($row['name']). '</a></td>'; echo '<td>'. $status[$row['status']]. '</td>'; echo '<td>'. date('Y-m-d H:i:s',strtotime($row['timestamp']. ' UTC')). '</td>'; echo '</tr>'; } ?> <tr></tr> </table> <?php } } else { ?> <p>These tools are available only to logged-in site administrators.</p> <?php wp_login_form(); ?> <?php } ?> </article> <style> table { width: 100%; display: table; } tbody { display: table-row-group; } </style> <?php get_footer();