HEX
Server: nginx/1.28.1
System: Linux 10-41-63-61 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64
User: www (1001)
PHP: 7.4.33
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: //www/备份的/cs.wgegeghx.com/application/function.php
<?php
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// | 用户自定义函数库
function getGroupName($id){
	return db('member_group')->WHERE("id", $id)->value('name');
}

function getThumb($id){
	return db('attachment')->WHERE("id", $id)->value('path');
}

function fmt_dot($str){
    return str_replace("&middot;", "·", urldecode($str));
}

function fmtDate($time){
	return date("Y年m月d日", $time);
}


function fmtType($type){
    $arr = ['1'=>'shipin',
            '2'=>'yinpin',
            '3'=>'tuwen'];
    return $arr[$type];
}



//获取视频重定向后的链接
function locationUrl($url){
      $url_parts = @parse_url($url);
      if (!$url_parts) return false;
      if (!isset($url_parts['host'])) return false;
      if (!isset($url_parts['path'])) $url_parts['path'] = '/';
      $sock = fsockopen($url_parts['host'], (isset($url_parts['port']) ? (int)$url_parts['port'] : '80'), $errno, $errstr, 30);
      if (!$sock) return false;
      $request = "HEAD " . $url_parts['path'] . (isset($url_parts['query']) ? '?'.$url_parts['query'] : '') . " HTTP/1.1\r\n";
      $request .= 'Host: ' . $url_parts['host'] . "\r\n";
      $request .= "Connection: Close\r\n\r\n";
      fwrite($sock, $request);
      $response = '';
      while(!feof($sock)) {
        $response .= fread($sock, 8192);
      }
      fclose($sock);
      if (preg_match('/^Location: (.+?)$/m', $response, $matches)){
        if ( substr($matches[1], 0, 1) == "/" ){
          return $url_parts['scheme'] . "://" . $url_parts['host'] . trim($matches[1]);
        }
        else{
          return trim($matches[1]);
        }
      } else {
        return false;
      }
}
//审核视频 curl
function get_data($url){
      $oCurl = curl_init();
      //模拟浏览器
      $header[] = "deo.com";
      $user_agent = "Mozilla/4.0 (Linux; Andro 6.0; Nexus 5 Build) AppleWeb/537.36 (KHTML, like Gecko)";
      curl_setopt($oCurl, CURLOPT_URL, $url);
      curl_setopt($oCurl, CURLOPT_HTTPHEADER,$header);
      curl_setopt($oCurl, CURLOPT_HEADER, true);
      curl_setopt($oCurl, CURLOPT_NOBODY, true);
      curl_setopt($oCurl, CURLOPT_USERAGENT,$user_agent);
      curl_setopt($oCurl, CURLOPT_RETURNTRANSFER, 1 );
      // 不用 POST 方式请求, 意思就是通过 GET 请求
      curl_setopt($oCurl, CURLOPT_POST, false);
      $sContent = curl_exec($oCurl);
      // 获得响应结果里的:头大小
      $headerSize = curl_getinfo($oCurl, CURLINFO_HEADER_SIZE);
      // 根据头大小去获取头信息内容
      $header = substr($sContent, 0, $headerSize);
      curl_close($oCurl);
      return $header;
}