RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / user-182966

steep's questions

Martin Hope
steep
Asked: 2025-03-14 00:03:49 +0000 UTC

如何确定一天中不同时间的数量?

  • 2
var tarif = 100 ; 
var km = 7 ; // 1км=20р          
var time = 15 мин  ; // 1мин=10р
var kef = 1;

time = time.replace(/[a-zа-яё]/gi, '');


$(".pricetotal").text ( Math.round ( tarif + (km * 20) + (time * 10)) * kef );

kef在一天中的任何时间1,如何做,例如从早上 6 点到 8 点kef=1.2等等。

javascript
  • 1 个回答
  • 50 Views
Martin Hope
steep
Asked: 2025-03-11 07:14:15 +0000 UTC

如何将数组解析为元素并保存到文件?

  • 4

此代码将数据写入文件

$data = file_get_contents('php://input');
$data = json_decode($data, true);

function writeLogFile($string, $clear = false){
    $log_file_name = __DIR__."/message.txt";
    $now = date("Y-m-d H:i:s");
    if($clear == false) {
        file_put_contents($log_file_name, $now." ".print_r($string, true)."\r\n", FILE_APPEND);
    } else {
        file_put_contents($log_file_name, $now." ".print_r($string, true)."\r\n");
    }
}
writeLogFile($data, false);

这种格式

...
2025-03-11 01:10:28 Array
(
    [update_id] => 82576514
    [message] => Array
        (
            [message_id] => 6618
            [from] => Array
                (
                    [id] => 390344561
                    [is_bot] => 
                    [first_name] => 𝕊𝔹𝔹
                    [last_name] => 𝕚𝕟𝕘
                    [username] => ETR
                    [language_code] => ru
                )

            [chat] => Array
                (
                    [id] => 390344561
                    [first_name] => 𝕊𝔹𝔹
                    [last_name] => 𝕚𝕟𝕘
                    [username] => ETR
                    [type] => private
                )

            [date] => 1741644628
            [text] => Главная
        )

)
...

如何使文件以这种格式写入

2025-03-11 01:10:28 Имя => 𝕊𝔹𝔹, Фамилия => 𝕚𝕟𝕘, Ник => ETR ...

以及在.csv文件中(如何设置此代码?)

$buffer = fopen(__DIR__ . '/file.csv', 'w'); 
fputs($buffer, chr(0xEF) . chr(0xBB) . chr(0xBF));
foreach($string as $val) { 
    fputcsv($buffer, $val, ';'); 
} 
fclose($buffer); 
exit();
php
  • 1 个回答
  • 59 Views
Martin Hope
steep
Asked: 2025-03-06 22:36:35 +0000 UTC

如何在电报中制作按钮?

  • 5

电报机器人现在有 3 个按钮,单击后,它们会在聊天中写入简单的文本。如何制作 4 个按钮,但将它们排列成一行中的 2 个?点击第一个按钮/help,会显示另外 4 个按钮,就像一个多级菜单。

在此处输入图片描述

$data = file_get_contents('php://input');
$data = json_decode($data, true);
 
if (empty($data['message']['chat']['id'])) {
    exit();
}
 
define('TOKEN', '7444555:AAHomfgjN0mM');
 
// Функция вызова методов API.
function sendTelegram($method, $response)
{
    $ch = curl_init('https://api.telegram.org/bot' . TOKEN . '/' . $method);  
    curl_setopt($ch, CURLOPT_POST, 1);  
    curl_setopt($ch, CURLOPT_POSTFIELDS, $response);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HEADER, false);
    $res = curl_exec($ch);
    curl_close($ch); 
    return $res;
}
 
// Ответ на текстовые сообщения.
if (!empty($data['message']['text'])) {
    $text = $data['message']['text'];


$keyboard = [
    [ "/start" ],
    [ "/help" ],
    [ "Кнопка 3" ]
];

$reply_markup = json_encode([
    "keyboard"=>$keyboard,
    "resize_keyboard"=>true
]);


// Команда /start.
    if (mb_stripos($text, '/start') !== false) {
        sendTelegram(
            'sendMessage', 
            array(
                'chat_id' => $data['message']['chat']['id'],
                'text'=>'Добро пожаловать в бота! /help /photo',
                'reply_markup'=>$reply_markup
        
            )
        ); 
        exit(); 
    } 
 
    if (mb_stripos($text, '/help') !== false) {
        sendTelegram(
            'sendMessage', 
            array(
                'chat_id' => $data['message']['chat']['id'],
                'text' => 'Помощь!'
            )
        );
        exit(); 
    } 
 
    // Отправка фото.
    if (mb_stripos($text, '/photo') !== false) {
        sendTelegram(
            'sendPhoto', 
            array(
                'chat_id' => $data['message']['chat']['id'],
                'photo' => curl_file_create(__DIR__ . '/img/edem.jpg'),
                'caption' => "Подпись к изображению",
                'parse_mode' => 'HTML',
            )
        );      
        exit(); 
    }
 
}
php
  • 1 个回答
  • 34 Views
Martin Hope
steep
Asked: 2023-12-03 01:34:34 +0000 UTC

如何解析这样的文本?

  • 2

如何将此类代码解析为多个部分、单独的标签等。

tovar|куртка||nal|111||beznal|222||price|333||dostavka|444||prod|Имя

这样你就可以将其显示在页面上,如下所示:

Товар: куртка
Наличные: 111
...
php
  • 1 个回答
  • 60 Views
Martin Hope
steep
Asked: 2023-07-18 15:53:16 +0000 UTC

如何计算一个数的质量百分比?

  • 5

有一个包含数据的表。对每个金额添加或减去百分比并四舍五入到 1000 的最简单方法是什么?

<div class="table-res">
  <p>монтаж и материалы</p>
  <table class="table">
    <tbody>
      <tr>
        <th>Размер, толщина плиты</th>
        <th>200мм, руб.</th>
        <th>250мм, руб.</th>
        <th>300мм, руб.</th>
        <th>350мм, руб.</th>
        <th>400мм, руб.</th>
      </tr>
      <tr>
        <td>3 на 4</td>
        <td>68000</td>
        <td>75000</td>
        <td>85000</td>
        <td>95000</td>
        <td>105000</td>
      </tr>
      <tr>
        <td>4 на 4</td>
        <td>80000</td>
        <td>90000</td>
        <td>100000</td>
        <td>110000</td>
        <td>120000</td>
      </tr>
      <tr>
        <td>5 на 6</td>
        <td>102000</td>
        <td>136000</td>
        <td>165000</td>
        <td>190000</td>
        <td>220000</td>
      </tr>
      <tr>
        <td>6 на 6</td>
        <td>136000</td>
        <td>153000</td>
        <td>187000</td>
        <td>221000</td>
        <td>255000</td>
      </tr>
    </tbody>
  </table>
</div>
<div class="table-res">
  <p>монтаж</p>
  <table class="table">
    <tbody>
      <tr>
        <th>толщина плиты</th>
        <th>200мм, руб.</th>
        <th>250мм, руб.</th>
        <th>300мм, руб.</th>
        <th>350мм, руб.</th>
        <th>400мм, руб.</th>
      </tr>
      <tr>
        <td>3 на 4</td>
        <td>38000</td>
        <td>42000</td>
        <td>47000</td>
        <td>53000</td>
        <td>58000</td>
      </tr>
      <tr>
        <td>4 на 4</td>
        <td>44000</td>
        <td>50000</td>
        <td>56000</td>
        <td>61000</td>
        <td>67000</td>
      </tr>
      <tr>
        <td>5 на 6</td>
        <td>57100</td>
        <td>76100</td>
        <td>92400</td>
        <td>106000</td>
        <td>123000</td>
      </tr>
      <tr>
        <td>12 на 12</td>
        <td>276000</td>
        <td>342000</td>
        <td>418000</td>
        <td>485000</td>
        <td>552000</td>
      </tr>
    </tbody>
  </table>
