Thursday, 15 April 2010

mysql - Using PHP to run SQL queries inside the header tags of page. Safe practice? -



mysql - Using PHP to run SQL queries inside the header tags of page. Safe practice? -

i have created website using dynamically loaded stylesheets. when logged in php page queries database in header tags (just before </header>) see user wants , loads appropriate stylesheet.

i wondering if safe practice. if utilize pdo , prepared statements, still potentially putting database or website @ risk in way querying database in header tags of page?

php server side language. php code run on server first, results of sent client. php code "embedded in" html convenience syntax, doesn't alter fundamental fact.

<h1><?php echo 'foo'; ?></h1>

is functionally identical to:

<?php echo '<h1>foo</h1>';

in other words, doesn't matter php code "inside" html. it's beingness interpreted php anyway , result sent client.

it not have influence on security in .php file set html.

having said that, should separate backend logic frontend templates. should doing database interaction first , html processing sec (or third, forth etc.). that's purely maintain code construction sane , maintainable though, again, doesn't matter security-wise.

php mysql

No comments:

Post a Comment