Yii Framework Forum: Code in db - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Code in db Rate Topic: -----

#1 User is offline   Rukk 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 26-October 11

Posted 26 October 2011 - 04:16 AM

Hi, i am thinking of putting some php code in my db, the idea behind this is that i will have a table with different gadgets like counter,timer....(id,name,code) and a main task table(id,task,description) that will load different gadgets for every task, like:

task1
description1
timer1
counter1


task2
description2
counter2
counter3
...


is this a good idea, or should i use more conventional methods?? I want the ability that users submit their own gadgets.
Any suggestions welcome :)
Thanks
0

#2 User is offline   marco@sms 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 30
  • Joined: 08-August 11
  • Location:Hamburg, Germany

Posted 26 October 2011 - 04:39 AM

Letting User submit any PHP code is a high security risk, keep that in mind!

As for your question:
How about let the user upload php files with user defined widgets. The database will only contain widget names associated with these files.
0

#3 User is offline   Rukk 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 26-October 11

Posted 26 October 2011 - 05:04 AM

like images??
Didn't think about that. I like the idea.
For security i thought that the admin or moderator must approve it first.
0

#4 User is offline   marco@sms 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 30
  • Joined: 08-August 11
  • Location:Hamburg, Germany

Posted 26 October 2011 - 05:12 AM

Yes, approving is a good mechanism for that.

Like images. Users can contribute their "widgets", others can select them from the database and use it in any place.
0

#5 User is offline   Rukk 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 26-October 11

Posted 26 October 2011 - 04:26 PM

thanks for the quick reply.
One more thing, how to store parametars(the time for timers or number for countrs....) for "gadgets"? I was planing for a few tables:

user

id
name
pass
...


user_has_task (link table)
user_id
task_id


task
id
task
description


task_has_gadget
(link table)
task_id
gadget_id


gadget

id
name
path



i was thinking to use a array for parameters of gadgets, the problem is where to put them, in what table?? Any iseas?
0

#6 User is offline   marco@sms 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 30
  • Joined: 08-August 11
  • Location:Hamburg, Germany

Posted 27 October 2011 - 01:51 AM

well, nice designed you would have a table for the parameters like

parameters
name
value
gadget_id


But I think you could also store a serialized array anywhere as a quick solution.

For the invocation of your widget/gadget with parameters you can user
http://de2.php.net/m...ethod-array.php

This way you can use clean parameters on your methods. Please do NOT use on parameter for your widget as array.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users