html - Is it safe to let PHP generate my stylesheet with file_put_contents? -
Trying to create a retaining website, I thought it would be good to call HTML in lines with PHP And only one stylesheet css required, in this way I can edit CSS once, for many goals. I manage it in this way:
This essential element is PHP calling:
So this is a checkbox-1pp file, which is said in HTML:
This is the same php file, the required stylesheet is written in the stylesheet, which has not been done earlier:
But I think it creates problems with security as well as many requests, because it is affecting the stylesheet on the server, which should be writeable and Trying to reach more than one person. Am I right or is this a safe way?
If not, would it be possible to do it in another way? Create a new stylesheet per user? Temporarily?
Thanks in advance!
This solution is not good ... and this is the reason:
< Li> As I can see, you are modifying the same CSS file. This will affect all users who are waiting for the site.
-
With many refresh, file_put_contents can sometimes erase the whole file (like most text-based visits counters).
-
The CSS files are not that big, while they are Mozilla, the browser forces them not to cache, but every time they download the whole file, because it Was revised. Downloading a large file (20kb?) Is easy, so many times download 19.5kb file.
-
If you want JavaScript and JavaScript to work, you dynamically change some styles why not use the technology?
-
File_put_contents is one of the functions, we should ... do not use it, if we do not want it. -
if (srpo ($ block css, '' ol>
last hope solution: < / P>
You can create sessions for each user, and create a CSS file for each user (session_id.css). In that case, the css file will be cached, but also a Not good idea, if there are many users this is a dead-end-solution, or a one-minute solution is required Use the file to put the file without a good idea to create a file, Jodi Fitzpatrick
Jodi Fitzpatrick . Good solution, but Jquery or Javascript should still be better, while creating the entire CSS on the fly, the server takes time. Hope this helps.
Comments
Post a Comment