git.gnu.io has moved to IP address 209.51.188.249 -- please double check where you are logging in.

Commit 8e391ebe authored by Kuno's avatar Kuno

Merge remote branch 'foocorp/master'

* foocorp/master: (126 commits)
  Delete service connections when deleting a profile
  Remove tags before displaying search results heading
  Don't select non-free tracks when selecting tracks from a collection of artists (e.g. for recommended or similar artist radio)
  Fix missing rewrite_encode()s in album and track url retrieval
  Fix indentation
  Make parameter checks in generateTagCloud more compact
  Make parameter checks in generatePlayByDays more compact
  Make parameter checks in generatePlayStats more compact
  Finish code cleanup under nixtape/data/.
  Finish code cleanup under nixtape/api/.
  Finish code cleanup in nixtape/utils/.
  Finish code cleanup in nixtape/utils/webid-finder-ws/.
  Finish code cleanup in nixtape/.
  Add pagination to user.getBannedTracks webservice method
  Fix missing assignment in previous commit
  Remove some duplicated code from webservice index
  Add paginated output to user.getLovedTracks web service method
  Finish code cleanup under gnukebox/.
  Clean up code in gnukebox/tests/SubmissionsTest.php.
  Clean up code in gnukebox/submissions/1.2/index.php.
  ...
