Jump to content

Auto database login for webform


xilllly

Recommended Posts

Hi, I'm trying to get a php webform to log onto the database automatically before it loads on the website page. In other words I don't want the customer having log onto the database or be a guest. I think I need the code below to do that. Question is, can I just add this code into the php file that is the webform or add the <?php            ?> to it and have it above the webform php code.

Also do I need to alter any other dbconnect php pages as well?

Also do I need to edit the htaccess file also.

 

 

 

function verify_code()

{

 

 

$connection = mysql_connect ("localhost", "fred", "kool3401") or die ('Error: ' . mysql_error());

$db = mysql_select_db ("october");

 

  {

    echo "Authenticated";

  }

 

 

Many Thanks

Link to comment
Share on other sites

I think he just wants the webpage to have access to the DB using the id/pw that is already setup for DB access.

 

So basically yes, you just need the proper connect string to allow the webpage to write to your database.

 

But without seeing your other code, no one can tell you if what you posted above will work or not as it is.

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.