本文整理汇总了PHP中findexts函数的典型用法代码示例。如果您正苦于以下问题:PHP findexts函数的具体用法?PHP findexts怎么用?PHP findexts使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了findexts函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getXMLs
function getXMLs($comp, $dept, $course)
{
$dir = @opendir("CaptivateResults" . "/" . $comp . "/" . $dept . "/" . $course);
$directory = "CaptivateResults" . "/" . $comp . "/" . $dept . "/" . $course;
while (($file = readdir($dir)) !== false) {
if (!is_dir($file) && findexts($file) == 'xml') {
echo $file . "," . number_format(filectime($directory . "/" . $file), 0, '.', '') . ";";
}
}
closedir($dir);
}
开发者ID:uiugor,项目名称:INS_API-s,代码行数:11,代码来源:internalserverread.php
示例2: CleanFileName
function CleanFileName($Raw, $extra = 0)
{
$Raw = trim($Raw);
$extension = findexts($Raw);
$Raw = substr($Raw, 0, -strlen($extension));
//$RemoveChars = array( "([\40])" , "([^a-zA-Z0-9-])", "(-{2,})" );
$RemoveChars = array('/[^a-zA-Z0-9 -]/', '/[ -]+/', '/^-|-$/');
//$ReplaceWith = array("-", "", "-");
$ReplaceWith = array("", "-", "");
$Raw = preg_replace($RemoveChars, $ReplaceWith, $Raw);
$Raw .= $extra == 0 ? "" : $extra;
$Raw .= "." . $extension;
return $Raw;
}
开发者ID:erwincornelis,项目名称:Artofyao.com,代码行数:14,代码来源:functions.php
示例3: updateCarMovie
public function updateCarMovie($carmovie)
{
$error = false;
//url
if (trim($carmovie->getUrl()) == "") {
$phpError["carmovieurl"] = "Url is a required field!";
$error = true;
} elseif ($carmovie->getTypeId() == 1) {
if (strtolower(findexts($carmovie->getUrl())) != "wmv" && strtolower(findexts($carmovie->getUrl())) != "mp4") {
$phpError["carmovieurl"] = "LR link must be a wmv or mp4 file!";
$error = true;
}
} elseif ($carmovie->getTypeId() == 2) {
if (strtolower(findexts($carmovie->getUrl())) != "mpg" && strtolower(findexts($carmovie->getUrl())) != "mpeg" && strtolower(findexts($carmovie->getUrl())) != "mov" && strtolower(findexts($carmovie->getUrl())) != "mp4") {
$phpError["carmovieurl"] = "HR link must be mpg, mpeg, mov or mp4 file!";
$error = true;
}
} elseif ($carmovie->getTypeId() == 3) {
if (!isValidURL(trim($carmovie->getUrl()))) {
$phpError["carmovieurl"] = "Not a valid link!";
$error = true;
}
} elseif ($carmovie->getTypeId() == 4) {
//to be defined
} elseif ($carmovie->getTypeId() == 5) {
//to be defined
} else {
$phpError["carmovieurl"] = "Type not found!";
$error = true;
}
//text
if (trim($carmovie->getText()) == "") {
$phpError["carmovietext"] = "Text is a required field!";
$error = true;
}
//car
$dalCar = new DALCar();
$nrCars = $dalCar->getCarCount($carmovie->getCarId());
if ($nrCars == 0) {
$phpError["carmoviecar"] = "Car not found!";
$error = true;
}
if ($error == true) {
return $phpError;
} else {
parent::updateCarMovie($carmovie);
return $carmovie->getId();
}
}
开发者ID:janb87,项目名称:media-cars,代码行数:49,代码来源:BLCarMovie.php
示例4: mime_content_type
function mime_content_type($file)
{
//Guess the mimetype based on extension
if (is_dir($file)) {
return "text/directory";
}
import("api.fs_mimetypes");
global $fs_mimetypes;
$ext = findexts($file);
foreach ($fs_mimetypes as $key => $value) {
if ($ext == $key) {
return $value;
}
$exts = explode($key, " ");
if (count($exts) > 0) {
foreach ($exts as $check) {
if ($ext == $check) {
return $value;
}
}
}
}
return "text/plain";
}
开发者ID:Rudi9719,项目名称:lucid,代码行数:24,代码来源:fs.php
示例5: findexts
}
}
function findexts($filename)
{
$filename = strtolower($filename);
$exts = split("[/\\.]", $filename);
$n = count($exts) - 1;
$exts = $exts[$n];
return $exts;
}
$target_path2 = "";
$target_path2 = "../../pdf/ad_files/";
$base_name2 = "";
if ($_FILES['ad_print']['name'] != "") {
$random = rand(9999, 999999);
$base_name2 = $random . "-" . $_SESSION["user_id"] . "." . findexts(basename($_FILES['ad_print']['name']));
$target_path2 .= $base_name2;
if (move_uploaded_file($_FILES['ad_print']['tmp_name'], $target_path2)) {
$array['ad_link'] = $base_name2;
}
}
for ($i = 1; $i <= 7; $i++) {
$val = "duty" . $i;
if (isset($_POST[$val])) {
$array[$val] = $_POST[$val];
}
}
for ($i = 1; $i <= 26; $i++) {
$val = "hide" . $i;
if (isset($_POST[$val])) {
$array[$val] = $_POST[$val];
开发者ID:beyondkeysystem,项目名称:testone,代码行数:31,代码来源:job_edit_action.php
示例6: findexts
exit;
//new
} else {
echo "<script>alert('Authentication Error.');</script>";
}
} else {
if (isset($_POST['sellProductSubmitButton'])) {
$ext = findexts($_FILES['product_link1']['name']);
$newfilename = random_string('10') . "." . $ext;
$location1 = "files/" . $newfilename;
move_uploaded_file($_FILES["product_link1"]["tmp_name"], "files/" . $newfilename);
$ext = findexts($_FILES['product_link2']['name']);
$newfilename = random_string('10') . "." . $ext;
$location2 = "files/" . $newfilename;
move_uploaded_file($_FILES["product_link2"]["tmp_name"], "files/" . $newfilename);
$ext = findexts($_FILES['product_link3']['name']);
$newfilename = random_string('10') . "." . $ext;
$location3 = "files/" . $newfilename;
move_uploaded_file($_FILES["product_link3"]["tmp_name"], "files/" . $newfilename);
$user_id = mysql_real_escape_string($_SESSION['bns_id']);
$productName = mysql_real_escape_string($_POST['product_name']);
$productQuantity = mysql_real_escape_string($_POST['product_quantity']);
$productPrice = mysql_real_escape_string($_POST['product_price']);
$productDescription = mysql_real_escape_string($_POST['product_description']);
$productCategory = mysql_real_escape_string($_POST['categoryName']);
$productSubCategory = mysql_real_escape_string($_POST['subCategoryName']);
$i = 0;
$sql = "SELECT * FROM fields WHERE sub_category_id='{$productSubCategory}'";
$result = mysql_query($sql);
if (!$result) {
die('Invalid query: ' . mysql_error());
开发者ID:anik801,项目名称:Vazaar,代码行数:31,代码来源:loginCheck.php
示例7: closedir
return $exts;
}
// Closes directory
closedir($myDirectory);
// Counts elements in array
$indexCount = count($dirArray);
// Sorts files
sort($dirArray);
// Loops through the array of files
$count = 0;
for ($index = 0; $index < $indexCount; $index++) {
// Gets File Names
$name = $dirArray[$index];
$namehref = $dirArray[$index];
// Gets Extensions
$extn = findexts($dirArray[$index]);
// Gets file size
$size = number_format(filesize($dirArray[$index]));
// Gets Date Modified Data
$modtime = date("M j Y g:i A", filemtime($dirArray[$index]));
$timekey = date("YmdHis", filemtime($dirArray[$index]));
// Print
if (is_dir(".{$niindex}/{$namehref}") && $namehref != ".") {
print "<tr>\n <td><i class='fa fa-folder'></i></td>\n <td><a href='./{$namehref}'>{$namehref}</a></td>\n <td></td>\n <td></td>\n <td></td>\n </tr>";
}
if ($extn == "nii" || $extn == "gz") {
print "\n <script>filenames.push('{$namehref}')</script>\n <tr>\n <td><i class='icon-sagittal'></i></td>\n <td><a href='./{$namehref}'>{$name}</a></td>\n <td><a href='./{$namehref}'>{$modtime}</a></td>\n <td><button class='btn btn-default' onclick='changeImage(\"{$count}\")'>View</button></td>\n <td><a href='http://neurosynth.org/decode/?url={$base}{$niindex}{$namehref}' target='_blank'><button class='btn btn-default'>Decode</button></a></td>\n </tr>";
$count = $count + 1;
}
}
?>
开发者ID:vsoch,项目名称:niindex,代码行数:31,代码来源:.niindex.php
示例8: while
$loai = "1";
while ($row = mysql_fetch_array($ress)) {
$loai = $row[0];
}
$a->setMA_FILE($num);
$a->setKICH_THUOC_FILE($fileSize);
$a->setMA_HOA_FILE($mahoafile);
$a->setMA_LOAI_CHIA_SE("ml02");
$a->setMA_LOAI_FILE($loai);
$a->setMA_THU_MUC($matm);
$a->setMAT_KHAU_CS_FILE("");
$a->setSO_LUOT_DOWN("0");
$a->setTEN_FILE($fileName);
$a->setTRANG_THAI("active");
$a->themfile();
// 0 for false... and 1 for true
if (!$fileTmpLoc) {
// if file not chosen
echo "ERROR: Please browse for a file before clicking the upload button.";
exit;
}
if (move_uploaded_file($fileTmpLoc, "file/{$num}." . findexts($fileName))) {
echo "complete";
} else {
echo "move_uploaded_file function failed";
}
?>
wserqwrqwrwqerqwe
132erq2
开发者ID:long111306,项目名称:Du-an-1,代码行数:31,代码来源:file_upload_parser.php
示例9: fwrite
fwrite($fh, "\n");
fwrite($fh, $str2);
fwrite($fh, "\n");
fclose($fh);
$upload_path = '../temp/';
// The place the files will be uploaded to (currently a 'files' directory).
$ran = "input_file.";
function findexts($filename)
{
$filename = strtolower($filename);
$exts = split("[/\\.]", $filename);
$n = count($exts) - 1;
$exts = $exts[$n];
return $exts;
}
$ext = findexts($_FILES['input_file']['name']);
if ($ext != "txt") {
die('The extension of the file should be .txt');
}
// Check if we can upload to the specified path, if not DIE and inform the user.
if (!is_writable($upload_path)) {
die('You cannot upload to the specified directory, please CHMOD it to 777.');
}
$upload_path = $upload_path . $ran . $ext;
if (move_uploaded_file($_FILES['input_file']['tmp_name'], $upload_path)) {
echo "The file has been uploaded as " . $ran . $ext;
} else {
echo "Sorry, there was a problem uploading your file.";
}
unset($output);
exec("/var/www/html/VirtualLabs/experiments/exp_2/c_files/load_inputs_expt_3_1 </var/www/html/VirtualLabs/experiments/exp_2/temp/tempFile", $output, $result);
开发者ID:vlabiitd,项目名称:ecelab-iitd,代码行数:31,代码来源:expt_2_form_3c.php
示例10: dechex
$e[$i] = dechex($e[$i] <= 0 ? 0 : ($e[$i] >= 255 ? 255 : $e[$i]));
}
for ($i = 0; $i < 3; $i++) {
$out .= (strlen($e[$i]) < 2 ? '0' : '') . $e[$i];
}
$out = strtoupper($out);
} else {
$out = false;
}
return $out;
}
$file = filter_var($_GET['_img'], FILTER_VALIDATE_URL);
if (!$file) {
exit;
}
$ext = findexts($file);
if ($ext == 'jpg' || $ext == 'jpeg') {
$img = imagecreatefromjpeg($file);
} elseif ($ext == 'gif') {
$img = imagecreatefromgif($file);
} elseif ($ext == 'png') {
$img = imagecreatefrompng($file);
} else {
exit;
}
$max_width = 325;
$max_height = 300;
$colsize = 650 / 26;
$columns = 26;
$rows = 15;
$low_width = $max_width / $columns;
开发者ID:unnes,项目名称:deerkins,代码行数:31,代码来源:deerimg.php
示例11: BLBlobs
$blBlobs = new BLBlobs();
include_once getcwd() . "/include/imagehandler.php";
$upload_name = "Filedata";
//image uploaden + naar tabel wegschrijven
if (!empty($_FILES[$upload_name])) {
if (findexts($_FILES[$upload_name]['name']) == "jpg" || findexts($_FILES[$upload_name]['name']) == "jpeg" || findexts($_FILES[$upload_name]['imagename']) == "gif" || findexts($_FILES[$upload_name]['name']) == "png") {
$file = $_POST["CARID"] . "_" . strtolower(str_replace(" ", "_", $_FILES[$upload_name]['name']));
$path = getcwd() . "/pictures/";
//large
$errorim = upload($_FILES[$upload_name]['tmp_name'], $path, $file, 1600, 1600);
chmod($path . $file, 0777);
//class
if ($errorim[0] == true) {
//Insert blob in table
$blobId = $blBlobs->uploadBlobs($path . $file);
$carpicture = new CarPicture(0, str_replace("." . findexts($file), "", $file), findexts($file), $_POST["CARID"], $blobId);
$carpicture->setId($blCarPicture->insertCarPicture($carpicture));
$car = $blCar->getCar($_POST["CARID"]);
//default
if ($car->getDefaultPictureId() == null) {
$car->setDefaultPictureId($carpicture->getId());
$blCar->updateCar($car);
}
//pictureorder
$max = $blPictureOrder->getMaxPictureOrderByCar($car->getId()) + 1;
$pictureorder = new PictureOrder(0, $max, $car->getId(), $carpicture->getId());
$blPictureOrder->insertPictureOrder($pictureorder);
//success
//HandleError('<span style="color:green">' . $file . ' saved!</span><br />');
$carpicturelist[] = $carpicture;
} else {
开发者ID:janb87,项目名称:media-cars,代码行数:31,代码来源:uploadimage.php
示例12: findexts
function findexts($filename)
{
return strtolower(pathinfo($filename, PATHINFO_EXTENSION));
}
$etape = 1;
$addimage = '';
if (!empty($_POST)) {
$etape = 3;
}
$errormessage = _tr('Wrong format');
if (isset($_FILES["file"])) {
if ($_FILES["file"]["size"] > 10000000) {
$errormessage = _tr('Image too Big');
}
$allowedExts = array("jpg", "jpeg", "gif", "png");
$extension = findexts($_FILES["file"]["name"]);
if (($_FILES["file"]["type"] == "image/gif" || $_FILES["file"]["type"] == "image/jpeg" || $_FILES["file"]["type"] == "image/png" || $_FILES["file"]["type"] == "image/pjpeg" || $_FILES["file"]["type"] == "application/octet-stream") && $_FILES["file"]["size"] < 10000000 && in_array($extension, $allowedExts)) {
if ($_FILES["file"]["error"] > 0) {
echo "Return Code: " . $_FILES["file"]["error"] . "<br>";
$errormessage = _tr('Bad picture') . ' ' . $_FILES["file"]["error"];
} else {
if (file_exists("../files/temp/" . $_FILES["file"]["name"])) {
echo $_FILES["file"]["name"] . " already exists. ";
$errormessage = $_FILES["file"]["name"] . ' ' . _tr('already exists');
} else {
move_uploaded_file($_FILES["file"]["tmp_name"], "../files/full/" . date("Ymd-His.") . $extension);
$filename = "../files/full/" . date("Ymd-His.") . $extension;
/*
$addimage = "upload/gallery/" . date("Ymd-His.").$extension;
$thumbimage600 = "upload/600/" . date("Ymd-His.").$extension;
$thumbimage300 = "upload/300/" . date("Ymd-His.").$extension;
开发者ID:ChrisLefevre,项目名称:Swalize-Framework,代码行数:31,代码来源:uploader.php
示例13: krsort
}
}
krsort($files);
$dirArray = array_values($files);
//loop through the array of files
for ($index = 0; $index < count($dirArray); $index++) {
$file_name = $dirArray[$index];
$file_path = str_replace(" ", "%20", $save_dir . $dirArray[$index]);
$file_size = size_readable(filesize($save_dir . $dirArray[$index]));
$file_modtime = strftime('%c', filemtime($save_dir . $dirArray[$index]));
$file_new = $index === 0 && $action_save && $scanner_ok && time() - filemtime($save_dir . $dirArray[$index]) <= 60;
if (!$do_file_timezone) {
$file_modtime = str_replace(array(' CET', ' CEST'), '', $file_modtime);
}
//file type and category
$file_extention = findexts($dirArray[$index]);
$file_category = '';
switch ($file_extention) {
case "bmp":
$file_extention = $lang[$lang_id][47];
$file_category = "image";
break;
case "jpg":
case "jpeg":
$file_extention = $lang[$lang_id][44];
$file_category = "image";
break;
case "pdf":
$file_extention = $lang[$lang_id][43];
$file_category = "document";
break;
开发者ID:anomen-s,项目名称:php-sane,代码行数:31,代码来源:files.php
示例14: upload_files
function upload_files(&$resp)
{
$output_dir = codopm::$upload_path . 'client/uploads/';
$file_size = 0;
$valid_exts = codopm::$config['valid_exts'];
$file_size_limit = codopm::$config['per_filesize_limit'] * 1024;
//2 MB
$total_file_size_limit = codopm::$config['total_filesize_limit'] * 1024;
//10MB
$file_ext = explode(",", $valid_exts);
$file_names = array();
foreach ($_FILES as $file) {
$file_uploaded_ext = strtolower(findexts($file["name"]));
if (!in_array($file_uploaded_ext, $file_ext)) {
$resp->has_error = true;
$resp->msg = "file extension not supported";
} else {
if ($file["size"] > $file_size_limit) {
$resp->has_error = true;
$resp->msg = "file size cannot be greater than {$file_size_limit} KB";
} else {
if ($file["error"] > 0) {
$resp->has_error = true;
$resp->msg = "file could not be uploaded [" . $_FILES["myfile"]["error"] . "]";
} else {
if ($file["error"] == 0 && $file_size < $total_file_size_limit) {
$file_size += $file['size'];
$uname = time() . rand(22, 333) . "." . $file_uploaded_ext;
move_uploaded_file($file["tmp_name"], $output_dir . $uname);
$file_names[] = array("name" => strip_tags($file["name"]), "uname" => $uname);
} else {
$resp->has_error = true;
$resp->msg = "Total file size exceeds {$total_file_size_limit} KB";
}
}
}
}
}
return $file_names;
}
开发者ID:kertkulp,项目名称:php-ruhmatoo-projekt,代码行数:40,代码来源:codopm.php
示例15: findexts
<?php
include '../_paths.php';
//$destination="Recordedfiles/".$_GET["filename"];
$source = $fmsRootPath . "userlist/" . $_GET["filename"];
//$destination="E:/dpk/Recordedfiles/".$_GET["filename"];
$teacher = $_GET["teachername"];
function findexts($filename)
{
$filename = strtolower($filename);
$exts = split("[/\\.]", $filename);
$n = count($exts) - 1;
$exts = $exts[$n];
return $exts;
}
$ext = findexts($_GET["filename"]);
$ran = date("m.d.y");
$ran3 = time();
$ran = $ran . "_" . $ran3;
$ran2 = $ran . ".";
$target = "Recordedfiles/";
$target = $target . $teacher . $ran2 . $ext;
echo "\n\n\n\n\n";
echo $ext;
echo "\n\n\n\n\n";
echo $target;
echo "\n\n\n\n\n";
//echo $ext;
echo "\n\n\n\n\n";
//if(rename($_GET["filename"], $target))
//{
开发者ID:aview,项目名称:aview-content-php,代码行数:30,代码来源:renamer.php
示例16: changeavatar
function changeavatar()
{
global $domain, $db, $usrdata, $seo_on, $template, $directorypath;
$userid = $usrdata['userid'];
if (isset($_POST['avatar'])) {
$avatar = clean($_POST['avatar']);
if ($avatar == 0) {
mysql_query("UPDATE fas_users SET avatar='{$avatar}', avatarfile='' WHERE userid='{$userid}'");
echo '<div class=\'msg\'>Profile updated</div>';
} else {
function findexts($filename)
{
$filename = strtolower($filename);
$exts = explode(".", $filename);
$n = count($exts) - 1;
$exts = $exts[$n];
return $exts;
}
if ($_FILES['uploaded']['size'] > 40000) {
echo '<div class=\'error\'>File size too big.</div>';
return;
}
$ext = findexts($_FILES['uploaded']['name']);
$os = array("gif", "jpg", "jpeg", "png");
if (!in_array($ext, $os)) {
echo '<div class=\'error\'>File type not allowed or no file selected!</div>';
return;
} else {
}
$ran = "avatar";
$ran3 = $usrdata['userid'];
$ran4 = $ran . $userid . '.';
$avatarfile = $ran4 . $ext;
//This assigns the subdirectory you want to save into... make sure it exists!
$target = $directorypath . "avatars/";
//This combines the directory, the userid, and the extension
$target = $target . $ran4 . $ext;
if (move_uploaded_file($_FILES['uploaded']['tmp_name'], $target)) {
echo '<div class=\'msg\'>The file has been uploaded.</div>';
mysql_query("UPDATE fas_users SET avatar='{$avatar}', avatarfile='{$avatarfile}' WHERE userid='{$userid}'");
} else {
echo '<div class=\'error\'>Sorry, there was a problem uploading your file.</div>';
}
}
} else {
if ($seo_on == 1) {
$curl1 = '' . $domain . '/myaccount/changeavatar/';
} else {
$curl1 = '' . $domain . '/index.php?action=myaccount&cmd=changeavatar';
}
echo '<table align=\'center\' width="100%">
<tr>
<td colspan=\'4\' class=\'header\'>Edit Avatar</td>
</tr>
<tr>
<td class=\'content\'>
<form enctype=\'multipart/form-data\' action=\'' . $curl1 . '\' method=\'POST\'>
Use Avatar?:
<select type=\'dropdown\' name=\'avatar\'>
<option value=\'0\'>No</option>
<option value=\'1\' >Yes</option>
</select>
<p>
Please choose a file: <input name=\'uploaded\' type=\'file\' /><br />
<input type=\'submit\' value=\'Upload\' />
</form>
</td>
</tr>
</table>';
}
}
开发者ID:freearcadescript,项目名称:FreeArcadeScript,代码行数:74,代码来源:myaccount.php
示例17: md5
return $exts;
}
if (!empty($_FILES)) {
//Case where upload is an attached file for one item
if (!isset($_POST['type_upload']) || $_POST['type_upload'] != "import_items_from_file") {
// Get some variables
$file_random_id = md5($_FILES['Filedata']['name'] . mktime(date('h'), date('i'), date('s'), date('m'), date('d'), date('Y')));
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
$targetFile = str_replace('//', '/', $targetPath) . $file_random_id;
include '../../settings.php';
//Connect to mysql server
include '../../../sources/class.database.php';
$db = new Database($server, $user, $pass, $database, $pre);
$db->connect();
// Store to database
$db->query_insert('files', array('id_item' => $_POST['post_id'], 'name' => str_replace(' ', '_', $_FILES['Filedata']['name']), 'size' => $_FILES['Filedata']['size'], 'extension' => findexts($_FILES['Filedata']['name']), 'type' => $_FILES['Filedata']['type'], 'file' => $file_random_id));
// Log upload into databse - only log for a modification
if ($_POST['type'] == "modification") {
$db->query_insert('log_items', array('id_item' => $_POST['post_id'], 'date' => mktime(date('H'), date('i'), date('s'), date('m'), date('d'), date('y')), 'id_user' => $_POST['user_id'], 'action' => 'at_modification', 'raison' => 'at_add_file : ' . addslashes($_FILES['Filedata']['name'])));
}
} else {
// Get some variables
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/';
$targetFile = str_replace('//', '/', $targetPath) . $_FILES['Filedata']['name'];
}
//move
move_uploaded_file($tempFile, $targetFile);
echo "1";
}
开发者ID:sleepy909,项目名称:cpassman,代码行数:31,代码来源:uploadify.php
示例18: stripslashes
$filename = stripslashes($_FILES['file']['name']);
$extension = getExtension($filename);
$extension = strtolower($extension);
$image_name = time() . '.' . $extension;
//$filename = "img/". $image_name;
$target = "files/";
///////////////
function findexts($filename)
{
$filename = strtolower($filename);
$exts = preg_split("[/\\.]", $filename);
$n = count($exts) - 1;
$exts = $exts[$n];
return $exts;
}
$ext = findexts($_FILES['file']['name']);
$ran = rand(1, 300000000000000.0);
$ran2 = $ran . ".";
$target = $target . $ran2 . $ext;
system('file -ib ' . $filename);
///////////////////////
if ($extension != "jpg" && $extension != "jpeg" && $extension != "png" && $extension != "gif") {
$change = '<div class="msgdiv">Unknown Image extension </div> ';
$errors = 1;
} else {
$mot = "jaimelemarocbcp";
$hash = md5($mot . $filename);
$size = filesize($_FILES['file']['tmp_name']);
if ($size > MAX_SIZE * 1024) {
$change = '<div class="msgdiv">You have exceeded the size limit!</div> ';
$errors = 1;
开发者ID:rymaga,项目名称:notes-app,代码行数:31,代码来源:settings.php
示例19: check_dir
function check_dir($directory, $level)
{
global $virus_detected, $all, $detect_errors_only, $detected_Keyword_in_test_script;
$indent = '';
for ($count = 0; $count < $level; $count++) {
$indent .= TAB;
}
$level++;
$read_dir = opendir($directory);
// M? thu m?c hi?n t?i
while ($file = readdir($read_dir)) {
$filepath = $directory . '/' . $file;
if ($detect_errors_only && $virus_detected) {
exit;
}
if (is_dir($filepath)) {
// Thu m?c
if ($file != '.' && $file != '..') {
check_dir($filepath, $level);
}
} else {
if (is_file($filepath)) {
// T?p
if (is_readable($filepath) && !stristr(IGNORE_EXTENSIONS, findexts($file))) {
if (filesize($filepath) < MAX_SIZE && filemtime($filepath) > IGNORE_BEFORE) {
$fileentry = $directory . '/' . $file . ' - ' . date('j F Y H:i', filemtime($filepath));
$filestring = file_get_contents($filepath);
$found = stripos($filestring, Keyword);
// PHP 5 ONLY
$found = stristr($filestring, Keyword);
flush();
if ($found == false) {
if (!$detect_errors_only && !$all) {
echo $filepath . ' <font color=#FFFFFF>OK</font><br/>';
}
} else {
if ($file == 'scan_file.php') {
$detected_Keyword_in_test_script = true;
} else {
$virus_detected = true;
if ($detect_errors_only) {
echo '<b style="color:#F00">T?p tin d? ngh? phát hi?n</b><br/>';
} else {
echo TAB . '<b style="color:#F00">' . $fileentry . '</b> - <b style="color:#FFFFF0">Phát hi?n</b><br/>';
}
}
}
$found = '';
} else {
if (!$detect_errors_only && !$all) {
echo $filepath . ' <b style="color:yellow">NOT CHECKED - File quá l?n</b><br/>';
}
}
} else {
if (!$detect_errors_only && !$all) {
echo $filepath . ' <b style="color:yellow">NOT CHECKED - Không thu?c ki?u tìm ki?m</b><br/>';
}
}
} else {
}
}
}
closedir($read_dir);
}
开发者ID:huynt57,项目名称:bluebee-uet.com,代码行数:64,代码来源:scan.php
示例20: findexts
* smallimage.php
*
* @version 1.0
* @copyright 2008 By Anthony for MadnessRed.co.cc
*/
function findexts($filename)
{
$filename = strtolower($filename);
$exts = split("[/\\.]", $filename);
$n = count($exts) - 1;
$exts = $exts[$n];
return $exts;
}
$file = $_GET['source'];
list($width, $height) = getimagesize($file);
$type = findexts($file);
//echo $type;
//Types
/*
1 IMAGETYPE_GIF
2 IMAGETYPE_JPEG
3 IMAGETYPE_PNG
4 IMAGETYPE_SWF
5 IMAGETYPE_PSD
6 IMAGETYPE_BMP
7 IMAGETYPE_TIFF_II (intel byte order)
8 IMAGETYPE_TIFF_MM (motorola byte order)
9 IMAGETYPE_JPC
10 IMAGETYPE_JP2
11 IMAGETYPE_JPX
12 IMAGETYPE_JB2
开发者ID:sonicmaster,项目名称:RPG,代码行数:31,代码来源:smallimage.php
注:本文中的findexts函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论