當前位置:首頁 » 編程語言 » php雲盤源碼

php雲盤源碼

發布時間: 2022-12-20 06:49:07

㈠ 在網上下載的一個php的網站後台的源碼,求教一下怎麼安裝

好的源碼一般都有詳細的Documents說明文檔。像這種不好的源碼使用的一般就是沒有說明文檔或者是非公開的。網上下源碼的很多,但是有詳細規范的說明很少。
如果想要高質量的源碼,可以按照下面方法去做:
1、打開網路,搜索「PopMars-專注共享資源 – 免費教程」
2、打開其中名字為 「PopMars-專注共享資源 – 免費教程|Php源碼免費下載|IOS App應用...」 的網站
3、裡面可以找到大量的php源碼

㈡ 我有一份PHP的網站源碼,怎麼從這個源碼中找到後台的登錄地址。

找到賬戶設置的源碼部分 然後仔細閱讀 找出管理員賬戶 就是後台登錄地址和密碼賬戶

㈢ 求php文件上傳源碼

<?php
//文件和圖片上傳類
class UploadFile
{//類定義開始
public $maxSize = -1; // 上傳文件的最大值
public $supportMulti = true; // 是否支持多文件上傳
public $allowExts = array();// 允許上傳的文件後綴// 留空不作後綴檢 查
public $allowTypes = array(); // 允許上傳的文件類型 // 留空不做檢查
public $thumb = false; // 使用對上傳圖片進行縮略圖處理
public $thumbMaxWidth; // 縮略圖最大寬度
public $thumbMaxHeight; // 縮略圖最大高度
public $thumbPrefix = 'thumb_'; // 縮略圖前綴
public $thumbSuffix = '';
public $thumbPath = ''; // 縮略圖保存路徑
public $thumbFile = '';// 縮略圖文件名
public $thumbRemoveOrigin =false;// 是否移除原圖
public $zipImages = false; // 壓縮圖片文件上傳
public $autoSub = false; // 啟用子目錄保存文件
public $subType = 'hash';// 子目錄創建方式 可以使用hash date
public $dateFormat = 'Ymd';
public $hashLevel = 1; // hash的目錄層次
public $savePath = ''; // 上傳文件保存路徑
public $autoCheck = true; // 是否自動檢查附件
public $uploadReplace = false;// 存在同名是否覆蓋
// 例如可以是 time uniqid com_create_guid 等
// 必須是一個無需任何參數的函數名 可以使用自定義函數
public $saveRule = '';// 上傳文件命名規則
// 例如可以是 md5_file sha1_file 等// 上傳文件Hash規則函數名
public $hashType = 'md5_file';
private $error = '';// 錯誤信息
private $uploadFileInfo ;// 上傳成功的文件信息
/**
+----------------------------------------------------------
* 架構函數
+----------------------------------------------------------
* @access public
+----------------------------------------------------------
*/
public function __construct($maxSize='',$allowExts='',$allowTypes='',$savePath='',$saveRule='')
{
if(!empty($maxSize) && is_numeric($maxSize)) {
$this->maxSize = $maxSize;
}
if(!empty($allowExts)) {
if(is_array($allowExts)) {
$this->allowExts = array_map('strtolower',$allowExts);
}else {
$this->allowExts = explode(',',strtolower($allowExts));
}
}
if(!empty($allowTypes)) {
if(is_array($allowTypes)) {
$this->allowTypes = array_map('strtolower',$allowTypes);
}else {
$this->allowTypes = explode(',',strtolower($allowTypes));
}
}
if(!empty($savePath)) {
$this->savePath = $savePath;
}
if(!empty($saveRule)) {
$this->saveRule = $saveRule;
}

}

private function save($file)
{
$filename = $file['savepath'].$file['savename'];
if(!$this->uploadReplace && is_file($filename)) {// 不覆蓋同名文件
$this->error = '文件已經存在!'.$filename;
return $this -> error;
}
// 如果是圖像文件 檢測文件格式
if( in_array(strtolower($file['extension']),array('gif','jpg','jpeg','bmp','png','swf')) && $this -> error === getimagesize($file['tmp_name'])) {
$this->error = '非法圖像文件';
return $this -> error;
}
if(!move_uploaded_file($file['tmp_name'], iconv('utf-8','gbk',$filename))) {
$this->error = '文件上傳保存錯誤!';
return $this -> error;
}
if($this->thumb && in_array(strtolower($file['extension']),array('gif','jpg','jpeg','bmp','png'))) {
$image = getimagesize($filename);
if($this -> error !== $image) {
//是圖像文件生成縮略圖
$thumbWidth = explode(',',$this->thumbMaxWidth);
$thumbHeight = explode(',',$this->thumbMaxHeight);
$thumbPrefix = explode(',',$this->thumbPrefix);
$thumbSuffix = explode(',',$this->thumbSuffix);
$thumbFile = explode(',',$this->thumbFile);
$thumbPath =
$this->thumbPath?$this->thumbPath:$file['savepath'];
// 生成圖像縮略圖
if(file_exists(dirname(__FILE__).'/Image.class.php'))
{
require_once(dirname(__FILE__).'/Image.class.php');
$realFilename = $this->autoSub?basename($file['savename']):$file['savename'];
for($i=0,$len=count($thumbWidth); $i<$len; $i++) {
$thumbname = $thumbPath.$thumbPrefix[$i].substr($realFilename,0,strrpos($realFilename, '.')).$thumbSuffix[$i].'.'.$file['extension'];
Image::thumb($filename,$thumbname,'',$thumbWidth[$i],$thumbHeight[$i],true);
}
if($this->thumbRemoveOrigin) {
// 生成縮略圖之後刪除原圖
unlink($filename);
}
}
}
}

return true;
}

/**
+----------------------------------------------------------
* 上傳文件
+----------------------------------------------------------
* @access public
+----------------------------------------------------------
* @param string $savePath 上傳文件保存路徑
+----------------------------------------------------------
* @return string
+----------------------------------------------------------
* @throws ThinkExecption
+----------------------------------------------------------
*/
public function upload($savePath ='') {

if(empty($savePath)) //如果不指定保存文件名,則由系統默認
$savePath = $this->savePath;
$savePath .= date('Ym',time())."/";
if(!is_dir($savePath)) { // 檢查上傳目錄

if(is_dir(base64_decode($savePath))) {// 檢查目錄是否編碼後的
$savePath = base64_decode($savePath);
}else{
if(!mkdir($savePath)){ // 嘗試創建目錄
$this->error = '上傳目錄'.$savePath.'不存在';return $this -> error;
}
}
}else {
if(!is_writeable($savePath)) {
$this->error = '上傳目錄'.$savePath.'不可寫'; return $this -> error;
}
}
$fileInfo = array();
$isUpload = $this -> error;

// 獲取上傳的文件信息
// 對$_FILES數組信息處理
$files = $this->dealFiles($_FILES);
foreach($files as $key => $file) {
//過濾無效的上傳
if(!empty($file['name'])) {
//登記上傳文件的擴展信息
$file['key'] = $key;
$file['extension'] = $this->getExt($file['name']);
$file['savepath'] = $savePath;
$file['savename'] = $this->getSaveName($file);

// 自動檢查附件
if($this->autoCheck) {
if(!$this->check($file))
return $this -> error;
}

//保存上傳文件
//echo "<pre>";print_r( $file );
if(!$this->save($file)) return $this -> error;
/*
if(function_exists($this->hashType)) {
$fun = $this->hashType;
$file['hash'] = $fun(auto_charset($file['savepath'].$file['savename'],'utf-8','gbk'));
}
*/
//上傳成功後保存文件信息,供其他地方調用
unset($file['tmp_name'],$file['error']);
$fileInfo[] = $file;
$isUpload = true;
}
}
if($isUpload) {
$this->uploadFileInfo = $fileInfo;
return $fileInfo;
}else {
$this->error = '沒有選擇上傳文件';
return $this -> error;
}
}

/**
+----------------------------------------------------------
* 轉換上傳文件數組變數為正確的方式
+----------------------------------------------------------
* @access private
+----------------------------------------------------------
* @param array $files 上傳的文件變數
+----------------------------------------------------------
* @return array
+----------------------------------------------------------
*/
private function dealFiles($files) {
$fileArray = array();
foreach ($files as $file){
if(is_array($file['name'])) {
$keys = array_keys($file);
$count = count($file['name']);
for ($i=0; $i<$count; $i++) {
foreach ($keys as $key)
$fileArray[$i][$key] = $file[$key][$i];
}
}else{
$fileArray = $files;
}
break;
}
return $fileArray;
}

/**
+----------------------------------------------------------
* 獲取錯誤代碼信息
+----------------------------------------------------------
* @access public
+----------------------------------------------------------
* @param string $errorNo 錯誤號碼
+----------------------------------------------------------
* @return void
+----------------------------------------------------------
* @throws ThinkExecption
+----------------------------------------------------------
*/
protected function error($errorNo)
{
switch($errorNo) {
case 1:
$this->error = '上傳的文件超過了 php.ini 中 upload_max_filesize 選項限制的值';
break;
case 2:
$this->error = '上傳文件的大小超過了 HTML 表單中 MAX_FILE_SIZE 選項指定的值';
break;
case 3:
$this->error = '文件只有部分被上傳';
break;
case 4:
$this->error = '沒有文件被上傳';
break;
case 6:
$this->error = '找不到臨時文件夾';
break;
case 7:
$this->error = '文件寫入失敗';
break;
default:
$this->error = '未知上傳錯誤!';
}
return ;
}

/**
+----------------------------------------------------------
* 根據上傳文件命名規則取得保存文件名
+----------------------------------------------------------
* @access private
+----------------------------------------------------------
* @param string $filename 數據
+----------------------------------------------------------
* @return string
+----------------------------------------------------------
*/
private function getSaveName($filename)
{
$rule = $this->saveRule;
if(empty($rule)) {//沒有定義命名規則,則保持文件名不變
$saveName = $filename['name'];
}else {
if(function_exists($rule)) {
//使用函數生成一個唯一文件標識號
$saveName = $rule().rand(1001,9999).".".$filename['extension'];
}else {
//使用給定的文件名作為標識號
$saveName = $rule.rand(1001,9999).".".$filename['extension'];
}
}
if($this->autoSub) {
// 使用子目錄保存文件
$saveName = $this->getSubName($filename).'/'.$saveName;
}
return $saveName;
}

/**
+----------------------------------------------------------
* 獲取子目錄的名稱
+----------------------------------------------------------
* @access private
+----------------------------------------------------------
* @param array $file 上傳的文件信息
+----------------------------------------------------------
* @return string
+----------------------------------------------------------
*/
private function getSubName($file)
{
switch($this->subType) {
case 'date':
$dir = date($this->dateFormat,time());
break;
case 'hash':
default:
$name = md5($file['savename']);
$dir = '';
for($i=0;$i<$this->hashLevel;$i++) {
$dir .= $name{0}.'/';
}
break;
}
if(!is_dir($file['savepath'].$dir)) {
mkdir($file['savepath'].$dir);
}
return $dir;
}

/**
+----------------------------------------------------------
* 檢查上傳的文件
+----------------------------------------------------------
* @access private
+----------------------------------------------------------
* @param array $file 文件信息
+----------------------------------------------------------
* @return boolean
+----------------------------------------------------------
*/
private function check($file) {
if($file['error']!== 0) {
//文件上傳失敗
//捕獲錯誤代碼
$this->error($file['error']);
return $this -> error;
}

//檢查文件Mime類型
if(!$this->checkType($file['type'])) {
$this->error = '上傳文件MIME類型不允許!';
return $this -> error;
}
//檢查文件類型
if(!$this->checkExt($file['extension'])) {
$this->error ='上傳文件類型不允許';
return $this -> error;
}
//文件上傳成功,進行自定義規則檢查
//檢查文件大小
if(!$this->checkSize($file['size'])) {
$this->error = '上傳文件大小超出限制!';
return $this -> error;
}

//檢查是否合法上傳
if(!$this->checkUpload($file['tmp_name'])) {
$this->error = '非法上傳文件!';
return $this -> error;
}
return true;
}

/**
+----------------------------------------------------------
* 檢查上傳的文件類型是否合法
+----------------------------------------------------------
* @access private
+----------------------------------------------------------
* @param string $type 數據
+----------------------------------------------------------
* @return boolean
+----------------------------------------------------------
*/
private function checkType($type)
{
if(!empty($this->allowTypes))
return in_array(strtolower($type),$this->allowTypes);
return true;
}

/**
+----------------------------------------------------------
* 檢查上傳的文件後綴是否合法
+----------------------------------------------------------
* @access private
+----------------------------------------------------------
* @param string $ext 後綴名
+----------------------------------------------------------
* @return boolean
+----------------------------------------------------------
*/
private function checkExt($ext)
{
if(!empty($this->allowExts))
return in_array(strtolower($ext),$this->allowExts,true);
return true;
}

/**
+----------------------------------------------------------
* 檢查文件大小是否合法
+----------------------------------------------------------
* @access private
+----------------------------------------------------------
* @param integer $size 數據
+----------------------------------------------------------
* @return boolean
+----------------------------------------------------------
*/
private function checkSize($size)
{
return !($size > $this->maxSize) || (-1 == $this->maxSize);
}

/**
+----------------------------------------------------------
* 檢查文件是否非法提交
+----------------------------------------------------------
* @access private
+----------------------------------------------------------
* @param string $filename 文件名
+----------------------------------------------------------
* @return boolean
+----------------------------------------------------------
*/
private function checkUpload($filename)
{
return is_uploaded_file($filename);
}

/**
+----------------------------------------------------------
* 取得上傳文件的後綴
+----------------------------------------------------------
* @access private
+----------------------------------------------------------
* @param string $filename 文件名
+----------------------------------------------------------
* @return boolean
+----------------------------------------------------------
*/
private function getExt($filename)
{
$pathinfo = pathinfo($filename);
return $pathinfo['extension'];
}

/**
+----------------------------------------------------------
* 取得上傳文件的信息
+----------------------------------------------------------
* @access public
+----------------------------------------------------------
* @return array
+----------------------------------------------------------
*/
public function getUploadFileInfo()
{
return $this->uploadFileInfo;
}

/**
+----------------------------------------------------------
* 取得最後一次錯誤信息
+----------------------------------------------------------
* @access public
+----------------------------------------------------------
* @return string
+----------------------------------------------------------
*/
public function getErrorMsg()
{
return $this->error;
}

}//類定義結束
?>

