$ifilename = $next_id . $x . $allowed_types[$im['mime']]; $image_name = copyImage($ifile, $uploaddir . $ifilename);
$inames[] = $image_name; if (Input::exist()) {
$files = array_filter($_FILES['upload']['name']); //Use something similar before processing files.
// Count the number of uploaded files in array
$total_count = count($_FILES['upload']['name']);
// Loop through every file
for( $i=0 ; $i < $total_count ; $i++ ) {
//The temp file path is obtained
$source_file = $_FILES['upload']['tmp_name'][$i];
//A file path needs to be present
if ($source_file != ""){
$newname = $_FILES['upload']['name'][$i];
$destination_file = "assets/images/$newname"; //URLROOT."/$newname";
//File is uploaded to temp dir
echo 'temp file<pre>'.print_r($source_file, true).'</pre><br>';
echo 'name<pre>'.print_r($newname, true).'</pre><br>';
echo 'filepath<pre>'.print_r($destination_file, true).'</pre><br>';
copyImage($source_file, $destination_file);
}
}
}
?>
<form action="<?php echo URLROOT ?>/test/upload" method="post" enctype="multipart/form-data">
Select Image Files to Upload:
<input type="file" name="upload[]" multiple >
<input type="submit" name="submit" value="UPLOAD">
</form> d14:failure reason4:teste
function copyImage($source, $destination, $redirect = URLROOT)
{
if (extension_loaded('gd')) {
// compress size max 100
$compression_quality = 25;
// set type
$type = substr($destination, -3);
$jpeg = substr($destination, -4);
// set destination
$new_destination = substr($destination, 0, -3) . 'webp';
if ($type == 'png') {
$image = imagecreatefrompng($source);
imagepalettetotruecolor($image);
imagealphablending($image, true);
imagesavealpha($image, true);
} elseif ($type == 'jpg') {
$image = imagecreatefromjpeg($source);
} elseif ($type == 'gif') {
$image = imagecreatefromgif($source);
imagepalettetotruecolor($image);
} elseif ($jpeg == 'jpeg') {
$image = imagecreatefromjpeg($source);
$new_destination = substr($destination, 0, -4) . 'webp';
} else {
Redirect::autolink($redirect, sprintf(Lang::T("Strange Image Type")));
}
// convert image
$result = imagewebp($image, $new_destination, $compression_quality);
// check result
if (false === $result) {
Redirect::autolink($redirect, sprintf(Lang::T("No Image Result")));
}
// destroy temp
imagedestroy($image);
return $new_destination;
} else {
$copy = copy($source, $destination);
if (!$copy) {
Redirect::autolink($redirect, sprintf(Lang::T("IMAGE_UPLOAD_FAILED")));
}
return $destination;
}
}
if (extension_loaded('gd')) {
copyImage(UPLOADDIR . "/tmdb/film/$id_tmdb.jpg", UPLOADDIR . "/tmdb/film/$id_tmdb.jpg");
unlink(UPLOADDIR . "/tmdb/film/$id_tmdb.jpg");
unlink(CACHE . "/tmdb/film/$id_tmdb.cache");
$image = "$id_tmdb.webp";
} $site_config['CONFIRMEMAIL'] = true;
UNIQUE KEY `tid_uid` (`tid`,`uid`),
for ($i = 1; $i <= $pages; ++$i) {for ($i = 1; $i <= $pages; $i < 5; ++$i) {for ($i = 1; $i <= $pages; ++$i) { if ($i > 5) {
break;
} ALTER TABLE groups
ADD `group_role_id` int(10) NOT NULL DEFAULT 1;
ALTER TABLE users
ADD `role_id` int(10) NOT NULL DEFAULT 1;
CREATE TABLE IF NOT EXISTS `group_permissions` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`permission_id` int(10) NOT NULL DEFAULT 0,
`role_id` int(10) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4;
INSERT INTO `group_permissions` (`id`, `permission_id`, `role_id`) VALUES
(1,0,1);
CREATE TABLE IF NOT EXISTS `permissions` (
`permission_id` int(10) NOT NULL AUTO_INCREMENT,
`permission_name` varchar(40) NOT NULL DEFAULT 'no name',
`view_torrents` enum('yes','no') NOT NULL DEFAULT 'yes',
`edit_torrents` enum('yes','no') NOT NULL DEFAULT 'no',
`delete_torrents` enum('yes','no') NOT NULL DEFAULT 'no',
`view_users` enum('yes','no') NOT NULL DEFAULT 'yes',
`edit_users` enum('yes','no') NOT NULL DEFAULT 'no',
`delete_users` enum('yes','no') NOT NULL DEFAULT 'no',
`view_news` enum('yes','no') NOT NULL DEFAULT 'yes',
`edit_news` enum('yes','no') NOT NULL DEFAULT 'no',
`delete_news` enum('yes','no') NOT NULL DEFAULT 'no',
`can_upload` enum('yes','no') NOT NULL DEFAULT 'no',
`can_download` enum('yes','no') NOT NULL DEFAULT 'yes',
`view_forum` enum('yes','no') NOT NULL DEFAULT 'yes',
`edit_forum` enum('yes','no') NOT NULL DEFAULT 'yes',
`delete_forum` enum('yes','no') NOT NULL DEFAULT 'no',
PRIMARY KEY (`permission_id`)
) ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4;
INSERT INTO `permissions` (`permission_id`, `permission_name`, `view_torrents`, `edit_torrents`, `delete_torrents`, `view_users`, `edit_users`, `delete_users`, `view_news`, `edit_news`, `delete_news`, `can_upload`, `can_download`, `view_forum`, `edit_forum`, `delete_forum`) VALUES
('0','default','yes', 'no','no','yes','no','no','yes','no','no','yes','yes','yes','no','yes'),
(1,'staff', 'yes','yes','yes','yes','yes','yes','yes','yes','yes','yes','yes','yes','yes','yes'); // Lets Build Permission Array
$data = array();
// Get User & Group
$user = DB::run(
"SELECT * FROM `users`
LEFT OUTER JOIN `groups`
ON users.class=groups.group_id
WHERE id = $_COOKIE[id]
AND users.enabled='yes'
AND users.status ='confirmed'"
)->fetch();
foreach ($user as $key => $value) {
$data[$key] = $value;
}
echo '<pre>'.print_r($user, true).'</pre>';
// User Role Or Group Role
$user_or_group_role = $user['role_id'] != 0 ? $user['role_id'] : $user['group_role_id'];
echo '<pre>'.print_r($user_or_group_role, true).'</pre>';
// Now Get Role (default id 1 for default group role)
$role = DB::run(
"SELECT `permission_id`
FROM `group_permissions` WHERE `role_id`=?",
[$user_or_group_role]
)->fetchColumn();
echo '<pre>'.print_r($role, true).'</pre>';
// Now Get Permission
$permission = DB::run(
"SELECT *
FROM `permissions` WHERE `permission_id`=?",
[$role]
)->fetch(PDO::FETCH_ASSOC);
foreach ($permission as $key => $value) {
$data[$key] = $value;
}
echo '<pre>'.print_r($permission, true).'</pre>';
// Full Single Array (less editing for now but should be multi)
echo '<pre>'.print_r($data, true).'</pre>';
CAST(uploaded AS UNSIGNED) + $upthisCAST(uploaded AS SIGNED) + $upthis'NO_UNSIGNED_SUBTRACTION';$res = SQL_Query_exec("SELECT filename, vip FROM torrents WHERE id = $id");
$arr = mysql_fetch_assoc($res);
$name = $arr['filename'];
$vip = $arr['vip'];
if ($vip == "yes" && $CURUSER["class"]<4 ){
show_error_msg("Error","<b>You can not download, you have to be VIP</b>",1);
}$target = 100;
$current = 21;
?>
<div style="background-color:#ffff00;height:24px;width:<?php echo $target ?>%">
<div style="background-color:#ff0000;height:24px;width:<?php echo $current ?>%"></div>
</div>
<?php