algorythm的php實現的簡單介紹

本文目錄一覽:

病毒?請教?急救

這個是對他自己的介紹,順便還把你的系統的信息發出來了

203.88.222.86 你的ip

還有操作系統版本什麼的

Time of investigation: Wed Jun 13 20:05:39 MSD 2007

這是他掃描你電腦的時間 ,6月13號,星期四,20:05:39。

下面是讓你選一個他的產品下載

還介紹了一下

那邊我也翻譯了一下

解決方法也在另外一個問題那

關於夏新A660手機無法播放MP3的問題,高手請進!

自己看看下面的,你就知道為什麼不能播放了.

it just informs you how to read the MPEG headers and the MPEG TAG. MPEG Version 1, 2 and 2.5 and Layer I, II and III are supported, the MP3 TAG (ID3v1 and ID3v1.1) also..

MPEG Audio Compression Basics

MPEG standards MPEG-1, MPEG-2 and MPEG-4 are known but this document covers first two of them. There is an unofficial MPEG-2.5 which is rarely used. It is also covered.

MPEG-1 audio (described in ISO/IEC 11172-3) describes three Layers of audio coding with the following properties:

one or two audio channels

sample rate 32kHz, 44.1kHz or 48kHz.

bit rates from 32kbps up to 448kbps

Each layer has its merits.

MPEG-2 audio (described in ISO/IEC 13818-3) has two extensions to MPEG-1, usually referred as MPEG-2/LSF and MPEG-2/Multichannel.

MPEG-2/LSF has the following properties:

one or two audio channels

sample rates half those of MPEG-1

bit rates from 8 kbps up to 256kbps.

MPEG-2/Multichannel has the following properties:

up to 5 full range audio channels and an LFE-channel (Low Frequency Enhancement subwoofer!)

sample rates the same as those of MPEG-1

highest possible bitrate goes up to about 1Mbps for 5.1

MPEG Audio Frame Header

An MPEG audio file is built up from smaller parts called frames. Generally, frames are independent items. Each frame has its own header and audio informations. There is no file header. Therefore, you can cut any part of MPEG file and play it correctly (this should be done on frame boundaries but most applications will handle incorrect headers). For Layer III, this is not 100% correct. Due to internal data organization in MPEG version 1 Layer III files, frames are often dependent of each other and the y cannot be cut off just like that.

When you want to read info about an MPEG file, it is usually enough to find the first frame, read its header and assume that the other frames are the same This may not be always the case. Variable bitrate MPEG files may use so called bitrate switching, which means that bitrate changes according to the content of each frame. This way lower bitrates may be used in frames where it will not reduce sound qualit y. This allows making better compression while keeping high quality of sound.

The frame header is constituted by the very first four bytes (32bits) in a frame. The first eleven bits (or first twelve bits, see below about frame sync) of a frame header are always set and they are called “frame sync”. Therefore, you can search through the file for the first occurence of frame sync (meaning that you have to find a byte with a value of 255, and followed by a byte with its three (or four) most significant bits set). Then you read the whole header and check if the values are correct. You will see in the following table the exact meaning of each bit in the header, and which values may be checked for validity. Each value that is specified as reserved, invalid, bad, or not allowed should indicate an invalid header. Remember, this is not enough, frame sync can be easily (and very frequently) found in any binary file. Also it is likely that MPEG file contains garbage on it’s beginning which also may contain false sync. Thus, you have to check two or more frames in a row to assure you are really dealing with MPEG audio file.

Frames may have a CRC check. The CRC is 16 bits long and, if it exists, it follows the frame header. After the CRC comes the audio data. You may calculate the length of the frame and use it if you need to read other headers too or just want to calculate the CRC of the frame, to compare it with the one you read from the file. This is actually a very good method to check the MPEG header validity.

Here is “graphical” presentation of the header content. Characters from A to M are used to indicate different fields. In the table, you can see details about the content of each field.

AAAAAAAA AAABBCCD EEEEFFGH IIJJKLMM

Sign Length

(bits) Position

(bits) Description

A 11 (31-21) Frame sync (all bits set)

B 2 (20,19) MPEG Audio version ID

00 – MPEG Version 2.5

01 – reserved

10 – MPEG Version 2 (ISO/IEC 13818-3)

11 – MPEG Version 1 (ISO/IEC 11172-3)

