php - How to embed mysql db content into 3rd party sites without providing remote access -


i writing set of html based resources, stored in mysql db on our server. resources contain images references, stored relative paths.

i can login admin panel , create , edit resources easily.

this bit done, , working well.

however, going want provide resource in 2 ways: packaged , hosted. 1 providing real problems hosted solution:

we want host database , image resources, want give access resources via set of templates other users host on own site. can brand templates accordingly, , have resource available @ own url e.g.

http://www.example.com/discojoe 

there 2 questions have on process, causing me real headaches:

• realise obvious security implication of providing read-only access our mysql server. alternative think of server side code running on our server, when requested, squirts requested data user. removes need them have mysql connection.

are there examples of above type of scenario online can read on, or can give pointers on how go addressing solution?

• users whom stream data (if above solution sensible), how go updating image src value on fly within html content. whilst want stored relative url in database, when retrieve data database, want convert image srcs relative absolute, absolute url specify.

i realise obvious security implication of providing read-only access our mysql server. alternative think of server side code running on our server, when requested, squirts requested data user. removes need them have mysql connection.

you create rest api(i return json) using predefined queries pdo prepared statements(safe against sql-injections). little bit of care make pretty safe. ofcourse if resources should protected, must add authentication system using simple api keys example. think generate these key same way prevent csrf($token = md5(uniqid(rand(), true));). maybe should add little bit more entropy, think going sufficient. if want correctly should use oauth instead.


with little bit of mod_rewriting write pretty urls.

for users whom stream data (if above solution sensible), how go updating image src value on fly within html content. whilst want stored relative url in database, when retrieve data database, want convert image srcs relative absolute, absolute url specify.

i think use any of many available template languages achieve this. jquery has 1 built-in


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -