Jump to content

Recommended Posts

Howdy,

 

I want to allow my registered users to create their own css for their page. My question is how would i go about saving this information. I have a few ideas.

 

1. Say I have five different css styles I am allowing them to edit. Would I create a table with five different columns and I save each css style in its appropriate column.

 

2. Save the entire user created css file into the database.

 

Any other ideas??

Link to comment
https://forums.phpfreaks.com/topic/162795-saving-css/
Share on other sites

Never create a row with an arbitrary number of columns.  So you create a row with five fields for CSS, then you decide to allow a sixth, how much code do you have to change?  And are you shure you got them all?

 

I would make each CSS a separate row in the db, tied to the user.

 

One Thing -- you have to be VERY careful, or have VERY trustworthy users.  You are giving them an excellent opportunity to inject HTML and possibly PHP commands into your page.

Link to comment
https://forums.phpfreaks.com/topic/162795-saving-css/#findComment-859097
Share on other sites

Well, once you are inside a style sheet, there should not be any HTML tags.  I think the strip_tags function might be useful. 

 

<STYLE>
<?php echo string_tags($style); ?>
</STYLE>

 

That's where I would start. 

 

Hopefully, If someone else has a better/different idea they will chime in.

Link to comment
https://forums.phpfreaks.com/topic/162795-saving-css/#findComment-859208
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.