</div>

javascript
  • 1 个回答
  • 50 Views
Martin Hope
steep
Asked: 2023-04-05 16:34:03 +0000 UTC

如何连接lightGallery?

  • 5

你需要在一个页面上连接多个画廊,只有第一个使用id,这是可以理解的。而且我不能切换到课程,这是行不通的。

<div id="gallery">
    <a href="img/img1.jpg">
        <img src="img/thumb1.jpg" />
    </a>
    <a href="img/img2.jpg">
        <img src="img/thumb2.jpg" />
    </a>
    ...
</div>

<div id="gallery">
    <a href="img/img1.jpg">
        <img src="img/thumb1.jpg" />
    </a>
    <a href="img/img2.jpg">
        <img src="img/thumb2.jpg" />
    </a>
    ...
</div>

<script>
lightGallery(document.getElementById('gallery'), {
...
});
</script>

代码笔上的例子

javascript
  • 1 个回答
  • 19 Views
Martin Hope
steep
Asked: 2023-01-07 18:41:53 +0000 UTC

如何通过单独的按钮激活图库,而不是通过单击图片?

  • 5

连接的材料盒画廊https://materializecss.com/media.html

如何从一个单独的按钮激活它,而不是通过点击图片?

$('.materialboxed').materialbox();
.btn {
    position: absolute;
    top: 10%;
    background: #fff;
    left: 10%;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/css/materialize.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>

<img class="materialboxed" width="650" src="https://materializecss.com/images/sample-1.jpg">
<a href="#" class="btn">увеличить</a>

jquery
  • 1 个回答
  • 20 Views
Martin Hope
steep
Asked: 2022-08-07 19:10:08 +0000 UTC

如何设置滑块?

  • 0

如何将第二个滑块设置为可见?

var sections = document.querySelectorAll('.section_img');
var slides = document.querySelectorAll('.slider_img');
var lastIndicator = sections[0].firstElementChild;
sections.forEach(section => {
  section.addEventListener('mouseenter', mouseEnterHandler);
  section.addEventListener('mouseleave', mouseLeaveHandler);
})
function mouseEnterHandler(e) {
  lastIndicator.classList.remove('indicator_full');
  e.target.firstElementChild.classList.add('indicator_full');
  changeSlide(e.target);
}
function mouseLeaveHandler(e) {
  lastIndicator = e.target.firstElementChild;
}
function changeSlide(section) {
  slides.forEach(slide => {
    if (section.dataset.for == slide.id)
      slide.classList.remove('hidden');
    else
      slide.classList.add('hidden');
  })
}
.slider {
    height: 100vh;
    display: flex;
    width: 40%;
    position: relative;
    float: left;
    margin: 5%;
}
.slider_img {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
  transition: 1s;
  opacity: 1;
}
.section_img {
  z-index: 1;
  flex-grow: 1;
  margin: 0.2rem;
  display: flex;
  align-items: flex-end;
}
.indicator {
    width: 100%;
    height: 3px;
    background-color: #fff;
    transition: 0.3s;
    opacity: 0.7;
    border-radius: 2px;
}
.indicator_full {
  background-color: #ef5350;
}
.hidden {
  opacity: 0;
}
<div class="slider">
  
<img src="https://images.unsplash.com/photo-1568781270237-f7e90fad3d2e" class="slider_img" id="bg-1">
<img src="https://images.unsplash.com/photo-1570342457319-f17b8f92df09" class="slider_img hidden" id="bg-2">
  <div class="section_img" data-for="bg-1">
    <div class="indicator indicator_full"></div>
  </div>
  <div class="section_img" data-for="bg-2">
    <div class="indicator"></div>
 </div>
  
</div>


<div class="slider">
  
<img src="https://images.unsplash.com/photo-1568438350562-2cae6d394ad0" class="slider_img" id="bg-3">
<img src="https://images.unsplash.com/photo-1569742676615-3cbdc18ce09e" class="slider_img hidden" id="bg-4">
  <div class="section_img" data-for="bg-3">
    <div class="indicator indicator_full"></div>
  </div>
  <div class="section_img" data-for="bg-4">
    <div class="indicator"></div>
 </div>
  
</div>

javascript
  • 1 个回答
  • 20 Views
Martin Hope
steep
Asked: 2022-07-26 04:32:46 +0000 UTC

如何将文本复制到剪贴板?

  • 0

function CopyToClipboard(containerid) {
if (document.selection) { 
    var range = document.body.createTextRange();
    range.moveToElementText(document.getElementById(containerid));
    range.select().createTextRange();
    document.execCommand("Copy"); 

} else if (window.getSelection) {
    var range = document.createRange();
     range.selectNode(document.getElementById(containerid));
     window.getSelection().addRange(range);
     document.execCommand("Copy");
}}
<button id="button1" onclick="CopyToClipboard('copy1')">Click to copy1</button>
<div id="copy1" >Новинка!111</div>

<button id="button2" onclick="CopyToClipboard('copy2')">Click to copy2</button>
<div id="copy2" >Новинка!222</div>

只复制第一个。div

javascript jquery
  • 1 个回答
  • 32 Views
Martin Hope
steep
Asked: 2022-07-04 03:00:12 +0000 UTC

单击时更改图像?

  • 0

如何制作相同的图片替换效果,只在点击时?可能toggleClass应该使用,但如何?

$(".card-image").click(function() {
  $(".card-image img").toggleClass("transparent");
});
.card-image img {
  display: block;
  border-radius: 2px 2px 0 0;
  position: relative;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  width: 100%;
}

.card-image img.first {
  position: absolute;
  opacity: 0;
  transition: all 0.5s ease;
}

.card-image:hover img.first {
  opacity: 1;
  transition: all 0.5s ease;
}

.card-image img.second {
  transition: all 0.5s ease;
}

.card-image:hover img.second {
  opacity: 0;
  transition: all 0.5s ease;
  transform: scale(0, 1);
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class="card-image">
  <img class="second" src="https://isstatic.askoverflow.dev/kSOSd.jpg">
  <img class="first" src="https://isstatic.askoverflow.dev/17BmD.jpg">
</div>

javascript jquery
  • 1 个回答
  • 50 Views
Martin Hope
steep
Asked: 2022-06-28 22:45:35 +0000 UTC

如何从表单中获取数据?

  • 0
<label for="step0-1" class="pick-item met">             
    <input class="pick-item__input" type="radio" name="step0" id="step0-1" value="металл"><span>металл</span>
</label>
<label for="step0-2" class="pick-item met">             
    <input class="pick-item__input" type="radio" name="step0" id="step0-2" value="дерево"><span>дерево</span>
</label>
<label for="step0-3" class="pick-item met">             
    <input class="pick-item__input" type="radio" name="step0" id="step0-3" value="пластик"><span>пластик</span>
</label>

<?php
    $step0 = stripcslashes($_POST['step0']);
    mail('mail@mail.ru', $subject, $step0, $headers);
?>

如何选择多个input并进入php?如果更改radio为checkbox,则仅发送最后一个value

html php
  • 1 个回答
  • 16 Views
Martin Hope
steep
Asked: 2022-05-01 17:37:40 +0000 UTC

如果 id 在 scrollIntoView 中不存在则出错

  • 0

使用代码

    document.getElementById('full'+$(this).data('id')).scrollIntoView({
    behavior: "smooth",
    block:    "start" 
    }); 

但是如果页面上没有id,就会出现错误

未捕获的类型错误:无法读取 null 的属性“scrollIntoView”

怎么办,如果有id,代码工作,如果没有,那么没有,并且没有错误。

javascript
  • 1 个回答
  • 10 Views
Martin Hope
steep
Asked: 2022-04-28 01:23:42 +0000 UTC

如何获取mp3文件的id3信息?

  • -1

我已将此文件连接到收集 id3。如何从此文件title中获取artist曲目?

<?php
class id3v2{
var $TargetSrcFile;
var $TargetNamFile;
var $mpegInfo;
var $id3v2Info;
var $conf;
var $jumps=3;

var $Codes=array();     //  defined in arrays.php
var $Tipus=array();     //  "   "       
var $FX=array();        //  "   "       
var $LookGenre=array();     //  "   "
var $HexPictureType=array();    //  "   "
var $LookHeaderFlags=array();   //  "   "
var $Emphasis=array();      //  "   "
var $ChannelMode=array();   //  "   "
var $Intensity=array();     //  "   "
var $LookAudioVersion=array();  //  "   "
var $LookLayerDescrip=array();  //  "   "
var $LookBitrateValues=array(); //  "   "
var $LookBitrateIndex=array();  //  "   "
var $LookFrameLen=array();  //  "   "
    
    function id3v2(){
    include("arrays.php");
    }

    function OpenFile($src){
        $this->TargetNamFile=$src;
        $this->TargetSrcFile=false;
        $this->mpegInfo=array();
        $this->id3v2Info=array();
        $this->id3v1Info=array();
        $this->conf=array();
        $this->TargetSrcFile = @fopen($this->TargetNamFile, 'rb');
        $FileSize=0;
        if ($this->TargetSrcFile) $FileSize=filesize($this->TargetNamFile);
        if ($FileSize<(100*1024)){
        return false;
        }
        else{
        $this->conf['FileSize']=$FileSize;
        $this->conf['DecodeTime']=$this->myMicrotime();
        return true;
        }
    }

    function CloseFile(){
        $this->conf['DecodeTime']=$this->myMicrotime()-$this->conf['DecodeTime'];
        fclose($this->TargetSrcFile);
    }

    function myBigEndian2IntSyn($byteword) {
        $intvalue = 0;
        $bytewordlen = strlen($byteword);
        for ($i=0;$i<$bytewordlen;$i++) {
        $intvalue = $intvalue | ((ord($byteword{$i})) & bindec('01111111')) << (($bytewordlen - 1 - $i) * 7);
        }
        return $intvalue;
    }
    
    function myHex2IntSyn($hex){
    $int = base_convert($hex, 16, 10);
    $int1 = floor($int/256) * 128 + ($int%256);
    $int2 = floor($int1/32768) * 16384 + ($int1%32768);
    $int = floor($int2/4194304) * 2097152 + ($int2%4194304);
    return $int;
    }
    

    function myBigEndian2Int($byteword) {
        $intvalue = 0;
        $bytewordlen = strlen($byteword);
        for ($i=0;$i<$bytewordlen;$i++) {
        $intvalue += ord($byteword{$i}) * pow(256, ($bytewordlen - 1 - $i));
        }
    return $intvalue;
    }

    function myStrBin2Bin($byteword) {
        $binvalue = "";
        $bytewordlen = strlen($byteword);
        for ($i=0;$i<$bytewordlen;$i++) {
            $binvalue .= str_pad(decbin(ord(substr($byteword, $i, 1))), 8, "0", STR_PAD_LEFT);
        }
        return $binvalue;
    }
    
    function myPrint($thisvar,$color){
        echo '<pre style="color:'.$color.'">';
        print_r($thisvar);
        echo "</pre>";
    }

    function myMicrotime() {
        list($usec, $sec) = explode(' ', microtime()); 
    return ((float)$usec + (float)$sec); 
    }

    function GetGenre($genreid) {
        if ($genreid == 'RX'){
        return 'Remix';
        }
        elseif($genreid == 'CR'){
        return 'Cover';
        }
        else{
        $genreid = (int)$genreid;
        }
        $thatgenreid=(isset($this->LookGenre[$genreid]) ? $this->LookGenre[$genreid] : $genreid);
        if ($thatgenreid>147)  $thatgenreid='Unknown';
        return $thatgenreid;
    }

    function myPutKeys($KeysA,$oldArray){
        for ($i=0;$i<count($KeysA);$i++){
        $newArray[$KeysA[$i]]=$oldArray[$i];
        }
    return $newArray;
    }

    function ExtractInfo($Class,$SubClass,$Content){
    switch ($Class){
        case '2':
        $val = unpack ("A1Encoding/a*Value", $Content);
        break;
        case '3':
        $valA = unpack ("A1Encoding/a*Value", $Content);
        $valB = $this->myPutKeys(array("Description","Value"),explode(chr(0),$valA['Value']));
        $val=array_merge($valA,$valB);
        break;
        case '4':
        $val['Value'] = $Content;
        break;
        case '0':
        $val['Value'] = $Content;
        break;
        case '5':  
        $valA = unpack ("A1Encoding/a3Lang/a*Value", $Content);
        $valB = $this->myPutKeys(array("Description","Value"),explode(chr(0),$valA['Value']));
        $val=array_merge($valA,$valB);
        break;
        case '13':  
        $val = unpack ("A1Encoding/a3Lang/a*Value", $Content);
        break;
        case '8':
        $val['Encoding']=substr($Content,0,1);
        $Content=substr($Content,1);
        $pos=strpos($Content,chr(0));
        $val['MIMEtype']=substr($Content,0,$pos);
        $Content=substr($Content,$pos+1);
        $pos=strpos($Content,chr(0));
        $val['Filename']=substr($Content,0,$pos);
        $Content=substr($Content,$pos+1);
        $pos=strpos($Content,chr(0));
        $val['Description']=substr($Content,0,$pos);
        $val['Value']=substr($Content,$pos+1);
        break;
        case '7':
        $val['Encoding']=substr($Content,0,1);
        $Content=substr($Content,1);
        $pos=strpos($Content,chr(0));
        $val['MIMEtype']=substr($Content,0,$pos);
        $Content=substr($Content,$pos+1);
        $val['Picturetype']=substr($Content,0,1);
        $Content=substr($Content,1);
        $pos=strpos($Content,chr(0));
        $val['Description']=substr($Content,0,$pos);
        $val['Value']=substr($Content,$pos+1);
        break;
        case '12':
        $val['Encoding']=substr($Content,0,1);
        $val['ImageFormat']=substr($Content,1,3);
        $val['Picturetype']=substr($Content,4,1);
        $Content=substr($Content,5);
        $pos=strpos($Content,chr(0));
        $val['Description']=substr($Content,0,$pos);
        $val['Value']=substr($Content,$pos+1);
        break;
        case '1':
        $val = $this->myPutKeys(array("Owner","Value"),explode(chr(0),$Content));
        break;
        case '10':
        $tempCont=strtolower(substr($Content,0,12));
        $pos=strpos($tempCont,"http");
        if ($pos===false) $pos=strpos($tempCont,"mail");
        $val['FrameId']=substr($Content,0,$pos);
        $Content=substr($Content,$pos);
        $pos=strpos($Content,chr(0));
        $val['URL']=substr($Content,0,$pos);
        $val['Value']=substr($Content,$pos+1);
        break;
        case '9':
        if ($Subclass=='2'){
        $pos=strpos($Content,chr(0));
        $val['Email']=substr($Content,0,$pos);
        $Content=substr($Content,$pos+1);
        $val['Rating']=substr($Content,0,1);
        $val['Value']=substr($Content,1);
        }
        else{
        $val['Value']=substr($Content,0);
        }
        break;
        case '11':
        $val['Encoding']=substr($Content,0,1);
        $Content=substr($Content,1);
        $pos=strpos($Content,chr(0));
        $val['Price']=substr($Content,0,$pos);
        $Content=substr($Content,$pos+1);
        if ($SubClass=='2'){
        $pos=strpos($Content,chr(0));
        $val['ValidAndUrl']=substr($Content,0,$pos);
        $Content=substr($Content,$pos+1);
        $val['ReceivedAs']=substr($Content,0,1);
        $Content=substr($Content,1);
        $pos=strpos($Content,chr(0));
        $val['seller']=substr($Content,0,$pos);
        $Content=substr($Content,$pos+1);
        $pos=strpos($Content,chr(0));
        $val['Description']=substr($Content,0,$pos);
        $Content=substr($Content,$pos+1);
        $val['MIME type']=substr($Content,0,1);
        $val['Value']=substr($Content,1);
        }
        else{
        $val['DateAndSeller']=substr($Content,$pos+1);
        }
        break;
        default:
        $val['Value']=$Content;
        break;
        }
    return $val;
    }

    function GoodFrame($namelen,$FrameId,$str){
    $FrameId=strrev($FrameId);
        for ($i=0;$i<strlen($FrameId);$i++){
        $ordX=ord(substr($FrameId,$i,1));
            if ($i>0){
                if ($ordX<65 || $ordX>90){  //only [A-Z]
                return false;
                }
            }
            else{
                if (($ordX<48 || $ordX>90) || ($ordX>57 && $ordX<65)){ //[A-Z] and numbers
                return false;
                }
            }
        }
    return true;
    }
    
    function MpegGoodHeader($tempHeader){
        $Byte1=ord(substr($tempHeader,0,1));
        $Byte2=ord(substr($tempHeader,1,1));
        $Byte3=ord(substr($tempHeader,2,1));
            if ($Byte1==255 && $Byte2>223 && $Byte3<240){
            return true;
            }
            else{
            return false;
            }
    }
    
    function ProcesId3v2(){
        rewind($this->TargetSrcFile);
        $this->conf['Id3v2HeaderPos']=0;
        $this->conf['Id3v2FramesPos']=0;
        $Id3Header = fread ($this->TargetSrcFile, 10);
        $val = unpack ("a3FileIdentifier/C1MayorVersion/C1MinorVersion/a1Flags/H8TagLen", $Id3Header);
            if ($val['FileIdentifier']=="ID3"){
            $this->conf['FileIdentifier']="WithID3v2";
                if ($val['MayorVersion']<=2){
                $this->conf['MajorVersion']=2;
                $this->conf['FrameNameLen']=3;
                $this->conf['FrameFlagLen']=0;
                $this->conf['PaddingBreakStr']=chr(0).chr(0).chr(0);
                }
                else{
                $this->conf['MajorVersion']=4;
                $this->conf['FrameNameLen']=4;
                $this->conf['FrameFlagLen']=2;
                $this->conf['PaddingBreakStr']=chr(0).chr(0).chr(0).chr(0);
                    if ($val['MayorVersion']>4){
                    $this->conf['BiggerMajorVersion']=$this->conf['MajorVersion'];
                    }
                }
            $this->conf['MinorVersion']=$val['MinorVersion'];
            $StrFlags=$this->myStrBin2Bin($val['Flags']);
            $this->conf['HasSynchro']   = $this->LookHeaderFlags[$this->conf['MajorVersion']]['HasSynchro'][substr($StrFlags,0,1)];
            $this->conf['HasExtHeader'] = $this->LookHeaderFlags[$this->conf['MajorVersion']]['HasExtHeader'][substr($StrFlags,1,1)];
            $this->conf['Experimental'] = $this->LookHeaderFlags[$this->conf['MajorVersion']]['Experimental'][substr($StrFlags,2,1)];
            $this->conf['HasFooter']    = $this->LookHeaderFlags[$this->conf['MajorVersion']]['HasFooter'][substr($StrFlags,3,1)];
            $this->conf['FramesLen']=$this->myHex2IntSyn($val['TagLen']);
                if ($this->conf['FramesLen']>=$this->conf['FileSize']){
                $this->conf['FramesLen']=0;
                $this->conf['OffpaddingBreak']=0;
                $this->conf['FileIdentifier']='BadId3';
                }
                else{
                $this->conf['Id3v2FramesPos']=10;
                }
            }
            else{
            $this->conf['FramesLen']=0;
            $this->conf['OffpaddingBreak']=0;
            $this->conf['FileIdentifier']="NoID3v2";
            }
    
    
        if($this->conf['FileIdentifier']=='WithID3v2'){
        fseek($this->TargetSrcFile,$this->conf['Id3v2FramesPos']);
        $framedata=fread($this->TargetSrcFile,$this->conf['FramesLen']);
        $i=0;
        $Xoffset=0;
        $XoffsetAcu=0;
        $ready=false;
        $modified=false;
        $FrameDataLen=$this->conf['FramesLen'];
            while(($FrameDataLen-$XoffsetAcu)>$this->conf['FrameNameLen']){
            $TempTagLen=$FrameDataLen-$XoffsetAcu;
            $PrevFrameId=$FrameId;
            $FrameId=substr($framedata, 0, $this->conf['FrameNameLen']);
            if ($FrameId==$this->conf['PaddingBreakStr']){
            break;
            }
            elseif (strpos(strtolower($FrameId),"mp3")!==false){
            break;
            }
            else{
            $num=0;
                if ($this->GoodFrame($this->conf['FrameNameLen'],$FrameId,"ini")==false){
                $ready=false;
                    if ($modified==false && $this->conf['FrameNameLen']==4 && $this->GoodFrame(3,substr($FrameId,0,3),"v3")==true){
                        $XtempSize=$this->myBigEndian2Int(substr($framedata,3, 3));
                        if ($XtempSize<=$TempTagLen){
                        $FrameId=substr($FrameId,0,3);
                        $this->conf['MajorVersionAlt']=2;
                        $this->conf['FrameNameLen']=3;
                        $this->conf['FrameFlagLen']=0;
                        $this->conf['PaddingBreakStr']=chr(0).chr(0).chr(0);
                        $tempSize=$XtempSize;
                        $ready=true;
                        }
                    $modified=true; //solo una vez
                    }
                }
                else{
                $ready=true;
                $tempSize=$this->myBigEndian2Int(substr($framedata,$this->conf['FrameNameLen'], $this->conf['FrameNameLen']));
                    if ($tempSize>$TempTagLen){
                    $ready=false;
                    }
                }
                if ($ready==false){
                $num=0;
                $notappend=false;
                    while($ready==false){
                    $FrameId=substr($framedata, $num, $this->conf['FrameNameLen']);
                        if ($this->GoodFrame($this->conf['FrameNameLen'],$FrameId,"error")==true){
                            $tempSize=$this->myBigEndian2Int(substr($framedata,$num+$this->conf['FrameNameLen'], $this->conf['FrameNameLen']));
                            if ($tempSize<=$TempTagLen){
                            $ready=true;
                            break;
                            }
                        }
                    if (($TempTagLen-$num)<=0){
                    $notappend=true;
                    $ready=true;
                    break;
                    }
                    $num++;
                    }
                }
            }
            if ($notappend==false){
                if ($num>0){
                $previndex=count($this->id3v2Info[$PrevFrameId]['info'])-1;
                $this->id3v2Info[$PrevFrameId]['info'][$previndex]['adddata']=$num;
                $this->id3v2Info[$PrevFrameId]['info'][$previndex]['Value'].=substr($framedata,0,$num);
                }
            $inipos=$this->conf['FrameNameLen']*2;
            $Flags=substr($framedata, $inipos, $this->conf['FrameFlagLen']);
            $index=count($this->id3v2Info[$FrameId]['info']);
            $inipos+=$this->conf['FrameFlagLen'];
            $Content=substr($framedata,$inipos,$tempSize);
            $SyncData=0;
            if ($this->conf['HasSynchro']==2){
            $SyncData=substr_count($Content,chr(255).chr(0));
            if ($SyncData>0){
            $inipos+=$tempSize;
            $Content.=substr($inipos,$SyncData);
            }
            }
            $this->id3v2Info[$FrameId]['LongName']=isset($this->FX[$FrameId]['LongName']) ? $this->FX[$FrameId]['LongName'] : 'unkwonw';
            $this->id3v2Info[$FrameId]['info'][$index]=$this->ExtractInfo($this->FX[$FrameId]['Class'],$this->FX[$FrameId]['SubClass'],$Content);
            $this->id3v2Info[$FrameId]['info'][$index]['Size']=$tempSize;
            if ($SyncData>0){
            $this->id3v2Info[$FrameId]['info'][$index]['SyncData']=$SyncData;
            }
            }
            else{
            //echo "fallo en id3";
            }
            
            $Xoffset=($this->conf['FrameNameLen']*2)+$this->conf['FrameFlagLen']+$tempSize+$num+$SyncData;
            $XoffsetAcu+=$Xoffset;
            $framedata=substr($framedata,$Xoffset);
            $i++;
            if ($i>100) break;
        }
        
        $this->conf['MpegHeaderPos']=$this->conf['Id3v2FramesPos']+$this->conf['FramesLen'];
        fseek($this->TargetSrcFile,$this->conf['MpegHeaderPos']);
        $temp=fread($this->TargetSrcFile,4);
            if (bin2hex($temp)=='00000000'){
            $this->conf['OffPaddingPos']=$this->conf['MpegHeaderPos'];
            $this->conf['MpegHeaderPos']+=4;
            $ready=false;
                while ($ready===false){
                $temp=fread($this->TargetSrcFile,500);
                $ready=strpos($temp,chr(255));
                if ($ready===false)$this->conf['MpegHeaderPos']+=500;
                else $this->conf['MpegHeaderPos']+=$ready;
                }
            $this->conf['OffPaddingLen']=$this->conf['MpegHeaderPos']-$this->conf['OffPaddingPos'];
            }
        $this->conf['OffpaddingBreak']=$this->conf['MpegHeaderPos'];
        }
    }

    function ProcesMpeg(){
    fseek($this->TargetSrcFile,$this->conf['OffpaddingBreak']);
    $this->conf['tempHeader']=fread($this->TargetSrcFile,4);
    $ready=false;
    $y=0;
    $i=0;
    $x=0;
        while($ready==false){
            if($this->conf['MpegHeaderPos']>=$this->conf['FileSize']) $i=50;
            if ($this->MpegGoodHeader($this->conf['tempHeader'])==true){
            $this->mpegInfo=$this->ReadMpegHeader($this->conf['tempHeader']);
                $HasXing=false;
                $HasVbri=false;
                if ($y<=2){
                $temp=fread($this->TargetSrcFile,36);
                $HasXing=strpos($temp,"Xing");
                $HasVbri=strpos($temp,"VBRI");
                }
                if ($HasXing!==false || $HasVbri!==false){
                $ready=true;
                break;
                }
                elseif ($this->mpegInfo['ThisFramelen']>0){
                    if ($this->jumpMpegHeader($this->conf['MpegHeaderPos'],$this->mpegInfo['ThisFramelen'])){
                    $ready=true;
                    break;
                    } 
                    else{
                    $i++;
                    $this->LookforMpegHeader();
                    }
                }
                else{
                $i++;
                $this->LookforMpegHeader();
                }
            $y++;   
            }
            else{
            $i++;
            $this->LookforMpegHeader();
            }
            if ($i>=50){
            break;
            }
        }
        if ($ready){
        $this->conf['OffFileLen']=$this->conf['MpegHeaderPos']-$this->conf['OffpaddingBreak'];
        $this->ReadMoreMpegHeader($this->conf['tempHeader']);
        $this->Getid3v1();
        $this->GetVbr();
        $this->GetPlayTime();
        }
        else{
        $this->conf['FileIdentifier']="MaybeNoMP3file";
        }
    }

    function Getid3v1(){
        fseek($this->TargetSrcFile, -128, SEEK_END);
        $id3v1tag = fread($this->TargetSrcFile, 128);
        $id3v1name    = trim(substr($id3v1tag,  0, 3));
        if ($id3v1name=="TAG" || $id3v1name=="ID3"){
        $this->id3v1Info['exist']=1;
        $this->id3v1Info['title']   = trim(substr($id3v1tag,  3, 30));
        $this->id3v1Info['artist']  = trim(substr($id3v1tag, 33, 30));
        $this->id3v1Info['album']   = trim(substr($id3v1tag, 63, 30));
        $this->id3v1Info['year']    = trim(substr($id3v1tag, 93,  4));
        $id3v1com = substr($id3v1tag, 97, 30);
            if ((substr($id3v1com , 28, 1) === chr(0)) && (substr($id3v1com , 29, 1) !== chr(0))) {
                $this->id3v1Info['track'] = ord(substr($id3v1com , 29, 1));
                $id3v1com  = substr($id3v1com , 0, 28);
            }
        $id3v1genre = ord(substr($id3v1tag, 127, 1));   
        $this->id3v1Info['comment'] = trim($id3v1com );
        $this->id3v1Info['genreID'] = $id3v1genre;
        $this->id3v1Info['genre'] = $this->GetGenre($id3v1genre);
        }
        else{
        $this->id3v1Info['exist']=0;
        return false;
        }
    }

    function GetPlayTime(){
        $this->mpegInfo['PlaySeconds']=($this->mpegInfo['AudioBytes']*8)/($this->mpegInfo['BitrateDec']*1000);
        $temptime=$this->mpegInfo['PlaySeconds'];
        $horas=floor($temptime/3600);
        $h=" ";$m="";$s="";
        if ($horas<10) $h=0;
        $temptime-=(3600*$horas);
        $minutos=floor($temptime/60);
        if ($minutos<10) $m=0;
        $temptime-=(60*$minutos);
        $segundos=floor($temptime);
        if ($segundos<10) $s=0;
        $this->mpegInfo['PlayTime']=sprintf($h."%d:".$m."%d:".$s."%d",$horas,$minutos,$segundos);
    }

    function GetVbr(){
        if ($this->mpegInfo['AudioVersion'] == 'MPEG1') {
            if ($this->mpegInfo['ChannelMode'] == 'Single channel') $VBRidOffset = 17; 
            else $VBRidOffset = 32; 
        } else { // 2 or 2.5
            if ($ChannelMode == 'Single channel') $VBRidOffset = 9;  
            else $VBRidOffset = 17; 
        }
    fseek($this->TargetSrcFile,$this->conf['MpegHeaderPos']+4+$VBRidOffset);
    $vbrMethod = fread($this->TargetSrcFile, 4);
        if ($vbrMethod=='Xing'){
        $this->mpegInfo['vbrMethod']=$vbrMethod;
        $vbrFlags = fread($this->TargetSrcFile, 4);
        $vbrByte4 = $this->myStrBin2Bin(substr($vbrFlags,3,1));
        $vbr['frames']    = substr($vbrByte4, 4, 1);
        $vbr['bytes']     = substr($vbrByte4, 5, 1);
        $vbr['toc']       = substr($vbrByte4, 6, 1);
        $vbr['vbr_scale'] = substr($vbrByte4, 7, 1);
        $vbrAudio=fread($this->TargetSrcFile, 8);
        
            $uno=$this->myBigEndian2Int(substr($vbrAudio,0,4));
            $dos=$this->myBigEndian2Int(substr($vbrAudio,4,4));
            
            if ($uno>0 && $dos>0){
                if ($dos>$uno){
                //echo "vbr dos mayor";
                $this->mpegInfo['AudioBytes']=$dos;
                $this->mpegInfo['AudioFrames']=$uno;
                }
                else{
                $this->mpegInfo['AudioBytes']=$uno;
                $this->mpegInfo['AudioFrames']=$dos;
                }
                if (($this->mpegInfo['AudioBytes'])>$this->conf['FileSize']){
                $this->mpegInfo['LostAudio']=round((($this->mpegInfo['AudioBytes']/$this->conf['FileSize'])*100)-100);
                if ($this->mpegInfo['LostAudio']>10){
                $this->mpegInfo['vbrMethod']='VeryBadXing';
                $this->mpegInfo['BitrateDec']=$this->mpegInfo['Bitrate'];
                $this->mpegInfo['AudioBytes']=$this->conf['FileSize']-($this->id3v1Info['exist']*128)-$this->conf['MpegHeaderPos'];
                $this->conf['FileIdentifier'] = 'MaybeNoID3file';
                }
                }
            
                
            }
            else{
            $this->mpegInfo['vbrMethod']='BadXing';
            $this->mpegInfo['BitrateDec']=$this->mpegInfo['Bitrate'];
            $AudioBytes=$this->conf['FileSize']-($this->id3v1Info['exist']*128)-$this->conf['MpegHeaderPos'];
                if ($dos>(($AudioBytes/3)*2)){
                $this->mpegInfo['AudioBytes']=$dos;
                }
                else{
                $this->mpegInfo['AudioBytes']=$AudioBytes;
                }
            }
        }
        elseif ($vbrMethod=='VBRI'){
        $this->mpegInfo['vbrMethod']=$vbrMethod;
        }
        else{
        $this->mpegInfo['vbrMethod']='CBR';
        $this->mpegInfo['BitrateDec']=$this->mpegInfo['Bitrate'];
        $this->mpegInfo['AudioBytes']=$this->conf['FileSize']-($this->id3v1Info['exist']*128)-$this->conf['MpegHeaderPos'];
        if($this->mpegInfo['MaybeVbr']==1){
        $this->mpegInfo['vbrMethod']='UnkVBR';
        $this->mpegInfo['BitrateDec']=$this->CalculateVbr($this->conf['MpegHeaderPos'],$this->mpegInfo['ThisFramelen']);
        $this->mpegInfo['AudioBytes']=$this->conf['FileSize']-($this->id3v1Info['exist']*128)-$this->conf['MpegHeaderPos'];
        }
        }
        
        //if ($vbrMethod=='Xing' || $vbrMethod=='VBRI'){
        if ($this->mpegInfo['vbrMethod']=='Xing'){
            $this->mpegInfo['AudioFrames']--; // don't count the Xing / VBRI frame
            $coe=0;
            if ($this->mpegInfo['AudioVersion']=="MPEG1" && $this->mpegInfo['LayerDescrip']=="LayerI"){$coe=384;}
            elseif (($this->mpegInfo['AudioVersion']=="MPEG2" || $this->mpegInfo['AudioVersion']=="MPEG2.5") && $this->mpegInfo['LayerDescrip']=="LayerIII"){$coe=576;}
            else{$coe=1152;}
            if ($coe!=0){
            $VBRBitrate=((($this->mpegInfo['AudioBytes']/$this->mpegInfo['AudioFrames']) * 8) * (($this->mpegInfo['SamplingRate'] / $coe)) / 1000);
        //echo "VBRBitrate=(((".$this->mpegInfo['AudioBytes']."/".$this->mpegInfo['AudioFrames'].") * 8) * ((".$this->mpegInfo['SamplingRate']." / ".$coe.")) / 1000)=".$VBRBitrate;
    
            $this->mpegInfo['Bitrate']=round($VBRBitrate);
            $this->mpegInfo['BitrateDec']=$VBRBitrate;
            }
        }
    
    }


    function ReadMoreMpegHeader($MpegHeader){
    $MpegHeader=substr($this->myStrBin2Bin($MpegHeader),24);
    $ChannelMode =substr($MpegHeader,0,2);
    $ModeExten   =substr($MpegHeader,2,2);
    $Copyright   =substr($MpegHeader,4,1);
    $Original    =substr($MpegHeader,5,1);
    $Emphasis    =substr($MpegHeader,6,2);
    $this->mpegInfo['ChannelMode']=$this->ChannelMode[$ChannelMode];
    if ($this->mpegInfo['ChannelMode']=='Joint stereo'){
        if($this->mpegInfo['LayerDescrip']=='LayerIII'){
        $this->mpegInfo['IntensityMSstereo']=$this->Intensity['IntensityMSstereo'][$ModeExten];
        }
        else{
        $this->mpegInfo['Band']=$SubbandsAR['Band'][$ModeExten];
        }
    }
    $this->mpegInfo['Copyright']=(int)$Copyright;
    $this->mpegInfo['Original']=(int)$Original;
    $this->mpegInfo['Emphasis']=$this->Emphasis[$Emphasis];
    }
    
    function CalculateVbr($pos,$framelen){
    $index=0;
    $jumps=30;
        while($index<$jumps){
        $pos=$pos+$framelen;
        if ($framelen==0)break;
        fseek($this->TargetSrcFile,$pos);
        $tempHeader=fread($this->TargetSrcFile,4);
            if ($this->MpegGoodHeader($tempHeader)==true){
            $ff=array();
            $mpegInfo=$this->ReadMpegHeader($tempHeader);
                if (isset($mpegInfo['ThisFramelen'])){
                $framelen=$mpegInfo['ThisFramelen'];
                $ff[$index]['framelen']=$framelen;
                $ff[$index]['bitrate']=$mpegInfo['Bitrate'];
                }
                else{
                break;
                }
            }
            else{
            break;
            }
        $index++;
        }
    
    krsort($ff);    
    $i=0;
    $tt=0;
    while (list($k,$v)=each($ff)){
    $tt+=$v['framelen'];
    if ($i>20)break;
    $i++;
    }
    reset($ff);
    $i=0;
    $xx=0;
    while (list($k,$v)=each($ff)){
    $xx+=($v['framelen']/$tt)*$v['bitrate'];
    if ($i>20)break;
    $i++;
    }
    unset($this->mpegInfo['MaybeVbr']); 
    return $xx;
    }


    function jumpMpegHeader($pos,$framelen){
    $index=0;
        while($index<$this->jumps){
        $pos=$pos+$framelen;
        if ($framelen==0)break;
        fseek($this->TargetSrcFile,$pos);
        $tempHeader=fread($this->TargetSrcFile,4);
            if ($this->MpegGoodHeader($tempHeader)==true){
            $mpegInfo=$this->ReadMpegHeader($tempHeader);
                if (isset($mpegInfo['ThisFramelen'])){
                $prevframelen=$framelen;
                $framelen=$mpegInfo['ThisFramelen'];
                    if ($framelen>$prevframelen+2 || $framelen<$prevframelen-2){
                    $this->mpegInfo['MaybeVbr']=1;
                    }
                }
                else{
                break;
                }
            }
            else{
            break;
            }
        $index++;
        }
        if ($index==$this->jumps)   return true;
        else return false;
    }


    function LookforMpegHeader(){
    $this->conf['MpegHeaderPos']+=1;
    fseek($this->TargetSrcFile,$this->conf['MpegHeaderPos']);
    $ready=false;
    while ($ready==false){
    if($this->conf['MpegHeaderPos']>=$this->conf['FileSize']) break;
        $temp=fread($this->TargetSrcFile,1000);
        while (strlen($temp)>0){
            $x=strpos($temp,chr(255));
            if ($x===false){
            $FileOffsetLen+=1000;
            $this->conf['MpegHeaderPos']+=1000;
            break;
            }
            else{
            $this->conf['MpegHeaderPos']+=$x;
                while($ready==false){
                fseek($this->TargetSrcFile,$this->conf['MpegHeaderPos']);
                $temp2=hexdec(bin2hex(fread($this->TargetSrcFile,20)));
                    if ($temp2!=-1){
                    $ready=true;
                    }
                    else{
                    $this->conf['MpegHeaderPos']+=20;
                    }
                }
            fseek($this->TargetSrcFile,$this->conf['MpegHeaderPos']);
            $this->conf['tempHeader']=fread($this->TargetSrcFile,4);
            break;
            }
        }
    }
    }

    function ReadMpegHeader($MpegHeader){
    $HeaderBits=$this->myStrBin2Bin($MpegHeader);
    $BadSamplingRate=false;
    $mpegInfo=array();
    $mpegInfo['AudioVersion']=$this->LookAudioVersion[substr($HeaderBits,11,2)];
        if ($mpegInfo['AudioVersion']=='Reserved'){
        $mpegInfo['ThisFramelen']=0;
        }
        else{
        $mpegInfo['LayerDescrip']=$this->LookLayerDescrip[substr($HeaderBits,13,2)];
        $mpegInfo['ProtecBit']=(int)substr($HeaderBits,15,1);
        $mpegInfo['Bitrate']=$this->LookBitrateValues[$mpegInfo['AudioVersion']][$mpegInfo['LayerDescrip']][$this->LookBitrateIndex[substr($HeaderBits,16,4)]];
        $mpegInfo['SamplingRate']=$this->LookSamplingRate[$mpegInfo['AudioVersion']][substr($HeaderBits,20,2)];
            if ($mpegInfo['SamplingRate']=='Reserved'){
            $mpegInfo['ThisFramelen']=0;
            }else{
            $mpegInfo['PaddingBit']=(int)substr($HeaderBits,22,1);
            $coef=$this->LookFrameLen[$mpegInfo['AudioVersion']][$mpegInfo['LayerDescrip']]['coef'];
            $slotlen=$this->LookFrameLen[$mpegInfo['AudioVersion']][$mpegInfo['LayerDescrip']]['slotlen'];
            $FrameLengthInBytes = ($coef * $mpegInfo['Bitrate'] * 1000 / $mpegInfo['SamplingRate'] + $mpegInfo['PaddingBit']) * $slotlen;
            $mpegInfo['ThisFramelen']=floor($FrameLengthInBytes);
            }
        }
    return $mpegInfo;
    }

    function ShowInfo(){
        if (1==1){
        while (list($k,$v)=each($this->id3v2Info)){
            for($i=0;$i<count($v['info']);$i++){
            if ($k=="NCON" || $k=="GEOB" || $k=="APIC" || $k=="PIC"){
            $this->id3v2Info[$k]['info'][$i]['Value']="BetterNotShowIt";
            }
            else{
            $this->id3v2Info[$k]['info'][$i]['Value']=htmlspecialchars($this->id3v2Info[$k]['info'][$i]['Value']);
            }
            }
        }
        }
        $this->myPrint($this->conf,'red');
        $this->myPrint($this->id3v2Info,'green');
        $this->myPrint($this->mpegInfo,'blue');
        $this->myprint($this->id3v1Info,'orange');
    }
    
    function GetInfo($TargetNamFile){
        if ($this->OpenFile($TargetNamFile)){
        $this->ProcesId3v2();
        $this->ProcesMpeg();
        $this->CloseFile();
        }
    }
}//end class
?>

$sFullFileName = $_SERVER['DOCUMENT_ROOT'] . '/' . $TrackUrl;   

include ENGINE_DIR . '/classes/muz/id3v2.class.php';
$audio = new id3v2( );
$audio->GetInfo( $sFullFileName );
$id3v1 = $audio->id3v1Info;
$mpeg = $audio->mpegInfo;

$muz_beats = $parse->remove( $mpeg['Bitrate'] );
$muz_ggc = $parse->remove( $mpeg['SamplingRate'] );
$muz_lenght = $parse->remove( $mpeg['PlayTime'] );
$muz_razmer = @filesize( $sFullFileName );
$muz_search = $_POST['tags'] . " - " . $title;

使用此代码,我可以获得比特率、大小等。

以此类推,我试着这样写:

$muz_title = $parse->remove( $mpeg['title'] );
$muz_artist = $parse->remove( $mpeg['artist'] );

什么都不读

php
  • 1 个回答
  • 10 Views
Martin Hope
steep
Asked: 2022-03-10 20:05:09 +0000 UTC

如何在特定容器中制作跟随光标的悬停效果?

  • 3

示例:该条在某个块中跟随光标。最重要的是,条带不会超出块并且不会在鼠标后面垂直移动。

gif 光标

.v_p_progs {
  height: 50px;
  overflow: hidden;
  position: relative;
  border: 1px solid #000;
}

.jp-wave {
  position: absolute;
  width: 100%;
  height: 50px;
}

.jp-wave>img {
  height: 50px;
  opacity: 0.4;
  width: 100%;
}

.jp-seek-bar1 {
  position: relative;
  height: 50px;
}

.v_p_progs>div>div {
  background: rgba(0, 0, 0, 0) linear-gradient(to right, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.3) 100%) repeat scroll 0 0;
  height: 50px;
}
<div class="v_p_progs">
  <div class="jp-wave"><img src="https://isstatic.askoverflow.dev/6RCw6.jpg"></div>
  <div class="jp-seek-bar1" style="width: 100%;">
    <div class="jp-play-bar1" style="width: 33%;">
    </div>
  </div>
</div>

javascript
  • 1 个回答
  • 10 Views
Martin Hope
steep
Asked: 2022-02-25 03:51:30 +0000 UTC

如何在 React Native expo 中获取 json 文件并输出到 FlatList?

  • 2

它总是在加载,没有内容显示。

铬控制台中的错误 在此处输入图像描述

应用程序.js

import React, { Component } from 'react';
import { ActivityIndicator, FlatList, Text, View, StyleSheet } from 'react-native';

export default class App extends Component {
  constructor(props) {
    super(props);
    this.state = {
      isLoading: true
    }
  }

  componentDidMount() {
    return fetch('https://facebook.github.io/react-native/movies.json')
      .then((response) => response.json())
      .then((responseJson) => {
       // let ds = new FlatList.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
        this.setState({
          isLoading: false,
          dataSource: ds.cloneWithRows(responseJson.movies),
        }, function() {
          // do something with new state
        });
      })
      .catch((error) => {
        console.error(error);
      });
  }

  render() {
    if (this.state.isLoading) {
      return (
        <View style={{flex: 1, paddingTop: 20}}>
          <ActivityIndicator />
        </View>
      );
    }

    return (
      <View style={{flex:1,justifyContent:'center'}}>
      <FlatList
      data={this.state.data}
      keyExtractor={this._keyExtractor}
      renderItem={({item}) => <Text> {item.Begin} </Text> }
      />
      </View>
    );
  }
}

node.js
  • 1 个回答
  • 10 Views
Martin Hope
steep
Asked: 2020-04-10 04:42:08 +0000 UTC

如何在输入中输入最多 4 个字符?

  • 2

如何将输入限制为 4 个字符?

maxlength="4"注册,但它似乎只要在键盘上工作。

function addNumber(e){
	var v = $( "#pin" ).val();
	$( "#pin" ).val( v + e.value );
}
function clearForm(e){
	$( "#pin" ).val( "" );
}
#pinloginform {
    width: 320px;
    position: relative;
}

