1 <h2 align="center">m - p - 3 <> d - a - t - a - b - a - s - e</h2>
3 <!-- are you allowed to connect? -->
8 if [ ! -f /etc/mp3db.conf ]; then
9 echo \"error: no /etc/mp3db.conf file found, aborting.\"
12 mp3_server_name=`grep MP3_SERVER_NAME /etc/mp3db.conf | awk '{ print $2 }'`
13 mp3_srcdir=`grep MP3_SRCDIR /etc/mp3db.conf | awk '{ print $2 }'`
14 http_root=`grep HTTP_ROOT /etc/mp3db.conf | awk '{ print $2 }'`
15 http_offset=`grep HTTP_OFFSET /etc/mp3db.conf | awk '{ print $2 }'`
16 local_net=`grep LOCAL_NET /etc/mp3db.conf | awk '{ print $2 }'`
17 mp3_http_loc=`grep MP3_HTTP_LOC /etc/mp3db.conf | awk '{ print $2 }'`
18 local_player_ip=`grep LOCAL_PLAYER_IP /etc/mp3db.conf | awk '{ print $2 }'`
19 playerfile_dir=`grep PLAYFILE_DIR /etc/mp3db.conf | awk '{ print $2 }'`
20 my_user_name=`grep USR_NAME /etc/mp3db.conf | awk '{ print $2 }'`
21 user_passwd=`grep USER_PASSWD /etc/mp3db.conf | awk '{ print $2 }'`
24 if [ ! -f /etc/mp3user ]; then
25 echo \"error: no /etc/mp3user file found, aborting.\"
28 for allowed_ip in `cat /etc/mp3user | awk '{ print $2 }'`; do
29 [ \"$allowed_ip\" = \"$REMOTE_ADDR\" ] && allowed=1
32 if [ \"$allowed\" = \"1\" ]; then
33 if [ ! -z \"`echo $REMOTE_ADDR | grep ^$local_net`\" ]; then
34 computer_name=`grep $REMOTE_ADDR /etc/hosts | awk '{ print $3 }'`
36 computer_name=`host $REMOTE_ADDR | awk '{ print $5 }'`
38 echo \"hi `grep $REMOTE_ADDR /etc/mp3user | awk '{ print $1 }'`!<br><br>your connection from $computer_name is authorized. have fun!<br>\"
42 #call myself and see what songs to present
44 <form action=\"$http_offset/index.shtml\" method=\"get\">
47 <input name=\"artist\" type=\"text\" size=\"30\" maxlength=\"30\">
49 <input type=\"radio\" name=\"und_oder\" value=\"und\">and
50 <input type=\"radio\" name=\"und_oder\" value=\"oder\" checked>or
54 <input name=\"song\" type=\"text\" size=\"30\" maxlength=\"30\">
56 <input type=\"submit\" value=\"search\">
60 if [ ! -z \"$QUERY_STRING\" ]; then
62 echo \"<h4>results:</h4>\";
64 artist=`echo '$QUERY_STRING' | awk -F\& '{ gsub(\"artist=\",\"\"); print $1 }' | sed 's/+/_/g'`;
65 if [ \"`echo '$QUERY_STRING' | awk -F\& '{ gsub(\"und_oder=\",\"\"); print $2 }'`\" = \"oder\" ]; then
70 song=`echo '$QUERY_STRING' | awk -F\& '{ gsub(\"song=\",\"\"); print $3 }' | sed 's/+/_/g'`;
71 echo \"searching for: $artist $song (mode: $und_oder)<br><br>\";
73 if [ \"$und_oder\" != \"-a\" ]; then
74 echo \"-> artists found:<br>\";
75 if [ ! -z \"$artist\" ]; then
76 for found_artists in `ls -A $mp3_srcdir/ | grep $artist`; do
77 echo \"<br>`echo $found_artists | sed 's/_/\ /g'`:<br>\";
78 echo \"<table border=1 cellpadding=5 cellspacing=0>\";
79 for dir_song in $mp3_srcdir/$found_artists/*; do
80 mp3=`basename $dir_song`;
81 echo \"<tr><td><a href=\"$mp3_http_loc/$found_artists/$mp3\">$mp3</a></td><td>`du -h $mp3_srcdir/$found_artists/$mp3 | awk '{ print $1 }'`</td><td><a href=\"http://${local_player_ip}${playerfile_dir}/playsong.shtml\?url=http://${mp3_server_name}${mp3_http_loc}/$found_artists/$mp3\&user=$my_user_name\&passwd=$user_passwd\">play ($local_player_ip)</a></td><td>`readtag.sh $mp3_srcdir/$found_artists/$mp3`</td></tr>\";
86 if [ ! -z \"$song\" ]; then
87 echo \"<br>-> songs found:<br>\";
88 echo \"<table border=1 cellpadding=5 cellspacing=0>\";
89 for single_song in $mp3_srcdir/*/*; do
90 if [ ! -z \"`echo $single_song | grep $song`\" ]; then
91 dir=`echo $single_song | awk -F/ '{ print $(NF-1) }'`
92 s_name=`echo $single_song | awk -F/ '{ print $(NF) }'`
93 echo \"<tr><td><a href=\"$mp3_http_loc/$dir/$s_name\">$s_name</a></td><td>`du -h $mp3_srcdir/$dir/$s_name | awk '{ print $1 }'`</td><td><a href=\"http://${local_player_ip}${playerfile_dir}/playsong.shtml\?url=http://${mp3_server_name}${mp3_http_loc}/$dir/$s_name\&user=$my_user_name\&passwd=$user_passwd\">play ($local_player_ip)</a></td><td>`readtag.sh $mp3_srcdir/$dir/$s_name`</tr>\";
101 search_paths=`ls -A $mp3_srcdir | grep $artist`;
102 for search_path in $search_paths; do
103 echo \"-> artist: $search_path:<br>\";
104 echo \"<table border=1 cellpadding=5 cellspacing=0>\";
105 for dir_song in $mp3_srcdir/$search_path/*; do
106 mp3=`basename $dir_song`;
107 if [ ! -z \"`echo $mp3 | grep $song`\" ]; then
108 echo \"<tr><td><a href=\"$mp3_http_loc/$search_path/$mp3\">$mp3</a></td><td>`du -h $mp3_srcdir/$search_path/$mp3 | awk '{ print $1 }'`</td><td><a href=\"http://${local_player_ip}${playerfile_dir}/playsong.shtml\?url=http://${mp3_server_name}${mp3_http_loc}/$search_path/$mp3\&user=$my_user_name\&passwd=$user_passwd\">play ($local_player_ip)</a></td><td>`readtag.sh $mp3_srcdir/$search_path/$mp3`</tr>\";
119 echo \"sorry,<br><br>you, `echo $REMOTE_ADDR` are not authorized. you probably never will! :)<br>please don't mail asking for access. i am willing to share all my knowledge *) and code, but not mp3's as this might be illegal.<br><br>regards, hackbard<br><br><h5>*) i don't know nothig!</h5>\"