㈣ 求一個簡單php網站的源碼

php各種函數還有一些概念看最好查官方文檔:http://cn2.php.net/manual/zh/index.php 這個是中文版,大部分已經翻譯了。

告訴你一個簡單的框架吧 thinkphp 國人弄的 中文文檔全面,學框架比較快。

之後記住幾個開源框架:Zend Symfony Laravel drupal WordPress 還有 Yii 這些都是比較成熟的老牌框架了,你以後開發 可能會涉及到。

㈤ 求《PHP程序設計經典300例》全文免費下載百度網盤資源,謝謝~

《PHP程序設計經典300例》網路網盤pdf最新全集下載:
鏈接:https://pan..com/s/1rpjBoUpgfEj27M_z0Vk74A

?pwd=rgq1 提取碼:rgq1
簡介:PHP是當今使用最為廣泛的伺服器腳本語言,本書的架構基於PHP+Web 2.0,涵蓋了頁面動態特效展示、伺服器頁面渲染到資料庫應用等所有主流應用,讀者通讀此書後即可實現簡單的Web前端入門實踐。

㈥ .php得到源文件後在那裡看源代碼

這個是不能直接查看的只有幾種途徑:
PHP是編譯的運行程序,在瀏覽器看到的是編譯執行之後的展示頁面,並不是源代碼。
網站站長,公開共享免費提供網站源碼整站下載的,可以拿到查看。
網站提供後台,給一定的人群,有一定的管理許可權。可以解除代碼。
伺服器,部分網站因為某些原因,伺服器是共享的,可以看到源代碼。