.modal-content {
    border: none;
}
.modal-footer {
    text-align: center;
    border: none;
    position: absolute;
    bottom: 50px;
    width: 100%;
}
#pinerrorhint {
    color: red;
}
#pinloginform .form-group {
    width: 300px;
    text-align: center;
    margin: 0 auto;
}
#pin {
    font-size: 50px;
    text-align: center;
    letter-spacing: 10px;
    background: transparent;
    box-shadow: none;
    margin: 0 0 30px 4px;
    color: green;
    width: 280px;
    border: 1px solid #ddd;
}
.PINbutton {
    border-radius: 50px;
    width: 80px;
    height: 80px;
    line-height: 80px;
    overflow: hidden;
	margin: 0 8px;
  border: none;
}
.PINbutton input {
    width: 80px;
    height: 80px;
    font-size: 32px;
    color: #000;
    font-style: normal;
    padding: 0 !important;
}
.pin-footer {
    position: absolute;
    bottom: 0;
    width: 100%;
    height: 50px;
    left: 0;
    box-shadow: 0 2px 2px 0 rgba(0,0,0,0.07), 0 1px 5px 0 rgba(0,0,0,0.06), 0 3px 1px -2px rgba(0,0,0,0.1);
}
.PINfooter {
    width: 33.333333%;
    text-align: center;
    font-style: normal;
    border-radius: 0;
    padding: 0;
    margin: 0;
    position: relative;
    display: inline-block;
    bottom: 0;
    height: 50px;
    line-height: 50px;
    float: left;
	border: none;
    background: transparent;
}
.PINfooter input {
    text-transform: uppercase;
    font-size: 29px;
    line-height: 0;
    float: left;
    width: 100%;
    height: 50px;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<form id="pinloginform" method="post" autocomplete='off' draggable='true'>
                    <div class="modal-body">
                        <div class="form-group">
                            <input id="pin" autocomplete="off" class="form-control" type="password" maxlength="4" placeholder="○○○○" disabled/>			
							
		<input type='button' class='PINbutton waves-effect' name='1' value='1' id='1' onClick=addNumber(this); />
		<input type='button' class='PINbutton waves-effect' name='2' value='2' id='2' onClick=addNumber(this); />
		<input type='button' class='PINbutton waves-effect' name='3' value='3' id='3' onClick=addNumber(this); />
		<br>
		<input type='button' class='PINbutton waves-effect' name='4' value='4' id='4' onClick=addNumber(this); />
		<input type='button' class='PINbutton waves-effect' name='5' value='5' id='5' onClick=addNumber(this); />
		<input type='button' class='PINbutton waves-effect' name='6' value='6' id='6' onClick=addNumber(this); />
		<br>
		<input type='button' class='PINbutton waves-effect' name='7' value='7' id='7' onClick=addNumber(this); />
		<input type='button' class='PINbutton waves-effect' name='8' value='8' id='8' onClick=addNumber(this); />
		<input type='button' class='PINbutton waves-effect' name='9' value='9' id='9' onClick=addNumber(this); />
		<br>
		<input type='button' class='PINbutton waves-effect' name='0' value='0' id='0' onClick=addNumber(this); />
							
                        </div>
                    </div>

    <div class="pin-footer">		
        <input type="button" class="waves-effect PINfooter" value='⌫' data-dismiss="modal">
		<input type='button' class='waves-effect PINfooter' name='-' value='⎚' id='-' onClick=clearForm(this); />
		<input type='submit' class='waves-effect PINfooter' name='+' value='⎆' id='pinlogin' />
    </div>    
                  
                </form>

javascript
  • 2 个回答
  • 10 Views
Martin Hope
steep
Asked: 2020-12-09 19:05:59 +0000 UTC

如何将本地存储连接到脚本?

  • 0

有一个开关:

$(".main-nav-chat .options").click(function() {
  $(".wrapperchat").toggleClass("wrapperchat-bottom");
});

如何将本地存储绑定到它以便记住该类wrapperchat-bottom?

你可以重新制作它,只要它的意思没有改变。

jquery
  • 1 个回答
  • 10 Views
Martin Hope
steep
Asked: 2020-10-08 03:23:13 +0000 UTC

如何将android连接到网站?

  • 0

有一个更新信息的网站。有一个应用程序,类似于仅用于一个站点的浏览器。我想做一个原生应用程序,但我不明白如何将它连接到站点,以便添加到站点的信息在 Android 中更新?php + mysql 中的网站。它是怎么做的?在什么程序,框架等上。有多容易?

android
  • 1 个回答
  • 10 Views
Martin Hope
steep
Asked: 2020-09-23 19:58:34 +0000 UTC

如何检查服务器上的图像是否存在?

  • 0

$artist是图片的标题

<?php

$fileurl = 'https://site.ru/images/artist/'.$artist.'.jpg';

if (is_file('$fileurl')) {
echo "<img src='/images/artist/$artist.jpg";  // Если картинка существует
} else {
echo "<img src='/images/label/thumb/user.jpg'>";  // Если картинка не существует
}
?>

为什么不断写不存在?也试过file_exists了,没有成功。所有文件都在同一台服务器上。

php
  • 3 个回答
  • 10 Views
Martin Hope
steep
Asked: 2020-03-10 19:41:42 +0000 UTC

如何将多个 m3u8 播放列表连接到播放器?

  • 3

如何在播放器中插入多个不同视频质量 360 480 的播放列表?在开发人员的网站上,它说要插入 html。

换句话说,您需要将这 2 个播放列表连接到脚本

<video controls crossorigin playsinline 
    poster="https://cdn.plyr.io/static/demo/View_From_A_Blue_Moon_Trailer-HD.jpg" 
    id="player">
<source
    src="https://bl.webcaster.pro/media/playlist/a13deaa5721c831a2b68b6983ff0100e/2_70430/480p/ca9b9125037cd539b61a2ff46366f6b0/1552260702.m3u8"
    type="video/mp4"
    size="480"
/>
<source
    src="https://bl.webcaster.pro/media/playlist/a13deaa5721c831a2b68b6983ff0100e/2_70430/360p/ca9b9125037cd539b61a2ff46366f6b0/1552260702.m3u8"
    type="video/mp4"
    size="360"
/>
</video>

单个播放列表示例

document.addEventListener('DOMContentLoaded', () => {
	
	const source = 'https://bitdash-a.akamaihd.net/content/sintel/hls/playlist.m3u8';	
	
	const video = document.querySelector('video');
	
	// For more options see: https://github.com/sampotts/plyr/#options
	// captions.update is required for captions to work with hls.js
	const player = new Plyr(video, {captions: {active: true, update: true, language: 'en'}});
	
	if (!Hls.isSupported()) {
		video.src = source;
	} else {
		// For more Hls.js options, see https://github.com/dailymotion/hls.js
		const hls = new Hls();
		hls.loadSource(source);
		hls.attachMedia(video);
		window.hls = hls;
		
		// Handle changing captions
		player.on('languagechange', () => {
			// Caption support is still flaky. See: https://github.com/sampotts/plyr/issues/994
			setTimeout(() => hls.subtitleTrack = player.currentTrack, 50);
		});
	}
	
	// Expose player so it can be used from the console
	window.player = player;
});
.container {
	margin: 40px auto;
	width: 400px;
}
video {
	width: 100%;
}
<link rel="stylesheet" type="text/css" href="https://unpkg.com/plyr@3/dist/plyr.css">
<script src="https://unpkg.com/plyr@3"></script>
<div class="container">
	<video controls crossorigin playsinline poster="https://bitdash-a.akamaihd.net/content/sintel/poster.png"></video>
</div>
<script src="https://cdn.rawgit.com/video-dev/hls.js/18bb552/dist/hls.min.js"></script>

这是我的示例https://codepen.io/stopani/pen/ZPyNKg 文档https://github.com/sampotts/plyr

javascript
  • 1 个回答
  • 10 Views

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5