[SOLVED] rotating background image stops working

The place to talk about things that are related to CMS Made simple, but don't fit anywhere else.
Locked
User avatar
frankmanl
Power Poster
Power Poster
Posts: 425
Joined: Sat Jul 12, 2008 3:50 am

[SOLVED] rotating background image stops working

Post by frankmanl »

After upgrading tot CMSMS 2(.1.2) my rotating background image is gone.
I not only upgraded from 1.12 to 2.1.2 but I also upgraded from PHP 5.5 to PHP 5.6 - I wonder if any of these changes now prohibits my rotating background image.

For the background image of div #linkerkolom I use the script as described in a 2003 article on A List Apart: http://alistapart.com/article/randomizer
I renamed the php file to random_view.php.

My css is

Code: Select all

#linkerkolom {
	background: url([[root_url]]/uploads/images/randomlinks/random_view.php);
	position: absolute;
	etc.
I checked this css by replacing random_view.php by the name of an actual image in that directory, which then worked fine.

My php code is in the attachment.

Frank
Attachments

[The extension txt has been deactivated and can no longer be displayed.]

Last edited by frankmanl on Mon Feb 22, 2016 2:45 pm, edited 3 times in total.
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: rotating background image stopped working

Post by Rolf »

That code is 13 years old... I think that is your answer ;)
Better look into jQuery sliders now!
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
User avatar
frankmanl
Power Poster
Power Poster
Posts: 425
Joined: Sat Jul 12, 2008 3:50 am

Re: rotating background image stopped working

Post by frankmanl »

Yes, it's 13 years old, but I'm wondering if there maybe is just one line in it that's no longer valid since I changed from PHP5.5 to 5.6.
I understand there are modern techniques like jQuery, but I'd think this actually is a quite simple script that can hardly be outdated, except for syntax ...
Changing one line seems to be far more easier than including a new script.

Frank
Jeff
Power Poster
Power Poster
Posts: 961
Joined: Mon Jan 21, 2008 5:51 pm
Location: MI

Re: rotating background image stopped working

Post by Jeff »

Check the error logs. They will show if a command is no longer valid.
User avatar
frankmanl
Power Poster
Power Poster
Posts: 425
Joined: Sat Jul 12, 2008 3:50 am

Re: rotating background image stopped working

Post by frankmanl »

Only line in error log says:

Code: Select all

[Fri Feb 19 09:12:23 2016] [error] [client ...] client denied by server configuration: .../httpdocs/cmsms2/uploads/images/randomlinks/random_view.php, referer: .../tmp/cache
I don't understand this.
I 'll have a look at another solution.

Frank
Jeff
Power Poster
Power Poster
Posts: 961
Joined: Mon Jan 21, 2008 5:51 pm
Location: MI

Re: [CLOSED not solved] rotating background image stops work

Post by Jeff »

Check your .htaccess rules, you might have blocked where php files can be executed.
User avatar
frankmanl
Power Poster
Power Poster
Posts: 425
Joined: Sat Jul 12, 2008 3:50 am

Re: [CLOSED not solved] rotating background image stops work

Post by frankmanl »

Structure of directories and files is as follows:

Code: Select all

/httpdocs/
     .htaccess
     cmsms2/
          .htaccess
          the complete cmsms installation
The first .htaccess file:

Code: Select all

RewriteEngine On
RewriteBase /cmsms2/
RewriteCond %{REQUEST_URI} !^/cmsms2.*$
RewriteRule ^(.*)$ /cmsms2/$1 [L]
RewriteRule . index.php [L]

AddHandler x-httpd-php56 .php
and the second .htaccess file in directory /cmsms2/:

Code: Select all

AddHandler x-httpd-php56 .php
php_value session.cookie_httponly true

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /cmsms2

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?page=$1 [QSA]
</IfModule>

<IfModule mod_header.c>
# Disable ETags
Header unset ETag
FileEtag None
# For Security
Header set X-Frame-Options "SAMEORIGIN"
</IfModule>