parents 09d71ce3 2831e91f
......@@ -93,4 +93,10 @@ want your patches accepted and modules included in supported releases.
(e.g. {t}Translate me!{/t}). See the smarty gettext documentation for more
advanced usage.
19) If you see code which doesn't comply with the above, please fix it :)
19) When comparing strings in lower-case always use the DBMS lower() function
where possible. strtolower() doesn't handle multi-byte characters and
and mb_strtolower is typically much less efficient. Since this is typically
used when comparing against a lower()'d database field it also ensures
consistency in the comparison.
20) If you see code which doesn't comply with the above, please fix it :)
Other external dependencies which SHOULD BE HERE:
- PHP ADODB
Other external dependencies which are currently bundled within the nixtape source tree:
- jQuery 1.3.2
......
......@@ -48,7 +48,7 @@ function check_standard_auth($username, $token, $timestamp) {
global $adodb;
$adodb->SetFetchMode(ADODB_FETCH_ASSOC); // this query should get the uniqueid and then return it on success
$pass = $adodb->GetOne('SELECT password FROM Users WHERE lower(username) =' . $adodb->qstr(strtolower($username)));
$pass = $adodb->GetOne('SELECT password FROM Users WHERE lower(username) = lower(' . $adodb->qstr($username) . ')');
if (!$pass) {
// TODO: Log failures somewhere
return false;
......
......@@ -20,7 +20,7 @@
*/
if(!file_exists(dirname(__FILE__) . '/config.php')) {
if (!file_exists(dirname(__FILE__) . '/config.php')) {
die('Please run the <a href=\'install.php\'>Install</a> script to configure your installation');
}
......@@ -30,7 +30,7 @@ require_once('adodb/adodb.inc.php');
try {
$adodb =& NewADOConnection($connect_string);
} catch (exception $e) {
} catch (Exception $e) {
var_dump($e);
adodb_backtrace($e->gettrace());
}
......@@ -39,7 +39,7 @@ try {
function reportError($msg, $sql) {
global $adodb;
$adodb->Execute('INSERT INTO error(msg, data, time) VALUES('
$adodb->Execute('INSERT INTO Error(msg, data, time) VALUES('
. $adodb->qstr($msg) . ', '
. $adodb->qstr($sql) . ', '
. time() . ')');
......
......@@ -40,22 +40,19 @@ require_once('temp-utils.php');
try {
$res = $adodb->CacheGetAll(60, "SELECT artist, track, time FROM Scrobbles ORDER BY time DESC LIMIT 25");
$res = $adodb->CacheGetAll(60, 'SELECT artist, track, time FROM Scrobbles ORDER BY time DESC LIMIT 25');
}
catch (exception $e)
{
} catch (Exception $e) {
die($e->getMessage());
}
echo "<ul>\n";
foreach($res as &$row){
foreach ($res as &$row){
echo "<li>" . $row['artist'] . "&mdash;" . $row['track'] . "</li>\n";
}
}
?>
</ul>
......
......@@ -24,29 +24,23 @@ require_once('version.php');
// Display things?
$displaythings = True;
$displaythings = true;
if (!isset($config_version) || $config_version != $version) {
die("Configuration file is out of date. Please delete it (and associated database) and <a href='install.php'>reinstall</a>."); //TODO: Upgrade script for release versions
die('Configuration file is out of date. Please delete it (and associated database) and <a href="install.php">reinstall</a>.'); //TODO: Upgrade script for release versions
}
if (isset($_GET['hs']) && isset($_GET['p'])) {
if (substr($_GET['p'], 0, 3) == "1.2") {
if (substr($_GET['p'], 0, 3) == '1.2') {
require_once('submissions/1.2/handshake.php');
} elseif (substr($_GET['p'], 0, 3) == "1.1") {
} else if (substr($_GET['p'], 0, 3) == '1.1') {
require_once('submissions/1.1/handshake.php');
}
} else {
//If we're not handshaking then just display some nice stats
if ($displaythings) {
require_once('display.php');
}
else
{
echo "<h1>GNUkebox!</h1><p>Please configure your system for " . $_SERVER['SERVER_NAME'] . "</p>"; }
}
?>
require_once('display.php');
} else {
echo '<h1>GNUkebox!</h1><p>Please configure your system for ' . $_SERVER['SERVER_NAME'] . '</p>';
}
}
This diff is collapsed.
......@@ -18,79 +18,76 @@
*/
@apache_setenv('no-gzip', 1);
@ini_set('zlib.output_compression', 0);
@ini_set('implicit_flush', 1);
@apache_setenv('no-gzip', 1);
@ini_set('zlib.output_compression', 0);
@ini_set('implicit_flush', 1);
header('Content-type: text/html; charset=utf-8');
require_once('database.php');
require_once('utils/human-time.php');
$adodb->SetFetchMode(ADODB_FETCH_ASSOC);
$res = $adodb->GetAll("SELECT artist, track from scrobbles where Album is null LIMIT 20;");
echo "<ul>";
$res = $adodb->GetAll('SELECT artist, track from scrobbles where Album is null LIMIT 20;');
if(!$res) {
die("sql error");
}
foreach($res as &$row) {
echo '<ul>';
echo "<li>" . $row['artist'] . "&mdash;" . $row['track'] . "</li>";
if (!$res) {
die('sql error');
}
foreach ($res as &$row) {
echo "Finding album...";
echo '<li>' . $row['artist'] . '&mdash;' . $row['track'] . '</li>';
echo doABunchOfShit($row['artist'], $row['track']);
echo 'Finding album...';
for ($i = 0; $i < ob_get_level(); $i++) { ob_end_flush(); }
ob_implicit_flush(1) ;
echo doABunchOfShit($row['artist'], $row['track']);
}
for ($i = 0; $i < ob_get_level(); $i++) {
ob_end_flush();
}
ob_implicit_flush(1);
}
function doABunchOfShit($artist, $track){
function doABunchOfShit($artist, $track) {
$album = ScrobbleLookup($artist, $track);
if ($album){
return $album;
if ($album) {
return $album;
} else {
$album = BrainzLookup ($artist, $track);
return $album;}
$album = BrainzLookup($artist, $track);
return $album;
}
}
function ScrobbleLookup($artist, $track){
function ScrobbleLookup($artist, $track) {
global $adodb;
$sql = "SELECT album from scrobbles where artist = " . $adodb->qstr($artist) . " and track = " . $adodb->qstr($track) . " LIMIT 1;";
$sql = 'SELECT album from scrobbles where artist = ' . $adodb->qstr($artist) . ' and track = ' . $adodb->qstr($track) . ' LIMIT 1;';
$adodb->SetFetchMode(ADODB_FETCH_ASSOC);
$album = $adodb->GetOne($sql);
if(!$album) {
die("sql error");
if (!$album) {
die('sql error');
}
return $album;
}
function BrainzLookup($artist, $track){
function BrainzLookup($artist, $track) {
global $adodb;
$sql = "select a.name as artist,l.name as album, t.name as track,t.gid as mbid from brainz.track t left join brainz.artist a on t.artist=a.id left join brainz.albumjoin j on j.track=t.id left join brainz.album l on l.id=j.album where lower(t.name)=" . $adodb->qstr(mb_strtolower($track, "UTF-8")) . " and lower(a.name)=" . $adodb->qstr(mb_strtolower($artist, "UTF-8")) . " LIMIT 1;";
$sql = 'select a.name as artist,l.name as album, t.name as track,t.gid as mbid from brainz.track t left join brainz.artist a on t.artist=a.id left join brainz.albumjoin j on j.track=t.id left join brainz.album l on l.id=j.album where lower(t.name) = lower(' . $adodb->qstr($track) . ') and lower(a.name) = lower(' . $adodb->qstr($artist) . ') LIMIT 1;';
$adodb->SetFetchMode(ADODB_FETCH_ASSOC);
$albumData = $adodb->GetRow($sql);
if(!$albumData)) {
die("sql error");
if (!$albumData)) {
die('sql error');
}
return $albumData['album'];
......
......@@ -22,12 +22,12 @@ require_once('../../database.php');
require_once('../../scrobble-utils.php');
require_once('../../auth-utils.php');
header("Content-Type: text/plain");
header('Content-Type: text/plain');
if(!isset($_POST['s']) || !isset($_POST['a']) || !isset($_POST['t'])) {
if (!isset($_POST['s']) || !isset($_POST['a']) || !isset($_POST['t'])) {
die("FAILED Required POST parameters are not set\n");
}
if(empty($_POST['s']) || empty($_POST['a']) || empty($_POST['t'])) {
if (empty($_POST['s']) || empty($_POST['a']) || empty($_POST['t'])) {
die("FAILED Required POST parameters are empty\n");
}
......@@ -36,15 +36,15 @@ $session_id = $_POST['s'];
$MQsess = $adodb->qstr($session_id);
$artist = $adodb->qstr($_POST['a']);
if(isset($_POST['b'])) {
if (isset($_POST['b'])) {
$album = $adodb->qstr($_POST['b']);
} else {
$album = 'NULL';
}
$track = $adodb->qstr($_POST['t']);
if(isset($_POST['l']) && is_numeric($_POST['l'])) {
if (isset($_POST['l']) && is_numeric($_POST['l'])) {
$length = (int) $_POST['l'];
if($length > 5400) {
if ($length > 5400) {
$expires = time() + 600;
} else {
$expires = time() + (int) $_POST['l'];
......@@ -55,41 +55,38 @@ if(isset($_POST['l']) && is_numeric($_POST['l'])) {
$mb = validateMBID($_POST['m']);
if($mb) {
if ($mb) {
$mbid = $adodb->qstr($mb);
} else {
$mbid = 'NULL';
}
//Delete this user's last playing song (if any)
$adodb->Execute("DELETE FROM Now_Playing WHERE sessionid = " . ($MQsess));
$adodb->Execute('DELETE FROM Now_Playing WHERE sessionid = ' . ($MQsess));
if (!check_session($MQsess)) {
die("BADSESSION\n");
}
try {
$adodb->Execute("INSERT INTO Now_Playing (sessionid, artist, album, track, expires, mbid) VALUES ("
. $MQsess . ", "
. $artist . ", "
. $album . ", "
. $track . ", "
. $expires . ", "
. $mbid . ")");
}
catch (exception $e) {
die("FAILED " . $e->getMessage() . "\n");
$adodb->Execute('INSERT INTO Now_Playing (sessionid, artist, album, track, expires, mbid) VALUES ('
. $MQsess . ', '
. $artist . ', '
. $album . ', '
. $track . ', '
. $expires . ', '
. $mbid . ')');
} catch (Exception $e) {
die('FAILED ' . $e->getMessage() . "\n");
}
createArtistIfNew($artist);
if($album != 'NULL') {
if ($album != 'NULL') {
createAlbumIfNew($artist, $album);
}
getTrackCreateIfNew($artist, $album, $track, $mbid);
//Expire old tracks
$adodb->Execute("DELETE FROM Now_Playing WHERE expires < " . time());
$adodb->Execute('DELETE FROM Now_Playing WHERE expires < ' . time());
die("OK\n");
?>
......@@ -22,8 +22,7 @@
require_once('database.php'); // include the database connection string
require_once('temp-utils.php');
function useridFromSID($session_id)
{
function useridFromSID($session_id) {
//derive the username from a session ID
global $adodb; // include the Database connector
......@@ -32,13 +31,12 @@ function useridFromSID($session_id)
try {
$res = $adodb->GetOne('SELECT userid FROM Scrobble_Sessions WHERE sessionid = ' . $adodb->qstr($session_id)); // get the username from the table
}
catch (exception $e) {
} catch (Exception $e) {
die('FAILED ufs ' . $e->getMessage() . '\n');
// die is there is an error, printing the error
}
if(!$res) {
if (!$res) {
die("BADSESSION\n");
// the user has no session
}
......@@ -52,31 +50,31 @@ function createArtistIfNew($artist) {
$artist = NoSpamTracks($artist);
$res = $adodb->GetOne('SELECT name FROM Artist WHERE lower(name) = lower(' . ($artist) . ')');
$res = $adodb->GetOne('SELECT name FROM Artist WHERE lower(name) = lower(' . $artist . ')');
if(!$res) {
if (!$res) {
// Artist doesn't exist, so we create them
$res = $adodb->Execute('INSERT INTO Artist (name) VALUES (' . ($artist) . ')');
$res = $adodb->Execute('INSERT INTO Artist (name) VALUES (' . $artist . ')');
}
}
function createAlbumIfNew($artist, $album) {
global $adodb;
$name = $adodb->GetOne('SELECT name FROM Album WHERE lower(name) = lower(' . ($album) . ') AND lower(artist_name) = lower(' . ($artist) . ')');
$name = $adodb->GetOne('SELECT name FROM Album WHERE lower(name) = lower(' . $album . ') AND lower(artist_name) = lower(' . $artist . ')');
if(!$name) {
if (!$name) {
// Album doesn't exist, so create it
// Disable to fix scrobble breakage
//$art = $adodb->qstr(getAlbumArt($artist, $album));
$art = "";
$art = '';
if ($art !="") {
if ($art != '') {
$license = $adodb->qstr('amazon');
$sql = 'INSERT INTO Album (name, artist_name, image, artwork_license) VALUES (' . ($album) . ', ' . ($artist) . ', ' . ($art) . ', ' . ($license) .')';
$sql = 'INSERT INTO Album (name, artist_name, image, artwork_license) VALUES (' . $album . ', ' . $artist . ', ' . $art . ', ' . $license .')';
} else {
$sql = 'INSERT INTO Album (name, artist_name) VALUES (' . ($album) . ', ' . ($artist) . ')';
$sql = 'INSERT INTO Album (name, artist_name) VALUES (' . $album . ', ' . $artist . ')';
}
$adodb->Execute($sql);
}
......@@ -88,19 +86,19 @@ function getTrackCreateIfNew($artist, $album, $track, $mbid) {
$track = NoSpamTracks($track);
$artist = NoSpamTracks($artist);
if($album != 'NULL') {
$res = $adodb->GetOne('SELECT id FROM Track WHERE lower(name) = lower(' . ($track) . ') AND lower(artist_name) = lower(' . ($artist) . ') AND lower(album_name) = lower(' . ($album) . ')');
if ($album != 'NULL') {
$res = $adodb->GetOne('SELECT id FROM Track WHERE lower(name) = lower(' . $track . ') AND lower(artist_name) = lower(' . $artist . ') AND lower(album_name) = lower(' . $album . ')');
} else {
$res = $adodb->GetOne('SELECT id FROM Track WHERE lower(name) = lower(' . ($track) . ') AND lower(artist_name) = lower(' . ($artist) . ') AND album_name IS NULL');
$res = $adodb->GetOne('SELECT id FROM Track WHERE lower(name) = lower(' . $track . ') AND lower(artist_name) = lower(' . $artist . ') AND album_name IS NULL');
}
if(!$res) {
if (!$res) {
// Create new track
$res = $adodb->Execute('INSERT INTO Track (name, artist_name, album_name, mbid) VALUES ('
. ($track) . ', '
. ($artist) . ', '
. ($album) . ', '
. ($mbid) . ')');
. $track . ', '
. $artist . ', '
. $album . ', '
. $mbid . ')');
return getTrackCreateIfNew($artist, $album, $track, $mbid);
} else {
return $res;
......@@ -111,17 +109,17 @@ function getScrobbleTrackCreateIfNew($artist, $album, $track, $mbid, $tid) {
global $adodb;
$res = $adodb->GetOne('SELECT id FROM Scrobble_Track WHERE name = lower('
. ($track) . ') AND artist = lower(' . ($artist) . ') AND album '
. (($album == 'NULL') ? 'IS NULL' : ('= lower(' . ($album) . ')')) . ' AND mbid '
. (($mbid == 'NULL') ? 'IS NULL' : ('= lower(' . ($mbid) . ')')));
. $track . ') AND artist = lower(' . $artist . ') AND album '
. (($album == 'NULL') ? 'IS NULL' : ('= lower(' . $album . ')')) . ' AND mbid '
. (($mbid == 'NULL') ? 'IS NULL' : ('= lower(' . $mbid . ')')));
if(!$res) {
if (!$res) {
$sql = 'INSERT INTO Scrobble_Track (name, artist, album, mbid, track) VALUES ('
. 'lower(' . ($track) . '), '
. 'lower(' . ($artist) . '), '
. (($album == 'NULL') ? 'NULL' : 'lower(' . ($album) . ')') . ', '
. (($mbid == 'NULL') ? 'NULL' : 'lower(' . ($mbid) . ')') . ', '
. ($tid) . ')';
. 'lower(' . $track . '), '
. 'lower(' . $artist . '), '
. (($album == 'NULL') ? 'NULL' : 'lower(' . $album . ')') . ', '
. (($mbid == 'NULL') ? 'NULL' : 'lower(' . $mbid . ')') . ', '
. $tid . ')';
$res = $adodb->Execute($sql);
return getScrobbleTrackCreateIfNew($artist, $album, $track, $mbid, $tid);
} else {
......@@ -132,19 +130,19 @@ function getScrobbleTrackCreateIfNew($artist, $album, $track, $mbid, $tid) {
function scrobbleExists($userid, $artist, $track, $time) {
global $adodb;
$res = $adodb->GetOne('SELECT time FROM Scrobbles WHERE userid = ' . ($userid) . ' AND artist = ' . ($artist) . ' AND track = ' . ($track) . ' AND time = ' . ($time));
$res = $adodb->GetOne('SELECT time FROM Scrobbles WHERE userid = ' . $userid . ' AND artist = ' . $artist . ' AND track = ' . $track . ' AND time = ' . $time);
if(!$res) {
if (!$res) {
return false;
} else {
return true;
}
}
function NoSpamTracks ($track) {
function NoSpamTracks($track) {
// This function exists to remove things like '(PREVIEW: buy it at www.magnatune.com)' from track names.
$track = str_replace(' (PREVIEW: buy it at www.magnatune.com)', "", $track);
$track = str_replace(' (PREVIEW: buy it at www.magnatune.com)', '', $track);
return $track;
}
......@@ -153,12 +151,12 @@ function getAlbumArt($artist, $album) {
$Access_Key_ID = '1EST86JB355JBS3DFE82'; // this is mattl's personal key :)
$SearchIndex='Music';
$Keywords=urlencode($artist.' '.$album);
$SearchIndex = 'Music';
$Keywords = urlencode($artist . ' ' . $album);
$Operation = 'ItemSearch';
$Version = '2007-07-16';
$ResponseGroup = 'ItemAttributes,Images';
$request='http://ecs.amazonaws.com/onca/xml'
$request = 'http://ecs.amazonaws.com/onca/xml'
. '?Service=AWSECommerceService'
. '&AssociateTag=' . $Associate_tag
. '&AWSAccessKeyId=' . $Access_Key_ID
......@@ -175,10 +173,10 @@ function getAlbumArt($artist, $album) {
return $image;
}
function validateMBID ($input) {
if(isset($input)) {
function validateMBID($input) {
if (isset($input)) {
$input = strtolower(rtrim($input));
if(preg_match('/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/', $input)) {
if (preg_match('/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/', $input)) {
return $input;
} else {
return null;
......@@ -195,56 +193,53 @@ function validateMBID ($input) {
function forwardScrobble($userid, $artist, $album, $track, $time, $mbid, $source, $rating, $length) {
global $adodb, $lastfm_key, $lastfm_secret;
// Strip database quoting from details and urlencode
$artist = urlencode(substr($artist, 1, strlen($artist) - 2));
$track = urlencode(substr($track, 1, strlen($track) - 2));
$album == 'NULL' ? $album = false : $album = urlencode(substr($album, 1, strlen($album) - 2));
$mbid == 'NULL' ? $mbid = false : $mbid = urlencode(substr($mbid, 1, strlen($mbid) - 2));
$source == 'NULL' ? $source = false : $source = urlencode(substr($source, 1, strlen($source) - 2));
$rating == '\'0\'' ? $rating = false : 0;
$length == 'NULL' ? $length = false : 0;
$artist = urlencode($artist);
$track = urlencode($track);
$album = urlencode($album);
$mbid = urlencode($mbid);
$source = urlencode($source);
$rating = urlencode($rating);
$length = urlencode($length);
$res = $adodb->CacheGetAll(600, 'SELECT * FROM Service_Connections WHERE userid = ' . $userid . ' AND forward = 1');
foreach($res as &$row) {
foreach ($res as &$row) {
$remote_key = $row['remote_key'];
$ws_url = $row['webservice_url'];
$curl_session = curl_init($ws_url);
$post_vars = '';
if($album) {
if ($album) {
$post_vars .= 'album[0]=' . $album . '&';
}
$post_vars .= 'api_key=' . $lastfm_key . '&artist[0]=' . $artist;
if($length) {
if ($length) {
$post_vars .= '&length[0]=' . $length;
}
if($mbid) {
if ($mbid) {
$post_vars .= '&mbid[0]=' . $mbid;
}
$post_vars .= '&method=track.scrobble';
if($rating) {
if ($rating) {
$post_vars .= '&rating[0]=' . $rating;
}
$post_vars .= '&sk=' . $remote_key;
if($source) {
if ($source) {
$post_vars .= '&source[0]='. $source;
}
$post_vars .= '&timestamp[0]=' . $time . '&track[0]=' . $track;
$sig = str_replace('&', '', urldecode($post_vars));
$sig = urldecode(str_replace('&', '', $post_vars));
$sig = str_replace('=', '', $sig);
$sig = md5($sig . $lastfm_secret);
$post_vars .= '&api_sig=' . $sig;
curl_setopt ($curl_session, CURLOPT_POST, true);
curl_setopt ($curl_session, CURLOPT_POSTFIELDS, $post_vars);
curl_setopt ($curl_session, CURLOPT_RETURNTRANSFER, true);
curl_setopt ($curl_session, CURLOPT_CONNECTTIMEOUT, 1);
curl_setopt ($curl_session, CURLOPT_TIMEOUT, 1);
curl_setopt($curl_session, CURLOPT_POST, true);
curl_setopt($curl_session, CURLOPT_POSTFIELDS, $post_vars);
curl_setopt($curl_session, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl_session, CURLOPT_CONNECTTIMEOUT, 1);
curl_setopt($curl_session, CURLOPT_TIMEOUT, 1);
$response = curl_exec($curl_session);
curl_close($curl_session);
}
}
?>
......@@ -39,23 +39,23 @@ require_once('temp-utils.php');
<?php
$adodb->SetFetchMode(ADODB_FETCH_ASSOC);
$total = $adodb->CacheGetOne(500, 'SELECT COUNT(*) as total from Scrobbles');
if(!$total) {
die("sql error");
if (!$total) {
die('sql error');
}
echo "<p>" . stripslashes($total) . " listens.</p>";
echo '<p>' . stripslashes($total) . ' listens.</p>';
$total = $adodb->CacheGetOne(500, 'SELECT COUNT(*) as total from Track');
if(!$total) {
die("sql error");
if (!$total) {
die('sql error');
}
echo "<p>" . stripslashes($total) . " unique tracks.</p>";
echo '<p>' . stripslashes($total) . ' unique tracks.</p>';
$total = $adodb->CacheGetOne(500, 'SELECT COUNT(*) as total from Users');
if(!$total) {
die("sql error");
if (!$total) {
die('sql error');
}
echo "<p>" . stripslashes($total) . " users.</p>";
echo '<p>' . stripslashes($total) . ' users.</p>';
?>
</body>
</html>
\ No newline at end of file
</html>
......@@ -28,16 +28,15 @@ require_once('auth-utils.php');
require_once('config.php');
require_once('temp-utils.php');
$supported_protocols = array("1.1");
$supported_protocols = array('1.1');
if(!isset($_GET['p']) || !isset($_GET['u']) || !isset($_GET['c'])) {
if (!isset($_GET['p']) || !isset($_GET['u']) || !isset($_GET['c'])) {
die("FAILED\n");
}
$protocol = $_GET['p']; $username = $_GET['u']; $client = $_GET['c'];
if(!in_array($protocol, $supported_protocols)) {
if (!in_array($protocol, $supported_protocols)) {
die("FAILED Unsupported protocol version\n");
}
......@@ -45,31 +44,27 @@ $timestamp = time();