Jump to content

[SOLVED] Quick security question.


NerdConcepts

Recommended Posts

Almost all of my php pages include many instances where a sql connection is needed. To keep myself from having to keep coding the SQL stuff I run the connection within the header of the page and close the connect at the footer. By doing this am I opening up myself to a security problem. In my mind I am not, but the books I have seem to close the sql connect before HTML begins. My problem is that inside the HTML I need a database connection to pull information from the database. Just wondering I guess.

Link to comment
Share on other sites

I don't think there's a security problem there.  Just make sure you sanitize any user provided data that goes into database queries.  There's no need to close the connection early for security (though it's often good for performance reasons).

Link to comment
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.