Note: MPEG Version 2.5 is not official standard. Bit No 20 in frame header is used to indicate version 2.5. Applications that do not support this MPEG version expect this bit always to be set, meaning that frame sync (A) is twelve bits long, not eleven as stated here. Accordingly, B is one bit long (represents only bit No 19). I recommend using methodology presented here, since this allows you to distinguish all three versions and keep full compatibility.

C 2 (18,17) Layer description

00 – reserved

01 – Layer III

10 – Layer II

11 – Layer I

D 1 (16) Protection bit

0 – Protected by CRC (16bit crc follows header)

1 – Not protected

E 4 (15,12) Bitrate index

bits V1,L1 V1,L2 V1,L3 V2,L1 V2, L2 L3

0000 free free free free free

0001 32 32 32 32 8

0010 64 48 40 48 16

0011 96 56 48 56 24

0100 128 64 56 64 32

0101 160 80 64 80 40

0110 192 96 80 96 48

0111 224 112 96 112 56

1000 256 128 112 128 64

1001 288 160 128 144 80

1010 320 192 160 160 96

1011 352 224 192 176 112

1100 384 256 224 192 128

1101 416 320 256 224 144

1110 448 384 320 256 160

1111 bad bad bad bad bad

NOTES: All values are in kbps

V1 – MPEG Version 1

V2 – MPEG Version 2 and Version 2.5

L1 – Layer I

L2 – Layer II

L3 – Layer III

“free” means free format. If the correct fixed bitrate (such files cannot use variable bitrate) is different than those presented in upper table it must be determined by the application. This may be implemented only for internal purposes since third party applications have no means to findout correct bitrate. Howewer, this is not impossible to do but demands lot’s of efforts.

“bad” means that this is not an allowed value

MPEG files may have variable bitrate (VBR). This means that bitrate in the file may change. I have learned about two used methods:

bitrate switching. Each frame may be created with different bitrate. It may be used in all layers. Layer III decoders must support this method. Layer I II decoders may support it.

bit reservoir. Bitrate may be borrowed (within limits) from previous frames in order to provide more bits to demanding parts of the input signal. This causes, however, that the frames are no longer independent, which means you should not cut this fil es. This is supported only in Layer III.

More about VBR you may find on Xing Tech site

For Layer II there are some combinations of bitrate and mode which are not allowed. Here is a list of allowed combinations. bitrate allowed modes

free all

32 single channel

48 single channel

56 single channel

64 all

80 single channel

96 all

112 all

128 all

160 all

192 all

224 stereo, intensity stereo, dual channel

256 stereo, intensity stereo, dual channel

320 stereo, intensity stereo, dual channel

384 stereo, intensity stereo, dual channel

F 2 (11,10) Sampling rate frequency index (values are in Hz) bits MPEG1 MPEG2 MPEG2.5

00 44100 22050 11025

01 48000 24000 12000

10 32000 16000 8000

11 reserv. reserv. reserv.

G 1 (9) Padding bit

0 – frame is not padded

1 – frame is padded with one extra slot

Padding is used to fit the bit rates exactly. For an example: 128k 44.1kHz layer II uses a lot of 418 bytes and some of 417 bytes long frames to get the exact 128k bitrate. For Layer I slot is 32 bits long, for Layer II and Layer III slot is 8 bits long.

How to calculate frame length

First, let’s distinguish two terms frame size and frame length. Frame size is the number of samples contained in a frame. It is constant and always 384 samples for Layer I and 1152 samples for Layer II and Layer III. Frame length is length of a frame when compressed. When you are reading MPEG file you must calculate this to be able to find each consecutive frame. Remember, frame length may change from frame to frame due to padding or bitrate switching.

Read the BitRate, SampleRate and Padding (remember if padding is used in a frame it is four bytes long for Layer I or one byte long for Layer II and Layer III) of the frame header.

For Layer I files us this formula:

FrameSize = 12 * BitRate / SampleRate + Padding

For Layer II III files use this formula:

FrameSize = 144 * BitRate / SampleRate + Padding

Example:

Layer III, BitRate=128000, SampleRate=441000, Padding=0 == FrameSize=417 bytes

H 1 (8) Private bit. It may be freely used for specific needs of an application, i.e. if it has to trigger some application specific events.

I 2 (7,6) Channel Mode

00 – Stereo

01 – Joint stereo (Stereo)

10 – Dual channel (Stereo)

11 – Single channel (Mono)

J 2 (5,4) Mode extension (Only if Joint stereo)

Mode extension is used to join informations that are of no use for stereo effect, thus reducing needed resources. These bits are dynamically determined by an encoder in Joint stereo mode.

