PHP Music Collection (part of code)
Last Update:2018-03-17
Source: Internet
Author: User
PHP Music Collection (part of code) Set_time_limit (0 );
Mysql_connect ("localhost", "root ","");
Mysql_select_Db ("music_36g ");
$ Ip = '1970. 0.0.1 ';
Function _ GetIP ()
{
$ Ip = getenv ("REMOTE_ADDR ");
$ Ip1 = getenv ("HTTP_X_FORWARDED_FOR ");
$ Ip2 = getenv ("HTTP_CLIENT_IP ");
($ Ip1 )? $ Ip = $ ip1: null;
($ Ip2 )? $ Ip = $ ip2: null;
Return $ ip;
}
Function MakePassword ($ length = 10)
{
$ Password = '';
$ Chars =
Array
(
"1", "2", "3", "4", "5", "6", "7", "8", "9", "0 ",
"A", "A", "B", "B", "c", "C", "d", "D", "e", "E ", "f", "F", "g", "G", "h", "H", "I", "I", "j", "J ",
"K", "K", "l", "L", "m", "M", "n", "N", "o", "O ", "p", "P", "q", "Q", "r", "R", "s", "S", "t", "T ",
"U", "U", "v", "V", "w", "W", "x", "X", "y", "Y ", "z", "Z"
);
$ Count = count ($ chars)-1;
Srand (double) microtime () * 1000000 );
For ($ I = 0; $ I <$ length; $ I ++)
{
$ Password. = $ chars [rand (0, $ count)];
}
Return ($ password );
}
If (_ GetIP ()! = $ Ip)
{
Exit ("Can't Run! ");
}
For ($ I = 2; $ I <5769; $ I ++) // 52738
{
$ Url = "http://music.36g.net/SpecialInfo/showspecial". $ I. ". htm ";
$ File = @ fopen ($ url, 'RB ');
If ($ File)
{
$ MakeFile = $ buffer = "";
$ Buffer = "";
While ($ buffer = freactive ($ File, 4096 ))
{
$ MakeFile = $ makeFile. $ buffer;
}
@ Fclose ($ File );
Preg_match ("/src =\/ uppic \/(. *) width = 135/", $ makeFile, $ pic); # Image
# Download images
If ($ pic [1]! = 'Es/Nophoto.gif ')
{
$ P_url = "http://music.36g.net/uppic/". $ pic [1];
$ File2 = fopen ($ p_url, 'RB ');
If ($ File2)
{
$ Buffer2 = $ makeFile2 = "";
While ($ Buffer2 = fread ($ File2, 4096 ))
{
$ MakeFile2 = $ makeFile2. $ Buffer2;
}
Fclose ($ File2 );
$ Filename2 = './pic/'. $ pic [1];
$ Fp2 = fopen ($ Filename2, 'W + ');
Fwrite ($ Fp2, $ makeFile2 );
Fclose ($ Fp2 );
}
}
Else
{
$ Pic [1] = '';
}
Preg_match ("/Album: <\/strong> (. *) <\/td>$ Name = addslashes ($ name [1]);
Preg_match ("/Artist: <\/strong> (. *) <\/td> <\/tr>/", $ MakeFile, $ songer); # artist name
Preg_match ("/(. *) <\/td> <\/tr>/", $ Songer [1], $ songer_name); # artist name
Preg_match ("/issuer: <\/strong> (. *)/", $ songer [1], $ company); # issuer
Preg_match ("/release time <\/strong> :(. *) <\/td> <\/tr>/", $ makeFile, $ date); # release time
Preg_match ("/(. *) <\/td>/", $ date [1], $ date2); # release time
Preg_match ("/<\/strong> (. *)/", $ date [1], $ language); # release language
Preg_match ("/album Introduction: <\/strong> <\/td>(. *) <\/Td> <\/tr> <\/table>
/", $ MakeFile, $ descript); # album Introduction
$ Songer_name = addslashes ($ songer_name [1]);
$ Company = addslashes ($ company [1]);
$ Descript = addslashes ($ descript [1]);
# Obtain the Song ID
Preg_match_all ("/download1 \. asp \? Id = (\ d +) & which = BakDownUrl1/", $ makeFile, $ id2); # Song ID
$ Num = count ($ id2 [1]);
For ($ jj = 0; $ jj <$ num; $ jj ++)
{
$ SQL = "insert into tx_music set musicID = '". $ id2 [1] [$ jj]. "', specialID =' $ I ', specialName =' $ name', songerName = '$ songer_name', orderByID = '". $ id2 [1] [$ jj]. "'";
// Echo $ id2 [1] [$ jj]."
";
Mysql_query ($ SQL );
}
// Echo $ descript ."
";
$ SQL = "insert into tx_special set orderByID = '$ I', specialID = '$ I', specialName = '$ name', songerName =' $ songer_name ', company = '$ company', date = '$ date2 [1]', language = '$ language [1]', picture = '$ pic [1]', musicNum = '$ num', createDate = '". time (). "', description =' $ descript '";
Echo $ SQL;
Mysql_query ($ SQL );
}
}
?>