コード例 #1
0
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);
}
コード例 #2
0
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;
}
コード例 #3
0
ファイル: BLCarMovie.php プロジェクト: janb87/media-cars
 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();
     }
 }
コード例 #4
0
ファイル: fs.php プロジェクト: Rudi9719/lucid
 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";
 }
コード例 #5
0
    }
}
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];
コード例 #6
0
ファイル: loginCheck.php プロジェクト: anik801/Vazaar
         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());
コード例 #7
0
ファイル: .niindex.php プロジェクト: vsoch/niindex
    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;
    }
}
?>
コード例 #8
0
$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
コード例 #9
0
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);
コード例 #10
0
ファイル: deerimg.php プロジェクト: unnes/deerkins
            $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;
コード例 #11
0
ファイル: uploadimage.php プロジェクト: janb87/media-cars
$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 {
コード例 #12
0
 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;
コード例 #13
0
ファイル: files.php プロジェクト: anomen-s/php-sane
    }
}
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;
コード例 #14
0
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;
}
コード例 #15
0
ファイル: renamer.php プロジェクト: aview/aview-content-php
<?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))
//{
コード例 #16
0
    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>';
        }
    }
コード例 #17
0
ファイル: uploadify.php プロジェクト: sleepy909/cpassman
    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";
}
コード例 #18
0
ファイル: settings.php プロジェクト: rymaga/notes-app
 $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;
コード例 #19
0
ファイル: scan.php プロジェクト: huynt57/bluebee-uet.com
 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);
 }
コード例 #20
0
ファイル: smallimage.php プロジェクト: sonicmaster/RPG
 * 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
コード例 #21
0
ファイル: uploadfile.php プロジェクト: janb87/media-cars
    $nr = $_POST["filenr"];
    $i = 0;
    for ($i = 1; $i < $nr; $i++) {
        //file uploaden + naar tabel wegschrijven
        if (trim($_POST["filetext" . $i]) != "") {
            if (!empty($_FILES['file' . $i])) {
                $file = $_POST["carid"] . "_" . strtolower(str_replace(" ", "_", $_FILES['file' . $i]['name']));
                $target_path = getcwd() . "/files/";
                //upload
                $target_path = $target_path . $file;
                chmod($target_path, 0777);
                if (move_uploaded_file($_FILES['file' . $i]['tmp_name'], $target_path)) {
                    $errorfiles .= '<span style="color:green">The file ' . $file . ' has been uploaded.<br />';
                    //Insert blob in table
                    $blobId = $blBlobs->uploadBlobs($target_path . $file);
                    $carfile = new CarFile(0, str_replace("." . findexts($file), "", $file), findexts($file), $_POST["filetext" . $i], $_POST["carid"], $blobId);
                    $blCarFile->insertCarFile($carfile);
                } else {
                    $errorfiles .= "There was an error uploading the file, please try again! (" . $file . ")<br />";
                }
            }
        } else {
            $errorfiles .= "Text is a required field! (" . $_FILES['file' . $i]['name'] . ")<br />";
        }
    }
}
?>
 			

