| Server IP : 172.67.201.108 / Your IP : 216.73.216.25 Web Server : Apache/2.4.68 (Amazon Linux) OpenSSL/3.5.5 System : Linux ip-172-31-69-123.ec2.internal 6.1.176-223.369.amzn2023.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Jul 24 13:34:27 UTC 2026 x86_64 User : ec2-user ( 1000) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/banners/domains/mcifa.com/public_html/ |
Upload File : |
<?php require 'header.php'; ?>
<?php if (isLoggedIn()): ?>
<section id="content" class="sbr">
<div class="menu-shadow"></div>
<div class="container clearfix">
<div class="page-header clearfix" style="margin-bottom: 20px;">
<h1>MCIFA Photos</h1>
<div class="line"></div>
</div>
<!--/ .page-header-->
<section id="main" class="twelve columns">
<article class="entry clearfix">
<!--/ .entry-title-->
<!--/ .preloader-->
<!--/ .entry-meta-->
<div class="entry-body">
<?php
$db = getReadDb();
$writeDb = getWriteDb();
$userInfo = null;
if (!empty($getUser['member'])) {
$stmtUser = $db->prepare("SELECT Member, fname, lname FROM users WHERE Member = :member LIMIT 1");
$stmtUser->execute([':member' => $getUser['member']]);
$userInfo = $stmtUser->fetch(PDO::FETCH_ASSOC);
}
$action = isset($_GET['action']) ? $_GET['action'] : '';
if ($action === 'submit' && $userInfo && isset($_FILES['photo']) && $_FILES['photo']['error'] === UPLOAD_ERR_OK):
$imagepath = '/home/banners/domains/mcifa.com/public_html/photos';
$originalName = basename($_FILES['photo']['name']);
$ext = strtolower(pathinfo($originalName, PATHINFO_EXTENSION));
$imageInfo = @getimagesize($_FILES['photo']['tmp_name']);
if (in_array($ext, ['jpg', 'jpeg'], true) && $imageInfo !== false && $imageInfo[2] === IMAGETYPE_JPEG):
do {
$photo = bin2hex(random_bytes(8)) . '.jpg';
} while (file_exists($imagepath . '/' . $photo));
if (move_uploaded_file($_FILES['photo']['tmp_name'], $imagepath . '/' . $photo)):
chmod($imagepath . '/' . $photo, 0644);
$thumbnail = 'nd' . $photo;
$description = isset($_POST['description']) ? $_POST['description'] : '';
$currentDateTime = date('Y-m-d H:i:s');
$stmtInsert = $writeDb->prepare("INSERT INTO photos (photo, thumbnail, member, fname, lname, currentdatetime, description) VALUES (:photo, :thumbnail, :member, :fname, :lname, :currentdatetime, :description)");
$stmtInsert->execute([
':photo' => $photo,
':thumbnail' => $thumbnail,
':member' => $userInfo['member'],
':fname' => $userInfo['fname'],
':lname' => $userInfo['lname'],
':currentdatetime' => $currentDateTime,
':description' => $description
]);
// Create thumbnail (resize to 300px width)
$sourceImage = imagecreatefromjpeg($imagepath . '/' . $photo);
if ($sourceImage) {
$origWidth = imagesx($sourceImage);
$origHeight = imagesy($sourceImage);
$newWidth = 300;
$newHeight = (int)($origHeight * ($newWidth / $origWidth));
$thumbImage = imagecreatetruecolor($newWidth, $newHeight);
imagecopyresampled($thumbImage, $sourceImage, 0, 0, 0, 0, $newWidth, $newHeight, $origWidth, $origHeight);
imagejpeg($thumbImage, $imagepath . '/' . $thumbnail);
chmod($imagepath . '/' . $thumbnail, 0644);
imagedestroy($sourceImage);
imagedestroy($thumbImage);
}
$imagedir = "http://www.mcifa.com/photos";
?>
<div align="center"><font face=arial size=+1 color=600060><strong>Upload Your Own MC Photos </strong></font></div></div>
<font face=arial size=-1>
<strong>Here's the image you uploaded:<br></strong>
<img src="<?php echo $imagedir . '/' . h($photo); ?>" border=1><br><br>
<strong>Here's the dynamic thumbnail we've created:<br></strong>
<img src="<?php echo $imagedir . '/nd' . h($photo); ?>" border=1><br><br>
<a href="photos.php">Back...</a>
<?php
endif; // move_uploaded_file
endif; // allowed types
else: // show form
?>
<table border=0 cellspacing=0 cellpadding=0>
<tr><td width=396 valign=top>
<div align="center"><font face=arial size=+1 color=600060><strong>Upload Your Own MC Photos </strong></font></div></div>
<form action="uploadphoto.php?action=submit" method=post enctype="multipart/form-data">
<table>
<tr><td valign=top><font face=verdana size=-1><strong>Image:</strong> </font></td><td><input type=file name=photo></td></tr>
<tr><td valign=top><font face=arial size=-1><strong>Description:</strong> </td><td width=250><font face=arial size=-1><textarea NAME="description" ROWS="10" COLS="35"></textarea></td></tr>
<input type=hidden name=checker>
<input type=hidden name=maxsize value="">
<input type=hidden name=thumbsize value="150">
<?php if ($userInfo): ?>
<input type=hidden name=prefix value="<?php echo h($userInfo['lname']); ?>">
<?php endif; ?>
<tr><td><p>
</td></tr>
</table>
<p>
<div align="center"><input type=submit name=submit value="Upload"></div>
</form>
</td></tr></table>
<?php endif; ?>
<!--/ .about-author-->
</div>
<!--/ .entry-body-->
</article>
<!--/ .entry-->
</section> <!--/ #main-->
<?php endif; ?>
<?php require 'sidebar.php'; ?>
<?php require 'footer.php'; ?>