xilllly Posted November 7, 2010 Share Posted November 7, 2010 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 Quote Link to comment https://forums.phpfreaks.com/topic/217999-auto-database-login-for-webform/ Share on other sites More sharing options...
trq Posted November 7, 2010 Share Posted November 7, 2010 Sorry, but your post makes little sense. How exactly do you plan an authenticating your users without asking them for any credentials.? Quote Link to comment https://forums.phpfreaks.com/topic/217999-auto-database-login-for-webform/#findComment-1131353 Share on other sites More sharing options...
revraz Posted November 7, 2010 Share Posted November 7, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/217999-auto-database-login-for-webform/#findComment-1131357 Share on other sites More sharing options...
xilllly Posted November 7, 2010 Author Share Posted November 7, 2010 Yes revraz you are right, thats exactly what I want to happen. I have attached the other code as its rather long to be putting in this forum box. Thanks. [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/217999-auto-database-login-for-webform/#findComment-1131500 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.