Complete frequency range of MPEG file is divided in subbands There are 32 subbands. For Layer I II these two bits determine frequency range (bands) where intensity stereo is applied. For Layer III these two bits determine which type of joint stereo is used (intensity stereo or m/s stereo). Frequency range is determined within decompression algorythm. Layer I and II Layer III

value Layer I II

00 bands 4 to 31

01 bands 8 to 31

10 bands 12 to 31

11 bands 16 to 31

Intensity stereo MS stereo

off off

on off

off on

on on

K 1 (3) Copyright

0 – Audio is not copyrighted

1 – Audio is copyrighted

L 1 (2) Original

0 – Copy of original media

1 – Original media

M 2 (1,0) Emphasis

00 – none

01 – 50/15 ms

10 – reserved

11 – CCIT J.17

MPEG Audio Tag ID3v1

The TAG is used to describe the MPEG Audio file. It contains information about artist, title, album, publishing year and genre. There is some extra space for comments. It is exactly 128 bytes long and is located at very end of the audio data. You can get it by reading the last 128 bytes of the MPEG audio file.

AAABBBBB BBBBBBBB BBBBBBBB BBBBBBBB

BCCCCCCC CCCCCCCC CCCCCCCC CCCCCCCD

DDDDDDDD DDDDDDDD DDDDDDDD DDDDDEEE

EFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFG

Sign Length

(bytes) Position

(bytes) Description

A 3 (0-2) Tag identification. Must contain ‘TAG’ if tag exists and is correct.

B 30 (3-32) Title

C 30 (33-62) Artist

D 30 (63-92) Album

E 4 (93-96) Year

F 30 (97-126) Comment

G 1 (127) Genre

The specification asks for all fields to be padded with null character (ASCII 0). However, not all applications respect this (an example is WinAmp which pads fields with space, ASCII 32).

There is a small change proposed in ID3v1.1 structure. The last byte of the Comment field may be used to specify the track number of a song in an album. It should contain a null character (ASCII 0) if the information is unknown.

Genre is a numeric field which may have one of the following values:

0 ‘Blues’ 20 ‘Alternative’ 40 ‘AlternRock’ 60 ‘Top 40’

1 ‘Classic Rock’ 21 ‘Ska’ 41 ‘Bass’ 61 ‘Christian Rap’

2 ‘Country’ 22 ‘Death Metal’ 42 ‘Soul’ 62 ‘Pop/Funk’

3 ‘Dance’ 23 ‘Pranks’ 43 ‘Punk’ 63 ‘Jungle’

4 ‘Disco’ 24 ‘Soundtrack’ 44 ‘Space’ 64 ‘Native American’

5 ‘Funk’ 25 ‘Euro-Techno’ 45 ‘Meditative’ 65 ‘Cabaret’

6 ‘Grunge’ 26 ‘Ambient’ 46 ‘Instrumental Pop’ 66 ‘New Wave’

7 ‘Hip-Hop’ 27 ‘Trip-Hop’ 47 ‘Instrumental Rock’ 67 ‘Psychadelic’

8 ‘Jazz’ 28 ‘Vocal’ 48 ‘Ethnic’ 68 ‘Rave’

9 ‘Metal’ 29 ‘Jazz+Funk’ 49 ‘Gothic’ 69 ‘Showtunes’

10 ‘New Age’ 30 ‘Fusion’ 50 ‘Darkwave’ 70 ‘Trailer’

11 ‘Oldies’ 31 ‘Trance’ 51 ‘Techno-Industrial’ 71 ‘Lo-Fi’

12 ‘Other’ 32 ‘Classical’ 52 ‘Electronic’ 72 ‘Tribal’

13 ‘Pop’ 33 ‘Instrumental’ 53 ‘Pop-Folk’ 73 ‘Acid Punk’

14 ‘RB’ 34 ‘Acid’ 54 ‘Eurodance’ 74 ‘Acid Jazz’

15 ‘Rap’ 35 ‘House’ 55 ‘Dream’ 75 ‘Polka’

16 ‘Reggae’ 36 ‘Game’ 56 ‘Southern Rock’ 76 ‘Retro’

17 ‘Rock’ 37 ‘Sound Clip’ 57 ‘Comedy’ 77 ‘Musical’

18 ‘Techno’ 38 ‘Gospel’ 58 ‘Cult’ 78 ‘Rock Roll’

19 ‘Industrial’ 39 ‘Noise’ 59 ‘Gangsta’ 79 ‘Hard Rock’

Any other value should be considered as ‘Unknown’