㈦ PHP如何實現網盤以及壓縮包的功能操作

1.主頁面file_zip.php

2.主頁面的處理頁面file_zip_chuli.php
<?phpsession_start();$lj=$_POST["lj"];$_SESSION["lujing"] =$lj;

㈧ 請推薦一個PHP網盤源碼

http://codes.21tx.com/php/
仔細看看

㈨ 如何下載PHP語言網站源碼

在PHP的官方網站可以下載源碼(www.php.net),進入之後選擇DOWNLOAD裡面的Complete Source Code就能下載,具體的頁面地址是:http://www.php.net/get/php-5.2.9.tar.bz2/from/a/mirror

熱點內容
cns腳本 發布:2025-05-15 01:13:38 瀏覽:722
數據結構與演算法筆試題 發布:2025-05-15 01:04:20 瀏覽:417
搜狗輸入法如何直接編輯配置文件 發布:2025-05-15 00:51:47 瀏覽:668
電箱都有哪些配置 發布:2025-05-15 00:30:21 瀏覽:74
安卓qq邀請碼在哪裡尋找 發布:2025-05-15 00:02:04 瀏覽:34
三菱fx編程口 發布:2025-05-15 00:01:23 瀏覽:810
醫院招商引資宣傳片腳本 發布:2025-05-15 00:01:21 瀏覽:368
linuxcftp伺服器 發布:2025-05-14 23:58:18 瀏覽:718
探岳什麼配置才有駕駛模式選擇 發布:2025-05-14 23:53:17 瀏覽:146
如何在手機上看無限流量密碼 發布:2025-05-14 23:43:31 瀏覽:114