[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Librefm-commits] [1066] added some comments, we need to comment a lot m
From: |
Matt Lee |
Subject: |
[Librefm-commits] [1066] added some comments, we need to comment a lot more |
Date: |
Thu, 30 Apr 2009 15:26:31 +0000 |
Revision: 1066
http://svn.sv.gnu.org/viewvc/?view=rev&root=librefm&revision=1066
Author: mattl
Date: 2009-04-30 15:26:30 +0000 (Thu, 30 Apr 2009)
Log Message:
-----------
added some comments, we need to comment a lot more
Modified Paths:
--------------
trunk/gnukebox/scrobble-utils.php
Modified: trunk/gnukebox/scrobble-utils.php
===================================================================
--- trunk/gnukebox/scrobble-utils.php 2009-04-30 15:19:08 UTC (rev 1065)
+++ trunk/gnukebox/scrobble-utils.php 2009-04-30 15:26:30 UTC (rev 1066)
@@ -19,24 +19,34 @@
*/
-require_once('database.php');
+require_once('database.php'); // include the database connection string
-function usernameFromSID($session_id) {
- global $mdb2;
+function usernameFromSID($session_id)
+{
+//derive the username from a session ID
+
+ global $mdb2; // include the Database connector
+
// Delete any expired session ids
$mdb2->query("DELETE FROM Scrobble_Sessions WHERE expires < " . time());
- $res = $mdb2->query("SELECT username FROM Scrobble_Sessions WHERE
sessionid = " . $mdb2->quote($session_id, "text"));
- if(PEAR::isError($res)) {
+ $res = $mdb2->query("SELECT username FROM Scrobble_Sessions WHERE
sessionid = " . $mdb2->quote($session_id, "text")); // get the username from
the table
+
+ if(PEAR::isError($res)) {
die("FAILED " . $res->getMessage() . "\n");
+ // die is there is an error, printing the error
}
if(!$res->numRows()) {
die("BADSESSION\n");
+
+ // the user has no session
}
return $res->fetchOne(0);
+
+ // return the first user
}
function createArtistIfNew($artist) {
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Librefm-commits] [1066] added some comments, we need to comment a lot more,
Matt Lee <=