Jump to content

Recommended Posts

Hi,

I've made a php webform which works fine. I've put that into my website so members can add their details to be become a member of my club. Again that works fine. Only issue is that when members get to the membership page (member_add.php) on my website, members are asked to login as a user. I use a Mysql database on a linux server.

 

How do I set it up (correct php code to use) so members can add their details without having to login or be a guest, or setup a username, i.e. they just put in their details into the webform and it is added to the 'member' table automatically. No login required.

 

Members only have access to member_add.php. After entering their details and pressing "Submit", members are sent to a thank you webpage. Only I have access to the full database.

 

This automatic option is only needed for members to add data to the 'member' table as any other table and associated php page has a login for security reasons. Please note this question is in regard to a internet user, not a lan user.

 

Also I need this to be a secure link to the Mysql database.

 

Hopefully there is an answer to this? Thanks  :confused:

Rather than that, why don't I break my question down to its bare bones.

 

What is the best way to use php to allow internet users to add data to a Mysql database table? Bearing in mind that the internet user shouldn't have to login or click on a guest button to do so. They just click a submit button after having filled in a form on a webpage and info is added to the database.

 

Thanks...

Yes that is true, however whenever I do that, I am asked by Mysql for a database user name and password before the form data is allowed to pass to the database. How can I avoid that request happening, i.e. the form data being added without any login request by Mysql?

 

Thanks

So I just need to delete this part below from the code?

 

// check if logged in

if(!@$_SESSION["UserID"] || !CheckSecurity(@$_SESSION["_".$strTableName."_OwnerID"],"Add"))

{

$_SESSION["MyURL"]=$_SERVER["SCRIPT_NAME"]."?".$_SERVER["QUERY_STRING"];

header("Location: login.php?message=expired");

return;

}

 

  • 2 weeks later...

After much trial & error plus a lot of research, the solution to my problem was to tell the php code to ignore the code that was calling for a database login. I tried deleting that part of the code but the php just won't work then. So by adding /* at the start of the code I wanted to be ignored and */ at the end worked like a dream. Hope this helps someone else.... Xilllly

 

//  check if logged in

 

/*

if(!@$_SESSION["UserID"] || !CheckSecurity(@$_SESSION["_".$strTableName."_OwnerID"],"Add"))

{

  $_SESSION["MyURL"]=$_SERVER["SCRIPT_NAME"]."?".$_SERVER["QUERY_STRING"];

  header("Location: login.php?message=expired");

  return;

}

*/

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.