<IfModule mod_deflate.c>
# Compress css, plaintext, xml, gif, and images in transport.
AddOutputFilterByType DEFLATE text/css text/plain text/xml image/gif image/jpeg image/png
</IfModule>

<IfModule mod_expires.c>
<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
# Set expires tags on various files... so that the browser wont attempt to reload them.
ExpiresActive On
ExpiresDefault "access plus 1 year"
<IfModule mod_header.c>
  # Setting cache control to public allowes proxy servers to cache the items too.
  Header set Cache-Control "public"
</IfModule>
</FilesMatch>
</IfModule>
There may be old stuff in there, since I started this site years ago.
chandra

Re: rotating background image stops working

Post by chandra »

Please check htaccess inside /uploads and /uploads/images.

As default it's not allowed to run php scripts from these places.

Maybe you should better place your script inside a user defined tag.
Jeff
Power Poster
Power Poster
Posts: 961
Joined: Mon Jan 21, 2008 5:51 pm
Location: MI

Re: rotating background image stops working

Post by Jeff »

I would also talk to your hosting company, they may be able to tell you what else has change to restrict the execution of that script.
Maybe you should better place your script inside a user defined tag.
The problem with using an UDT is the result is cached if it is put directly in the stylesheet.

You could put it in a UDT then create a page that only contains that UDT and call that page from the stylesheet with the ?showtemplate=false param.
chandra

Re: rotating background image stops working

Post by chandra »

Jeff wrote: The problem with using an UDT is the result is cached if it is put directly in the stylesheet.
If it's stylesheet related this css part should be created by udt completely so caching could be deactivated (param nocache).
User avatar
Rolf
Power Poster
Power Poster
Posts: 7825
Joined: Wed Apr 23, 2008 7:53 am
Location: The Netherlands
Contact:

Re: rotating background image stops working

Post by Rolf »

try renaming .htaccess file in /tmp/ folder
- + - + - + - + - + - + -
LATEST TUTORIAL AT CMS CAN BE SIMPLE:
Migrating Company Directory module to LISE
- + - + - + - + - + - + -
Image
User avatar
frankmanl
Power Poster
Power Poster
Posts: 425
Joined: Sat Jul 12, 2008 3:50 am

Re: rotating background image stops working

Post by frankmanl »

@chandra:
Please check htaccess inside /uploads and /uploads/images.
As default it's not allowed to run php scripts from these places.
Maybe you should better place your script inside a user defined tag.
This definitely causes the problem, .htaccess here is:

Code: Select all

# To deny PHPs
<Files ~ "\.(php|php3|php4|php5|phtml|pl|cgi)$">
  order deny,allow
  deny from all
</Files>
When I remove this code the script works fine again.
Now, is it wise to remove this script?

@rolf:
try renaming .htaccess file in /tmp/ folder
There is no .htaccess there. But I solved the problem as described above.
chandra

Re: rotating background image stops working

Post by chandra »

frankmanl wrote: Now, is it wise to remove this script?
A big YES ;)!

/uploads folder is an exclusive place for media files inside CMSMS (images, video, pdf and so on) but NOT for scripts which needs to execute.

It's your choice to place it in root folder or maybe /libs
User avatar
frankmanl
Power Poster
Power Poster
Posts: 425
Joined: Sat Jul 12, 2008 3:50 am

Re: rotating background image stops working

Post by frankmanl »

Thanks to all of you for your help.
I solved it as follows:

Code: Select all

# To deny PHPs
<Files ~ "\.(php|php3|php4|php5|phtml|pl|cgi)$">
  order deny,allow
  deny from all
</Files>

# but to allow random_view.php
<Files ~ "random_view\.php$">
  allow from all
</Files>
In this way all php files/scripts are prohibited, except for the one I need.

Frank
Locked

Return to “The Lounge”