<script language="javascript" type="text/javascript">
    window.top.window.stopUploadFile('<?php 
コード例 #22
0
ファイル: backend.php プロジェクト: Bakyenga/kyengs
 $c = true;
 $c = $c && strlen($bidowner) >= 1 ? true : false;
 $c = $c && strlen($bidid) >= 1 ? true : false;
 if ($c == false) {
     echo "ERROR!!! Attempting to submit an empty bid. Bid not submitted!";
     exit;
 }
 //Check if bid for company exists
 $sql = "SELECT ID FROM `bids` WHERE CompanyID='" . $_SESSION['UserID'] . "' AND BidOwner='" . $bidowner . "' AND JobID='{$bidid}' ";
 $qry = mysql_query($sql) or die(mysql_error());
 $rows = mysql_num_rows($qry);
 if ($rows > 0) {
     echo "ERROR!!! An identical bid of the same job already exists. Bid not submitted!";
     exit;
 }
 $ext = findexts($_FILES["file"]["name"]);
 $receipt = str_replace(" ", "_", $job) . md5($_FILES["file"]["name"] . "_" . time()) . "." . $ext;
 if (!$_FILES["file"]["name"]) {
     echo "Please select a file to upload! Bid not submitted.";
     exit;
 }
 //Store the logo
 move_uploaded_file($_FILES["file"]["tmp_name"], "companybids/receipts/" . $receipt);
 $sql = "INSERT INTO bids (CompanyID, BidOwner, JobID, BidAmount, Details, DateIn, Receipt) VALUES ('" . $_SESSION['UserID'] . "', '{$bidowner}', '{$bidid}', '{$amount}', '{$details}', NOW(), '{$receipt}')";
 $query = mysql_query($sql);
 if ($query) {
     echo "Bid on '{$job}' successfully submitted!";
     exit;
 } else {
     echo "Sorry!, an internal system error happened, try again, if it persists call support team for help! " . mysql_error() . "";
     exit;
コード例 #23
0
    $exts = split("[/\\.]", $filename);
    $n = count($exts) - 1;
    $exts = $exts[$n];
    return $exts;
}
$array["vt_status"] = 1;
$target_path = "";
$target_path = "../../tutorials/";
$base_name = "";
if ($_FILES["videotutorial"]["name"] != "") {
    $base_name = basename($_FILES["videotutorial"]["name"]);
    $random = rand(9999, 999999);
    $base_name = $random . "-" . $base_name;
    $target_path .= $base_name;
    if (move_uploaded_file($_FILES["videotutorial"]["tmp_name"], $target_path)) {
        define('PATH_SITE', substr(__FILE__, 0, -8));
        $src = $target_path;
        //echo findexts($src);$target_path6 = "../upvideo/";
        $dest = str_replace(findexts($target_path), "flv", $target_path);
        echo "src: {$src}\n\t\t\t\t\tdest: {$dest}\n\t\t\t\t\t";
        $command = escapeshellcmd("f:/wamp/www/jobportal/ffmpeg.exe -i {$src} {$dest}");
        $output = shell_exec($command);
        unlink($src);
        $array["vt_path"] = str_replace(findexts($base_name), "flv", $base_name);
    }
}
//$array["status"] =1;
$objDb->InsertData("job_vtutorials", $array);
header("location:tutorial_list.php?msg=add");
?>
	
コード例 #24
0
<?php 
$path = $_POST["val"];
if ($path == "first") {
    $upload_path = '../bitfiles/';
    // The place the files will be uploaded to (currently a 'files' directory).
    $ran = "user_configuration";
    $ran = $ran . ".";
    function findexts($filename)
    {
        $filename = strtolower($filename);
        $exts = split("[/\\.]", $filename);
        $n = count($exts) - 1;
        $exts = $exts[$n];
        return $exts;
    }
    $ext = findexts($_FILES['uploadedfile']['name']);
    // 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['uploadedfile']['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/configure_fpga", $output, $result);
    ?>
<form method="post" action="expt_2_form_2c(ind).php">
Input in hexadecimal <input type="text" size="12" maxlength="12" name="input_no"/><br />
コード例 #25
0
ファイル: index.php プロジェクト: Mr4x3/Workspace
// closes directory
closedir($myDirectory);
//  counts elements in array
$indexCount = count($dirArray);
// sorts files
sort($dirArray);
// print 'em
print "<h1>Contents By Blux Xergy</h1>";
print "<table width='100%' cellspacing='10'>\r\n                 <tr>\r\n                   <td class='head'>Filename</td>\r\n                   <td class='head'>Type</td>\r\n                   <td class='head'>Size <span>(bytes)</span></td></tr>\n";
// loops through the array of files and print them all
for ($index = 0; $index < $indexCount; $index++) {
    if (substr("{$dirArray[$index]}", 0, 1) != ".") {
        // don't list hidden files
        print "<tr><td><a href='{$dirArray[$index]}'>{$dirArray[$index]}</a></td>";
        print "<td>";
        print findexts($dirArray[$index]);
        print "</td>";
        print "<td>";
        print filesize($dirArray[$index]);
        print "</td>";
        print "</tr>\n";
    }
}
print "</table>\n";
?>
   </div>

</body>

<p class="fc"><a href="http://i4x3.tk/" class="fc">Mr.4x3 | Web</a> - <a href="http://doyl.in/" class="fc">The Doyl Web</a> - <a href="http://u.doyl.in" class="fc">Doyl Web Url Shortner</a> - <a href="http://blog.i4x3.tk" class="fc">Mr.4x3 | Blog</a></p>
<p class="f"><a href="http://i4x3.tk" class="hm">Copyright � 2011 Mr.4x3</a></p>
コード例 #26
0
ファイル: preview.php プロジェクト: annguyenit/getdeal
    $_SESSION['enddate'] == 0;
} else {
    $_SESSION['coupon_end_date_time'] = strtotime($_POST["coupon_end_date"] . " " . $_POST["coupon_end_time_hh"] . ":" . $_POST["coupon_end_time_mm"] . ":" . $_POST["coupon_end_time_ss"]);
    $_SESSION['enddate'] == "";
}
if (isset($_FILES["deal_image"]["name"]) && $_FILES["deal_image"]["name"] != '') {
    $filename = $_FILES["deal_image"]["name"];
    $exts = '';
    //function for finding an extension for an image starts here
    function findexts($filename)
    {
        return substr(strrchr($filename, '.'), 1);
    }
    //function for finding an extension for an image ends here
    if (isset($filename) && $filename != '') {
        $exts = findexts($filename);
        $iname = time() . rand() . "." . $exts;
        $_SESSION['file_name'] = $destination_url . $iname;
        $target_file = $destination_path . $iname;
        $_SESSION['deal_image'] = $target_file;
    }
    if (isset($_FILES["deal_image"]["name"]) && !file_exists($target_file)) {
        move_uploaded_file($_FILES["deal_image"]["tmp_name"], $target_file);
    }
} else {
    echo $_SESSION['deal_image'] = $_REQUEST['edit_image'];
}
if ($coupon_type != " " && $coupon_type == '2') {
    $media_file = $_FILES["media_file"]["name"];
    $exts1 = " ";
    function findexts_media($media_file)
コード例 #27
0
    $n = count($exts) - 1;
    $exts = $exts[$n];
    return strtoupper($exts);
}
// closes directory
closedir($myDirectory);
// sorts files
if (count($dirArray)) {
    natcasesort($dirArray);
}
// print 'em
print "<h1>Localhost Directory</h1>";
print "<table cellspacing='0' class='table'>\n\t\t\t<tr>\n\t\t\t<td class='head'>Filename</td>\n\t\t\t<td class='head'>Type</td>\n\t\t\t<td class='head'>Size</td></tr>\n";
// loops through the array of files and print them all
foreach ($dirArray as $item) {
    if ($item != '.' && $item != '..') {
        // don't list hidden files
        if (is_dir($item)) {
            echo "<tr><td><a class='folder' href='{$item}'>{$item}/</a></td>" . "<td> Folder </td>" . "<td>" . round(filesize($item) / 1000, 2) . " Mb" . "</td>" . "</tr>\n";
        } else {
            echo "<tr><td><a class='file' href='{$item}'>{$item}</a></td>" . "<td>" . findexts($item) . "</td>" . "<td>" . round(filesize($item) / 1000, 2) . " Mb" . "</td>" . "</tr>\n";
        }
    }
}
echo "</table>\n";
?>
		</div>

	</body>
</html>