MPEG Audio Tag ID3v2

This is new proposed TAG format which is different than ID3v1 and ID3v1.1. Complete tech specs for it may be found at .

php怎麼實現退出

假如你說的另一個頁面叫做c.php,

你在c.php里設置cookie的時候也是這樣的嗎:

setcookie(“user”,”everalan”);

setcookie(“password”,”1111111″);

如果不是,比如setcookie(“user”, “everalan”, ‘/’, ”);即你設置了cookie的path和域。這樣的 cookie和不設置path和域的cookie是完全不一樣的兩個cookie,

setcookie(“user”,”everalan”);

setcookie(“password”,”1111111″);

並不能將其刪除,帶path和域的cookie仍然存在。你訪問A.php的時候當然還是輸出 a了

邏輯上就有問題

用戶名和密碼都是從COOKIE里讀取的,可是B已經清空COOKIE了。

你不得不重新設計一下了

原創文章,作者:小藍,如若轉載,請註明出處:https://www.506064.com/zh-hk/n/241773.html

(0)
打賞 微信掃一掃 微信掃一掃 支付寶掃一掃 支付寶掃一掃
小藍的頭像小藍
上一篇 2024-12-12 12:43
下一篇 2024-12-12 12:43

相關推薦

  • PHP和Python哪個好找工作?

    PHP和Python都是非常流行的編程語言,它們被廣泛應用於不同領域的開發中。但是,在考慮擇業方向的時候,很多人都會有一個問題:PHP和Python哪個好找工作?這篇文章將從多個方…

    編程 2025-04-29
  • Python簡單數學計算

    本文將從多個方面介紹Python的簡單數學計算,包括基礎運算符、函數、庫以及實際應用場景。 一、基礎運算符 Python提供了基礎的算術運算符,包括加(+)、減(-)、乘(*)、除…

    編程 2025-04-29
  • Python滿天星代碼:讓編程變得更加簡單

    本文將從多個方面詳細闡述Python滿天星代碼,為大家介紹它的優點以及如何在編程中使用。無論是剛剛接觸編程還是資深程序員,都能從中獲得一定的收穫。 一、簡介 Python滿天星代碼…

    編程 2025-04-29
  • Python海龜代碼簡單畫圖

    本文將介紹如何使用Python的海龜庫進行簡單畫圖,並提供相關示例代碼。 一、基礎用法 使用Python的海龜庫,我們可以控制一個小海龜在窗口中移動,並利用它的「畫筆」在窗口中繪製…

    編程 2025-04-29
  • PHP怎麼接幣

    想要在自己的網站或應用中接受比特幣等加密貨幣的支付,就需要對該加密貨幣擁有一定的了解,並使用對應的API進行開發。本文將從多個方面詳細闡述如何使用PHP接受加密貨幣的支付。 一、環…

    編程 2025-04-29
  • Python櫻花樹代碼簡單

    本文將對Python櫻花樹代碼進行詳細的闡述和講解,幫助讀者更好地理解該代碼的實現方法。 一、簡介 櫻花樹是一種圖形效果,它的實現方法比較簡單。Python中可以通過turtle這…

    編程 2025-04-28
  • 使用PHP foreach遍歷有相同屬性的值

    本篇文章將介紹如何使用PHP foreach遍歷具有相同屬性的值,並給出相應的代碼示例。 一、基礎概念 在講解如何使用PHP foreach遍歷有相同屬性的值之前,我們需要先了解幾…

    編程 2025-04-28
  • Python大神作品:讓編程變得更加簡單

    Python作為一種高級的解釋性編程語言,一直被廣泛地運用於各個領域,從Web開發、遊戲開發到人工智能,Python都扮演着重要的角色。Python的代碼簡潔明了,易於閱讀和維護,…

    編程 2025-04-28
  • 用Python實現簡單爬蟲程序

    在當今時代,互聯網上的信息量是爆炸式增長的,其中很多信息可以被利用。對於數據分析、數據挖掘或者其他一些需要大量數據的任務,我們可以使用爬蟲技術從各個網站獲取需要的信息。而Pytho…

    編程 2025-04-28
  • 如何製作一個簡單的換裝遊戲

    本文將從以下幾個方面,為大家介紹如何製作一個簡單的換裝遊戲: 1. 遊戲需求和界面設計 2. 使用HTML、CSS和JavaScript開發遊戲 3. 實現遊戲的基本功能:拖拽交互…

    編程 2025-04-27

發表回復

登錄後才能評論