Skip to Content
It is currently January 29th, 2022, 3:25 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: October 31st, 2021, 9:31 am 
Offline
Senior User
Senior User

Joined: January 1st, 2009, 8:50 pm
Posts: 147
Hello,

I use one of FesterHead's files daily: reqlist.php - aka "SAM 4 Request Viewer for samPHPweb v0.3"

Although it says "samPHPweb", it, unfortunately, uses the old SAM /php/ queries which don't work in PHP 7x. I have all of the code in my stations converted to the newer code, except this one as there is no similar file(s) to compare to.

reqlist.php (attached) shows all of the requests made. It shows the track title, the IP address of the requester, the date/time of the request, the status (pending, played, ignored), the name of the requester and their dedication.

Has anyone rebuilt this part before, or want to take a whack at it?

Thank you,
Terry


Attachments:
reqlist.php.txt [9.1 KiB]
Downloaded 61 times
Top
 Profile  
Reply with quote  
PostPosted: November 28th, 2021, 11:54 am 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 8299
Location: Cologne (Germany)
It looks like you only need to adjust the Database query.
That file was supposed to be called from within another file.

The actual code seems fine (i.e. compatible even with PHP8.1 released last week) from a first look and should work with all the links and data inside (the tables for SAM have not changed since SAM4, I think even SAM3 didn't change much about the data structure)

There's only 3 sections you need to change and then you can place the file in the "web" folder of the "modern" SAM templates. (the one with favicon.ico, playing.php, playlist.php, ...)
At the top of the file (ideally the line after <?php) add this:
Code:
require_once('../config/config.php');


Then find this part:
Code:
$db->open("SELECT requestlist.*,songlist.artist,songlist.title,songlist.duration FROM requestlist LEFT JOIN songlist ON requestlist.songid=songlist.id $where ORDER BY requestlist.id DESC",$limit,$start);
$reqlst = $db->rows();
reset($reqlst);


This needs to be rewritten and you need to first initialize the Database. For both I suggest taking a look at the getComingSongs function in class.song.php:
Code:
      $db = Database::getInstance();

      // Return tracks in the queuelist table
      $select = $db->select()
                ->from(array('s' => 'songlist'),
                     array('*'))
                ->join(array('q' => 'queuelist'),
                     'q.songID = s.ID',
                     array('requestID'))
                ->where('s.songtype = ?', 'S') //Only return song of type S
                ->order('q.sortID ASC')
                ->limit(COMING_UP_COUNT);

      $songs = array();
      try {
         $songs = $db->fetchAll($select);
      } catch (Zend_Db_Adapter_Exception $ex) {
         echo "Please verify database settings.<br />";
         exit;
      }


Change $songs to $reqlst (for some reason Festerhead always loses some letters in his variable names - This is supposed to be the request list) and if you want to see ALL requests, remove the ->limit part (make sure to move the semicolon to wherever the end of the query is)

To make life easier, you can skip converting the string query from festerhead into separate function calls and just supply it as the single argument to fetchAll (instead of $select).
One caveat: The old db system had optional parameters for pagination, if you want to keep those, you need to add them to the end of the SQL query like so:
Code:
 LIMIT $start, $limit


Last but not least:
Code:
while (list($key, $value) = each($reqlst)) {[code]
becomes:
[code]foreach ($reqlst as $key => $value) {


It's pretty straightforward. If you need me to rewrite the full script for you, please send 25 EUR to https://paypal.me/mastacheata and I'll get back to you within a couple days with the converted file. (This is not gonna take me a couple days, but I'm not sure when I'll have the time to check it)

_________________
Benedikt Bauer - SVS (Spacial Volunteer Support)

Shop for readymade PAL scripts by countrywesterndj - Or get a custom script made by me (or others)

My Project:
Send "Now Playing" from SAM to Twitter and/or Facebook | Sourcecode


Top
 Profile  
Reply with quote  
PostPosted: December 1st, 2021, 2:07 pm 
Offline
Senior User
Senior User

Joined: January 1st, 2009, 8:50 pm
Posts: 147
Well, I tried, but it's beyond me. € sent your way.
Thanks!
Terry


Top
 Profile  
Reply with quote  
PostPosted: December 3rd, 2021, 6:51 am 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 8299
Location: Cologne (Germany)
I'll get back to you after the weekend. If you don't hear from me by monday evening, please send me a DM or email.

_________________
Benedikt Bauer - SVS (Spacial Volunteer Support)

Shop for readymade PAL scripts by countrywesterndj - Or get a custom script made by me (or others)

My Project:
Send "Now Playing" from SAM to Twitter and/or Facebook | Sourcecode


Top
 Profile  
Reply with quote  
PostPosted: December 11th, 2021, 10:09 am 
Offline
Senior User
Senior User

Joined: January 1st, 2009, 8:50 pm
Posts: 147
Mastacheata wrote:
I'll get back to you after the weekend. If you don't hear from me by monday evening, please send me a DM or email.



Hi, I hope all is well.
I've sent you a couple of PMs this week.
Please let me know your progress as my webhost is about to turn off php 5.6.4 permanently.

Thanks again,
Terry


Top
 Profile  
Reply with quote  
PostPosted: Yesterday, 12:12 pm 
Offline
Senior User
Senior User

Joined: January 1st, 2009, 8:50 pm
Posts: 147
tjoebgen wrote:
Mastacheata wrote:
I'll get back to you after the weekend. If you don't hear from me by monday evening, please send me a DM or email.



Hi, I hope all is well.
I've sent you a couple of PMs this week.
Please let me know your progress as my webhost is about to turn off php 5.6.4 permanently.

Thanks again,
Terry


@Mastacheata - any word on this yet?

Tks, Terry


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: Bing [Bot] and 12 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group