0byt3m1n1
Path:
/
data
/
51
/
2
/
82
/
137
/
2408789.shuffle
/
user
/
2641263
/
htdocs
/
contest
/
[
Home
]
File: judging.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) { error_reporting(E_ALL); ini_set('display_errors', 1); ini_set('display_startup_errors', 1); ini_set("gd.jpeg_ignore_warning", 1); $wpdb->show_errors(); } function assignPageTitle(){ return "Contest Entries - Union Bank"; } add_filter('wp_title', 'assignPageTitle'); date_default_timezone_set('America/New_York'); function make_thumb($src, $dest, $desired_width) { /* read the source image */ $source_image = imagecreatefromjpeg($src); if ($source_image) { $width = imagesx($source_image); $height = imagesy($source_image); /* find the "desired height" of this thumbnail, relative to the desired width */ $desired_height = floor($height * ($desired_width / $width)); /* create a new, "virtual" image */ $virtual_image = imagecreatetruecolor($desired_width, $desired_height); /* copy source image at a resized size */ imagecopyresampled($virtual_image, $source_image, 0, 0, 0, 0, $desired_width, $desired_height, $width, $height); /* create the physical thumbnail image to its destination */ imagejpeg($virtual_image, $dest); } } get_header(); ?> <article> <h1 class="entry-title">Contest Entries</h1> <?php $all_participants = $wpdb->get_results(' SELECT id, name, status, timestamp, p_filename FROM ub_contest WHERE status = 1 ORDER BY timestamp DESC ', ARRAY_A); ?> <p>Total entries: <?php echo count($all_participants) ?></p> <p>Select an entry to view larger.</p> <ul class="popup-gallery"> <?php foreach ($all_participants as $row) { echo '<li><a href="uploads/'. $row['p_filename']. '" title="'. $row['id']. '">'; $thfile = $_SERVER['DOCUMENT_ROOT']. '/contest/thumbs/th_'. $row['p_filename']; $fullfile = $_SERVER['DOCUMENT_ROOT']. '/contest/uploads/'. $row['p_filename']; $ext = strtolower(pathinfo($fullfile, PATHINFO_EXTENSION)); if ($ext == 'jpg' || $ext == 'jpeg') { if (!file_exists($thfile)) { make_thumb($fullfile, $thfile, 160); } echo '<img src="thumbs/th_'. $row['p_filename']. '" />'; } else { echo '[Image '. $row['id']. ']'; } echo '</a></li>'; } ?> <tr></tr> </ul> </article> <style> .popup-gallery { padding: 0; list-style: none; } .popup-gallery li { display: inline-block; width: 10em; vertical-align: top; margin-left: 1em; } </style> <?php get_footer();