2 /* GNU FM -- a free network service for sharing your music listening habits
4 Copyright (C) 2009 Free Software Foundation, Inc
6 This program is free software: you can redistribute it and/or modify
7 it under the terms of the GNU Affero General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU Affero General Public License for more details.
16 You should have received a copy of the GNU Affero General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 require_once('../database.php');
23 if (!isset($_GET['username']) || !isset($_GET['passwordmd5'])) {
27 $username = $_GET['username'];
28 $passmd5 = $_GET['passwordmd5'];
30 $res = $adodb->GetOne('SELECT username FROM Users WHERE lower(username) = ' . $adodb->qstr(strtolower($username)) . ' AND password = ' . $adodb->qstr($passmd5));
35 $session = md5($passmd5 . time());
37 $adodb->Execute('DELETE FROM Radio_Sessions WHERE expires < ' . (int)(time()));
39 $adodb->Execute('INSERT INTO Radio_Sessions (username, session, expires) VALUES ( ' . $adodb->qstr($username) . ', ' . $adodb->qstr($session) . ', ' . (int)(time() + 259200) . ')');
41 $radio_base = preg_replace('/https?:\/\//i', '', $base_url, 1);
43 echo 'session=' . $session . "\n";
44 echo "stream_url=this.is.broken.{$username}.example.com\n";
45 echo "subscriber=0\n";
46 echo "framehack=0..\n";
47 echo "base_url=$radio_base\n";
48 echo "base_path=/radio\n";
49 echo "info_message=\n";
50 echo "fingerprint_upload_url=http://this.is.broken.example.com/fingerprint/upload.php\n";
51 echo "permit_bootstrap=0\n";