HEX
Server: Apache
System: Linux www3.pit.tblive.com 5.14.0-687.38.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Aug 12 17:19:12 EDT 2026 x86_64
User: awaldron (1020)
PHP: 8.1.34
Disabled: exec,passthru,shell_exec,system
Upload Files
File: /home/awaldron/public_html/archive/ras/admin/gallery/uploadify/uploadify.php
<?php
include "../../../f_db.php";
dbconnect();

define('TN_WIDTH',80);
define('LG_WIDTH',680);

function getExtension($str) {

         $i = strrpos($str,".");
         if (!$i) { return ""; } 
         $l = strlen($str) - $i;
         $ext = substr($str,$i+1,$l);
         return $ext;
 }
 
 function genRandomString() {
    $length = 12;
    $characters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
    $string = '';    
    for ($p = 0; $p < $length; $p++) {
        $string .= $characters[mt_rand(0, strlen($characters))];
    }
    return $string;
}
 
/*
Uploadify v2.1.4
Release Date: November 8, 2010

Copyright (c) 2010 Ronnie Garcia, Travis Nickels

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
if (!empty($_FILES)) {
	$tempFile = $_FILES['Filedata']['tmp_name'];
	$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
	$targetFile =  str_replace('//','/',$targetPath) . $_FILES['Filedata']['name'];
	$tempFileName = stripslashes($_FILES['Filedata']['name']);
	$extension = strtolower(getExtension( $tempFileName ));
	
	if ($tempFile) {
		if ($extension=="jpg" || $extension=="jpeg" ) {
			$src = imagecreatefromjpeg($tempFile);
		}
		
		// Get w, h
		list($width,$height)=getimagesize($tempFile);
		
		// define large image size
		$lg_height=($height/$width) * LG_WIDTH;
		$lg_img=imagecreatetruecolor(LG_WIDTH,$lg_height);
		
		// define thumb image size
		$tn_height=($height/$width) * TN_WIDTH;
		$tn_img=imagecreatetruecolor(TN_WIDTH,$tn_height);
		
		imagecopyresampled($lg_img,$src,0,0,0,0,LG_WIDTH,$lg_height,$width,$height);		
		imagecopyresampled($tn_img,$src,0,0,0,0,TN_WIDTH,$tn_height,$width,$height);
		
		$new_filename = genRandomString().".jpg";
		
		$lg_file = "/home/awaldron/public_html/ras/gallery/lg_".$new_filename;
		$tn_file = "/home/awaldron/public_html/ras/gallery/tn_".$new_filename;
		
		imagejpeg($lg_img,$lg_file,100);
		imagejpeg($tn_img,$tn_file,100);
		
		imagedestroy($src);
		imagedestroy($lg_img);
		imagedestroy($tn_img);
		
		// write the image to the database
		$ins = "INSERT INTO ras_gallery_photo (photo_title, photo_date, photo_file) VALUES ('".$tempFileName."', NOW(), '".$new_filename."')";
		qupdate($ins);
		
		// GET photo_id
		$photo_id = qsql("SELECT photo_id FROM ras_gallery_photo WHERE photo_file='".$new_filename."'");
		
		// GET ORDER VALUE
		$order = qsql("SELECT MAX(`order`) FROM ras_gallery_phogal WHERE gal_id=".$_GET['gal']);
		if (!$order) $order = 1;
		else $order++;
		
		// INSERT INTO phogal
		$ins = "INSERT INTO ras_gallery_phogal (`photo_id`, `gal_id`, `order`, `cover`) VALUES (".$photo_id.", ".$_GET['gal'].", ".$order.", 0)";
		echo $ins;
		qupdate($ins);
		
	}
}
?>