Page 1 of 1
[SOLVED] rotating background image stops working
Posted: Wed Feb 17, 2016 3:42 am
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
Re: rotating background image stopped working
Posted: Wed Feb 17, 2016 8:52 am
by Rolf
That code is 13 years old... I think that is your answer

Better look into jQuery sliders now!
Re: rotating background image stopped working
Posted: Fri Feb 19, 2016 4:50 am
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
Re: rotating background image stopped working
Posted: Fri Feb 19, 2016 7:39 am
by Jeff
Check the error logs. They will show if a command is no longer valid.
Re: rotating background image stopped working
Posted: Fri Feb 19, 2016 8:26 am
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
Re: [CLOSED not solved] rotating background image stops work
Posted: Fri Feb 19, 2016 9:57 am
by Jeff
Check your .htaccess rules, you might have blocked where php files can be executed.
Re: [CLOSED not solved] rotating background image stops work
Posted: Fri Feb 19, 2016 12:33 pm
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.
Re: rotating background image stops working
Posted: Fri Feb 19, 2016 4:08 pm
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.
Re: rotating background image stops working
Posted: Fri Feb 19, 2016 5:10 pm
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.
Re: rotating background image stops working
Posted: Fri Feb 19, 2016 6:37 pm
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).
Re: rotating background image stops working
Posted: Sat Feb 20, 2016 2:34 pm
by Rolf
try renaming .htaccess file in /tmp/ folder
Re: rotating background image stops working
Posted: Sun Feb 21, 2016 8:40 am
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.
Re: rotating background image stops working
Posted: Sun Feb 21, 2016 4:01 pm
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
Re: rotating background image stops working
Posted: Mon Feb 22, 2016 2:44 pm
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