Skip to Content
It is currently April 14th, 2021, 8:00 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 39 posts ]  Go to page 1, 2, 3  Next
Author Message
PostPosted: November 3rd, 2020, 4:51 pm 
Offline
Junior User
Junior User

Joined: October 30th, 2020, 9:31 pm
Posts: 25
hi all could someone please help me
i'm trying to setup php template and its giving me errors

my config is correct as well
im getting this error

Parse error: Invalid numeric literal in C:\Program Files\Ampps\www\req\common\form.php on line 56

then when i remove all 0's
i get different errors


Top
 Profile  
Reply with quote  
PostPosted: November 4th, 2020, 3:28 am 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 8169
Location: Cologne (Germany)
Downgrade PHP to 5.x if you want to keep using the old version of the PHP templates.
Otherwise upgrade your templates if you want to use them with PHP 7/8.
New templates are included from 2018.3 and onwards and there's an unofficial fix made by me in the pinned thread of the Web Features forum: viewtopic.php?f=22&t=53771

_________________
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: November 4th, 2020, 10:59 am 
Offline
Junior User
Junior User

Joined: October 30th, 2020, 9:31 pm
Posts: 25
so i got my php template working now im getting this error

Fatal error: Uncaught Error: Class 'Song' not found in C:\Program Files\mysamfolder\req\code\code.request.php:19 Stack trace: #0 C:\Program Files\mysamfolder\req\web\request.php(8): require_once() #1 {main} thrown in C:\Program Files\mysamfolder\req\code\code.request.php on line 19

could anyone elaborate please!!


Top
 Profile  
Reply with quote  
PostPosted: November 5th, 2020, 4:42 am 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 8169
Location: Cologne (Germany)
Is that the only error being shown?
Did you add a typo to the require_once or remove any of the files?
Have you tried changing the error level (error_reporting(E_ALL) as mentioned in the other thread)? => If so, does that show any additional warnings?

Sounds like dumb questions, but that's really how debugging problems works: Super tiny and super stupid-safe steps.


If it's neither of that, I'm pretty much out of ideas and would need to see the code. Attach a zip file with your samPHPweb folder or put it somewhere I can download it (Dropbox, OneDrive, Amazon Drive, whatever)

_________________
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: November 5th, 2020, 5:25 am 
Offline
Junior User
Junior User

Joined: October 30th, 2020, 9:31 pm
Posts: 25
here is the zipped up folder you asked for


Attachments:
req.zip [283.6 KiB]
Downloaded 67 times
Top
 Profile  
Reply with quote  
PostPosted: November 5th, 2020, 5:26 am 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 8169
Location: Cologne (Germany)
Alright. I'll have a look in my lunch break. ;)

_________________
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: November 5th, 2020, 5:31 am 
Offline
Junior User
Junior User

Joined: October 30th, 2020, 9:31 pm
Posts: 25
ok thanks


Top
 Profile  
Reply with quote  
PostPosted: November 5th, 2020, 9:15 am 
Offline
Junior User
Junior User

Joined: October 30th, 2020, 9:31 pm
Posts: 25
did you have look at script?


Top
 Profile  
Reply with quote  
PostPosted: November 7th, 2020, 11:27 am 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 8169
Location: Cologne (Germany)
Hey there,

sorry for the delay, my internet was gone for a while and I didn't really want to check the forums on my phone.

So anyways: From what version of SAM is that code? I have both 4.9.8 and 2020.3 her, but neither of them has a code.request.php file similar to yours.
Yours appears to make some database checks before sending the request off to SAM, which is why your code fails.
This has nothing to do with PHP5/7, but is a simple error in the code. You can't use the Song class before you import it. The Database class is universally imported when verifying the config, but the song class must be manually required in each file you use it.
In my original SAM files the Song class is only used at the very end of the file and imported there:
Code:
// Retrieve details of the requested song from the database.
if ($requestID > 0) {
    require_once('classes/class.song.php');
    $song = Song::getRequestedSong($requestID);
}


You however use the Song class in line 19 already to perform additional checks that are usually handled by SAM and not the website.
In order to do that, you have to copy that require_once statement from line 90 to before you first use the Song class.

_________________
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: November 7th, 2020, 12:57 pm 
Offline
Junior User
Junior User

Joined: October 30th, 2020, 9:31 pm
Posts: 25
i downloaded a copy of yours some wherein this
forum thatswereits from but i do have the original php that
samcomes with? but im using my own server called ampps now thats using php 7.3
with apache butwhen i put the original php templates on i get errors
also weres the required once statement?

what code do i copy from and too?


Top
 Profile  
Reply with quote  
PostPosted: November 7th, 2020, 1:01 pm 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 8169
Location: Cologne (Germany)
My update package from the other thread doesn't include the code.request.php

Anyway: The solution for your error was to copy the require_once from the snippet I posted to the line right before Song::get... is used.
After that it worked just fine for me.

There's one more notice in another script, but that only appears if you set your error reporting levels very high and is not recommended for production ready websites.

See the attached file for the fix:


Attachments:
File comment: rename and remove .txt at the end
code.request.php.txt [2.81 KiB]
Downloaded 67 times

_________________
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: November 7th, 2020, 1:10 pm 
Offline
Junior User
Junior User

Joined: October 30th, 2020, 9:31 pm
Posts: 25
it is there

// Retrieve details of the requested song from the database.
if ($requestID > 0) {
require_once('classes/class.song.php');
$song = Song::getRequestedSong($requestID);


Top
 Profile  
Reply with quote  
PostPosted: November 7th, 2020, 1:13 pm 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 8169
Location: Cologne (Germany)
Copy the line with require_once to the top of your file right before $song = Song::getSong($songID);
Or just take the attached file from my last post and remove the txt at the end.

_________________
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: November 7th, 2020, 1:19 pm 
Offline
Junior User
Junior User

Joined: October 30th, 2020, 9:31 pm
Posts: 25
think its going to work its now asking me to verify
database settings lol


Top
 Profile  
Reply with quote  
PostPosted: November 7th, 2020, 1:28 pm 
Offline
Junior User
Junior User

Joined: October 30th, 2020, 9:31 pm
Posts: 25
i put your version in and now im getting this error

Code:
Fatal error: Uncaught Error: Call to undefined method Zend_Db_Adapter_Mysqli::fetchObject() in C:\Program Files\mysamfolder\req\code\code.request.php:30 Stack trace: #0 C:\Program Files\mysamfolder\req\web\request.php(8): require_once() #1 {main} thrown in C:\Program Files\mysamfolder\req\code\code.request.php on line 30


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 39 posts ]  Go to page 1, 2, 3  Next

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 20 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