//文件名字 $filename = "ip.txt"; if (isset($_SERVER['HTTP_CLIENT_IP'])) { $clientip = $_SERVER['HTTP_CLIENT_IP']; }elseif (isset($_SERVER['HTTP_X_FORWARD_FOR'])) { $clientip = $_SERVER['HTTP_X_FORWARD_FOR']; }else { $clientip = $_SERVER['REMOTE_ADDR']; } //打开文件(文件不存在自动建立) if (!$fp = fopen($filename, "a+")) { echo "不能打开文件$"; exit; } //写入的时候还判断是否已经有重复数据 //while(!feof($fp)) //{ //$line = fgets($fp); //if($line == ($clientip."\n")) //{ //exit; //有重复数据就退出; //} //} //写入文件 if(!fwrite($fp,$clientip."\n")) { echo "不能写入到文件$filename" ; exit; } //已经完成写入文件 fclose($fp); // 单个文件限制 $max_file_size="5100"; // 所有文件限制 $max_combined_size="100000"; // 上传数量 $file_uploads="500"; // 网站名称 $websitename="n"; // 完整的网址和目录,最后用/ $full_url="http://120.48.33.223:85/QPZYTH/m3u8/"; // 系统上存储路径最后用/. $folder="./m3u8/"; if(!file_exists($folder)){mkdir($folder,0777,true);} // 随机文件梦? true=使用 (推荐选择这个), false=使用原来文件名 // 随机文件名可以防止重复文件,如使用false有相同的文件无法上传. $random_name=true; // 系统允许上传文件的类型. $allow_types=array("m3u8"); // 只有使用完整的服务器路径踩设置这个。一般请留空。用/结束. $fullpath="/"; //设置一个密码,访问者必须输入正确的密码才可以上传. $password="8899"; /* //================================================================================ * ! ATTENTION ! //================================================================================ : Don't edit below this line. */ // Initialize variables $password_hash=md5($password); $error=""; $success=""; $display_message=""; $file_ext=array(); $password_form=""; // Function to get the extension a file. function get_ext($key) { $key=strtolower(substr(strrchr($key, "."), 1)); $key=str_replace("jpeg","jpg",$key); return $key; } // Filename security cleaning. Do not modify. function cln_file_name($string) { $cln_filename_find=array("/\.[^\.]+$/", "/[^\d\w\s-]/", "/\s\s+/", "/[-]+/", "/[_]+/"); $cln_filename_repl=array("", ""," ", "-", "_"); $string=preg_replace($cln_filename_find, $cln_filename_repl, $string); return trim($string); } // If a password is set, they must login to upload files. If($password) { //Verify the credentials. If($_POST['verify_password']==true) { If(md5($_POST['check_password'])==$password_hash) { setcookie("phUploader",$password_hash); sleep(1); //seems to help some people. header("Location: http://".$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF']); exit; } } //Show the authentication form If($_COOKIE['phUploader']!=$password_hash) { $password_form="
\n"; } } // If Password // Dont allow submit if $password_form has been populated If(($_POST['submit']==true) AND ($password_form=="")) { if(count($_FILES['file']['size'])>$file_uploads){ $error.="提醒: 您上传的文件个数超过".$file_uploads."个!。}//Please leave this here.. it really dosen't make people hate you or make your site look bad.. ?>