Thread View: be.comp.programming
1 messages
1 total messages
Started by alex
Sun, 27 Oct 2002 13:09
help met php programma
Author: alex
Date: Sun, 27 Oct 2002 13:09
Date: Sun, 27 Oct 2002 13:09
598 lines
19258 bytes
19258 bytes
This is a multi-part message in MIME format.
------=_NextPart_000_0076_01C27DC2.8B461AB0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
ik draai met een programma (SAM)=20
dir programma daar kan je muziek mee draaien en dan naar een server =
sturen
er is ook een mogelijkheid dat mensen plaatjes aan vragen
er is een play list waar de nummer's op staan.
als je nu een nummer kiest wordt deze link aangeroepen
http://www.audiorealm.com/req/req.php3?host=3D212.187.62.55&port=3D1221&d=
ir=3D&file=3DF%3A%5Cmp3%5Cnederland%5Ca%5CAD+SWART%3D%3D%27T+IS+OVER%2Emp=
3
uitleg:
212.187.62.55 (mijn ip nummer)
1221 poort
rest is de de muziek
nu wordt dze php aan geroepen
http://www.audiorealm.com/req/req.php3
per toeval krijg ik toe eens dit in beeld
dus dit zal de php zijn die je aan roept
nu zou ik dit graag op mijn eigen server willen draaien
wie zou mij kunnen helpen hier mee
m.v.g. Alex
icq:64760205
MSM:gossoft@hotmail.com
email:alex@informat.nl
email:a.devries4@chello.nl
*************************************************************************=
*************************************************************************=
*****
<?
require("../req/config.inc.php3");
IF (empty($port))
$port=3D1221;
$errno =3D 0;
$errstr =3D "";
$ipport =3D $host . ":" . $port;
$fp =3D fsockopen($host,$port, &$errno, &$errstr);
if($fp)
set_socket_blocking($fp, 1);
unset($errors);
if(!$fp) {
$errors[] =3D "Error connecting to host[$host] at port[$port]!";
} else {
$file =3D stripslashes($file);
$addr =3D getenv("REMOTE_ADDR");
=
fputs($fp,"REQ|D=3D0|FILE=3D$file|HOST=3D$remotehost|addr=3D$addr|\n\r");=
$buf .=3D fgets($fp,20);
$d =3D strpos($buf,"TUP",$p);
//Print("----<br>");
$timeout =3D 10;
$stop =3D time() + $timeout;
while (!$d && !feof($fp) && time()<$stop)
{
$buf .=3D fgets($fp,255);
$d =3D strpos($buf,"/r");
$d =3D TRUE;
//Print("$buf--[$d]-($p)----$stop=3D=3D=3D<br>");
}
fclose($fp);
}
$buf =3D str_replace("|", "&", $buf);
//Decode into variables
parse_str($buf);
IF (!empty($ERROR))
$errors[] =3D 'ERROR REASON: ' . $ERROR;
IF ((empty($dir)) OR (!file_exists($dir . "/req.htm")))
$dir =3D ".";
//Add slashes for MySQL
$fname =3D addslashes($file);
IF (empty($errors))
{
//########## LOG request to DB ##########
$sql_query =3D
"
INSERT INTO requests
(t_stamp,ipport,filename,display,count,failed)
VALUES(NULL,'$ipport','$fname','$DISPLAY',1,0)
";
//########## Show Success File ##########
$fd =3D fopen($dir . "/req.htm", "r");
while ($buffer =3D fgets($fd, 4096)) {
IF (empty($ARTIST))
$ARTIST =3D $TITLE;
$buffer =3D eregi_replace("#combine#", urlencode($DISPLAY), $buffer);
$buffer =3D eregi_replace("#artist#", urlencode($ARTIST), $buffer);
$buffer =3D eregi_replace("#title#", urlencode($TITLE), $buffer);
$buffer =3D eregi_replace("#album#", urlencode($ALBUM), $buffer);
$buffer =3D eregi_replace("@combine@", $DISPLAY, $buffer);
$buffer =3D eregi_replace("@artist@", $ARTIST, $buffer);
$buffer =3D eregi_replace("@title@", $TITLE, $buffer);
$buffer =3D eregi_replace("@album@", $ALBUM, $buffer);
echo $buffer;
}
fclose($fd);
//########## =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =
##########
}
ELSE
{
//########## LOG request to DB ##########
$sql_query =3D
"
INSERT INTO requests
(t_stamp,ipport,filename,display,count,failed)
VALUES(NULL,'$ipport','$fname','$DISPLAY',0,1)
";
//########## Show Error File ##########
unset($temp);
for($k=3D0;$k<count($errors);$k++)
$temp .=3D $errors[$k] . "<br>";
IF (empty($ERROR))
$ERROR =3D $temp;
$fd =3D fopen($dir . "/reqfail.htm", "r");
while ($buffer =3D fgets($fd, 4096)) {
$buffer =3D eregi_replace("#errors#", $temp, $buffer);
$buffer =3D eregi_replace("#errorstr#", $ERROR, $buffer);
echo $buffer;
}
fclose($fd);
//########## =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D =
##########
};
//Create persistent connection
//$link =3D mysql_pconnect($sql_hostname, $sql_mysqluser, =
$sql_mysqlpassword );
//Do the SQL request!
//$res =3D mysql_db_query($sql_db, $sql_query, $link);
?>
*************************************************************************=
*************************************************************************=
*****
<?
/* $Id: config.inc.php3,v 1.0 1999/09/20 17:08:50 tobias Exp $ */
// MySQL hostname
$sql_hostname =3D "63.98.160.35";
// MySQL username
$sql_mysqluser =3D "web";
// MySQL password
$sql_mysqlpassword =3D "audiorealm";
// The database SAM stuff lives in
$sql_db =3D "samdb";
//##### Counter #########
$counter_db =3D "counter";
$counter_tb =3D "samweb";
//##### PHPADS #########
// The database phpAds lives in
$phpAds_db =3D "phpadserver";
//##### FTP #########
//database FTP data lives in
$ftp_db =3D "ftp";
//Root to append before FTP
//$AudioRealmRoot =3D "c:\\inetpub\\wwwroot\\audiorealm\\";
//$defaulthtm =3D =
"c:\\inetpub\\wwwroot\\audiorealm\\template\\index.html";
$AudioRealmRoot =3D "c:/httpd/htdocs/";
$defaulthtm =3D "c:/httpd/htdocs/index.html";
//########### LIB Functions #############
function DoCount($db,$tb,$page)
{
if (isset($GLOBALS["REMOTE_HOST"]) && !empty($GLOBALS["REMOTE_HOST"]))
$addr =3D $GLOBALS["REMOTE_HOST"];
else
if (isset($GLOBALS["REMOTE_ADDR"]) && =
!empty($GLOBALS["REMOTE_ADDR"]))
$addr =3D gethostbyaddr($GLOBALS["REMOTE_ADDR"]);
$sql_query =3D "INSERT INTO $tb VALUES(NULL,'$addr','$page')";
//Log count
$res =3D mysql_db_query($db, $sql_query);
return;
}
?>
*************************************************************************=
*************************************************************************=
*****
------=_NextPart_000_0076_01C27DC2.8B461AB0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2600.0" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>
<DIV><FONT face=3DArial size=3D2>ik draai met een programma (SAM)=20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>dir programma daar kan je muziek mee =
draaien en dan=20
naar een server sturen</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>er is ook een mogelijkheid dat mensen =
plaatjes aan=20
vragen</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>er is een play list waar de nummer's op =
staan.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>als je nu een nummer kiest wordt deze =
link=20
aangeroepen</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><A=20
href=3D"http://www.audiorealm.com/req/req.php3?host=3D212.187.62.55&p=
ort=3D1221&dir=3D&file=3DF%3A%5Cmp3%5Cnederland%5Ca%5CAD+SWART%3D=
%3D%27T+IS+OVER%2Emp3">http://www.audiorealm.com/req/req.php3?host=3D212.=
187.62.55&port=3D1221&dir=3D&file=3DF%3A%5Cmp3%5Cnederland%5C=
a%5CAD+SWART%3D%3D%27T+IS+OVER%2Emp3</A></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>uitleg:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>212.187.62.55 (mijn ip =
nummer)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>1221 poort</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>rest is de de muziek</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>nu wordt dze php aan =
geroepen</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><A=20
href=3D"http://www.audiorealm.com/req/req.php3">http://www.audiorealm.com=
/req/req.php3</A></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>per toeval krijg ik toe eens dit in=20
beeld</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>dus dit zal de php zijn die je aan=20
roept</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>nu zou ik dit graag op mijn eigen =
server willen=20
draaien</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>wie zou mij kunnen helpen hier =
mee</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>m.v.g. Alex</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>icq:64760205</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>MSM:gossoft@hotmail.com</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>email:alex@informat.nl</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>email:a.devries4@chello.nl</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial=20
size=3D2>****************************************************************=
*************************************************************************=
**************</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><?</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=3DArial=20
size=3D2> require("../req/config.inc.php3");</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV><FONT face=3DArial =
size=3D2>
<DIV><BR>IF (empty($port))<BR> $port=3D1221;</DIV>
<DIV> </DIV>
<DIV>$errno =3D 0;<BR>$errstr =3D "";</DIV>
<DIV> </DIV>
<DIV>$ipport =3D $host . ":" . $port;</DIV>
<DIV> </DIV>
<DIV>$fp =3D fsockopen($host,$port, &$errno,=20
&$errstr);<BR>if($fp)<BR> set_socket_blocking($fp, 1);</DIV>
<DIV> </DIV>
<DIV>unset($errors);</DIV>
<DIV> </DIV>
<DIV>if(!$fp) {<BR> $errors[] =
=3D "Error=20
connecting to host[$host] at port[$port]!";<BR> } else =
{</DIV>
<DIV> </DIV>
<DIV><BR> $file =3D stripslashes($file);</DIV>
<DIV> </DIV>
<DIV> $addr =3D getenv("REMOTE_ADDR");</DIV>
<DIV> </DIV>
<DIV> fputs($fp,"REQ|D=3D0|FILE=3D$file|HOST=3D$remotehost|addr=3D$a=
ddr|\n\r");</DIV>
<DIV> </DIV>
<DIV> $buf .=3D fgets($fp,20);</DIV>
<DIV> </DIV>
<DIV> $d =3D strpos($buf,"TUP",$p);</DIV>
<DIV> </DIV>
<DIV><BR>//Print("----<br>");</DIV>
<DIV> </DIV>
<DIV>$timeout =3D 10;<BR>$stop =3D time() + $timeout;<BR>while (!$d =
&&=20
!feof($fp) && time()<$stop)<BR>{</DIV>
<DIV> </DIV>
<DIV> $buf .=3D fgets($fp,255);<BR> $d =3D =
strpos($buf,"/r");<BR> $d=20
=3D =
TRUE;<BR>//Print("$buf--[$d]-($p)----$stop=3D=3D=3D<br>");</DIV>
<DIV> </DIV>
<DIV><BR> }<BR>fclose($fp);<BR> }</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>$buf =3D str_replace("|", "&", $buf);</DIV>
<DIV> </DIV>
<DIV>//Decode into variables<BR>parse_str($buf);</DIV>
<DIV> </DIV>
<DIV>IF (!empty($ERROR))<BR> $errors[] =3D 'ERROR REASON: ' . =
$ERROR;</DIV>
<DIV> </DIV>
<DIV>IF ((empty($dir)) OR (!file_exists($dir . =
"/req.htm")))<BR> =20
$dir =3D ".";</DIV>
<DIV> </DIV>
<DIV><BR>//Add slashes for MySQL<BR>$fname =3D addslashes($file);</DIV>
<DIV> </DIV>
<DIV>IF (empty($errors))<BR>{</DIV>
<DIV> </DIV>
<DIV>//########## LOG request to DB ##########<BR>$sql_query=20
=3D<BR> "<BR> INSERT INTO=20
requests<BR> (t_stamp,ipport,filename,display,count,failed)<BR> =
;VALUES(NULL,'$ipport','$fname','$DISPLAY',1,0)<BR> ";</DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>//########## Show Success File ##########</DIV>
<DIV> </DIV>
<DIV>$fd =3D fopen($dir . "/req.htm", "r");<BR>while ($buffer =3D =
fgets($fd, 4096))=20
{</DIV>
<DIV> </DIV>
<DIV> IF (empty($ARTIST))<BR> $ARTIST =
=3D=20
$TITLE;</DIV>
<DIV> </DIV>
<DIV> $buffer =3D eregi_replace("#combine#", urlencode($DISPLAY),=20
$buffer);<BR> $buffer =3D eregi_replace("#artist#", =
urlencode($ARTIST),=20
$buffer);<BR> $buffer =3D eregi_replace("#title#", =
urlencode($TITLE),=20
$buffer);<BR> $buffer =3D eregi_replace("#album#", =
urlencode($ALBUM),=20
$buffer);</DIV>
<DIV> </DIV>
<DIV> $buffer =3D eregi_replace("@combine@", $DISPLAY,=20
$buffer);<BR> $buffer =3D eregi_replace("@artist@", $ARTIST,=20
$buffer);<BR> $buffer =3D eregi_replace("@title@", $TITLE,=20
$buffer);<BR> $buffer =3D eregi_replace("@album@", $ALBUM, =
$buffer);</DIV>
<DIV> </DIV>
<DIV> echo $buffer;<BR>}<BR>fclose($fd);<BR>//########## =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=20
##########<BR>}<BR>ELSE<BR>{</DIV>
<DIV> </DIV>
<DIV>//########## LOG request to DB ##########<BR>$sql_query=20
=3D<BR> "<BR> INSERT INTO=20
requests<BR> (t_stamp,ipport,filename,display,count,failed)<BR> =
;VALUES(NULL,'$ipport','$fname','$DISPLAY',0,1)<BR> ";</DIV>
<DIV> </DIV>
<DIV>//########## Show Error File ##########</DIV>
<DIV> </DIV>
<DIV>unset($temp);</DIV>
<DIV> </DIV>
<DIV> for($k=3D0;$k<count($errors);$k++)<BR> $temp .=3D =
$errors[$k] .=20
"<br>";</DIV>
<DIV> </DIV>
<DIV> IF (empty($ERROR))<BR> $ERROR =3D $temp;</DIV>
<DIV> </DIV>
<DIV>$fd =3D fopen($dir . "/reqfail.htm", "r");<BR>while ($buffer =3D =
fgets($fd,=20
4096)) {</DIV>
<DIV> </DIV>
<DIV> $buffer =3D eregi_replace("#errors#", $temp, =
$buffer);<BR> $buffer=20
=3D eregi_replace("#errorstr#", $ERROR, $buffer);</DIV>
<DIV> </DIV>
<DIV> echo $buffer;<BR>}<BR>fclose($fd);<BR>//########## =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=20
##########<BR>};</DIV>
<DIV> </DIV>
<DIV><BR>//Create persistent connection<BR>//$link =3D=20
mysql_pconnect($sql_hostname, $sql_mysqluser, $sql_mysqlpassword =
);</DIV>
<DIV> </DIV>
<DIV>//Do the SQL request!<BR>//$res =3D mysql_db_query($sql_db, =
$sql_query,=20
$link);</DIV>
<DIV> </DIV>
<DIV>?></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial=20
size=3D2>****************************************************************=
*************************************************************************=
**************</FONT></DIV></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><?<BR>/* $Id: config.inc.php3,v 1.0 1999/09/20 17:08:50 tobias =
Exp $=20
*/</DIV>
<DIV> </DIV>
<DIV>// MySQL hostname<BR>$sql_hostname =3D "63.98.160.35";</DIV>
<DIV> </DIV>
<DIV>// MySQL username<BR>$sql_mysqluser =3D "web";</DIV>
<DIV> </DIV>
<DIV>// MySQL password<BR>$sql_mysqlpassword =3D "audiorealm";</DIV>
<DIV> </DIV>
<DIV>// The database SAM stuff lives in<BR>$sql_db =3D "samdb";</DIV>
<DIV> </DIV>
<DIV>//##### Counter #########<BR>$counter_db =3D =
"counter";<BR>$counter_tb =3D=20
"samweb";</DIV>
<DIV> </DIV>
<DIV>//##### PHPADS #########<BR>// The database phpAds lives =
in<BR>$phpAds_db =3D=20
"phpadserver";</DIV>
<DIV> </DIV>
<DIV>//##### FTP #########<BR>//database FTP data lives in<BR>$ftp_db =
=3D=20
"ftp";</DIV>
<DIV> </DIV>
<DIV>//Root to append before FTP</DIV>
<DIV> </DIV>
<DIV>//$AudioRealmRoot =3D =
"c:\\inetpub\\wwwroot\\audiorealm\\";<BR>//$defaulthtm=20
=3D "c:\\inetpub\\wwwroot\\audiorealm\\template\\index.html";</DIV>
<DIV> </DIV>
<DIV>$AudioRealmRoot =3D "c:/httpd/htdocs/";<BR>$defaulthtm =3D=20
"c:/httpd/htdocs/index.html";</DIV>
<DIV> </DIV>
<DIV><BR>//########### LIB Functions #############<BR>function=20
DoCount($db,$tb,$page)<BR>{<BR> if (isset($GLOBALS["REMOTE_HOST"])=20
&& !empty($GLOBALS["REMOTE_HOST"]))<BR> $addr =
=3D=20
$GLOBALS["REMOTE_HOST"];<BR> else<BR> if=20
(isset($GLOBALS["REMOTE_ADDR"]) &&=20
!empty($GLOBALS["REMOTE_ADDR"]))<BR> =
$addr =3D=20
gethostbyaddr($GLOBALS["REMOTE_ADDR"]);</DIV>
<DIV> </DIV>
<DIV>$sql_query =3D "INSERT INTO $tb =
VALUES(NULL,'$addr','$page')";</DIV>
<DIV> </DIV>
<DIV>//Log count<BR>$res =3D mysql_db_query($db, $sql_query);</DIV>
<DIV> </DIV>
<DIV>return;</DIV>
<DIV> </DIV>
<DIV>}</DIV>
<DIV> </DIV>
<DIV><BR>?></DIV>
<DIV> </DIV>
<DIV></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial=20
size=3D2>****************************************************************=
*************************************************************************=
**************</FONT></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV></FONT></DIV></FONT></DIV></BODY></HTML>
------=_NextPart_000_0076_01C27DC2.8B461AB0--
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads