forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 miscellaneous => Topic started by: panner on October 18, 2010, 10:10:01 pm

Title: PHP registration
Post by: panner on October 18, 2010, 10:10:01 pm
Hi;

Is it possible to automatically register a new user using PHP code?
 (for example using an email address as a user name and password)

If so -- do you have any hints about what the code should look like?

Thanks....

Ron
Title: Re: PHP registration
Post by: Αndré on October 20, 2010, 02:56:41 pm
Not sure what you're asking for. Please elaborate.
Title: Re: PHP registration
Post by: panner on October 20, 2010, 04:00:36 pm
Andre

I want to automatically register customers who purchase my online product into my Coppermine system. Sort of a bonus feature.

To do this I would take their purchase information (i.e. email address and product number) to use for the registration name and password.

Now I need some PHP code that will transmit the purchase information to the Coppermine system. For example -- log into the registration system or perhaps just make entries into the MySQL database (if that would work)...

Ron
Title: Re: PHP registration
Post by: Αndré on October 20, 2010, 04:14:26 pm
Just adding a new row to Coppermine's users table should work. Ideally, you would bridge Coppermine with your existing application.
Title: Re: PHP registration
Post by: panner on October 20, 2010, 04:25:42 pm
Andre

Sorry, I'm just a newbie -- I don't understand your comments. How do I add a new row to Coppermines user table? Where do I find the user table? What is bridging and how do I do that?

Could you elaborate a bit more or perhaps give me a link to more specific information.

Ron
Title: Re: PHP registration
Post by: Αndré on October 20, 2010, 04:37:42 pm
How do I add a new row to Coppermines user table? Where do I find the user table?
=
make entries into the MySQL database


What is bridging and how do I do that?
http://documentation.coppermine-gallery.net/en/bridging.htm


Could you elaborate a bit more or perhaps give me a link to more specific information.
http://documentation.coppermine-gallery.net/en/
Title: Re: PHP registration
Post by: panner on October 20, 2010, 05:03:43 pm
Thanks Andre -- you've been a really really big help.
I'm sure we all wish we had as much knowledge as you think you have.
Too bad your mamma never taught you about sharing :-)

Does anyone else out there know what Andre is talking about..
Anyone have any idea how to use PHP code to make an entry into a Coppermine table in MySQL...

The key here is that I need some PHP code --

Ron
Title: Re: PHP registration
Post by: Αndré on October 20, 2010, 05:13:05 pm
The key here is that I need some PHP code --
You don't need that code for Coppermine, but for your other web application while a user registers there. There you have to add just one simple SQL query (almost no PHP knowledge required) that puts the user data in Coppermines user table.

Here's a draft of that magic line:
Code: [Select]
mysql_query("INSERT INTO {insert coppermine table name here} (user_regdate, user_active, user_actkey, user_name, user_password, user_email, user_profile1, user_profile2, user_profile3, user_profile4, user_profile5, user_profile6, user_language) VALUES ({insert comma seperated values here})");Of course you have to connect to the correct database (if needed) and selected the correct database (if needed) before executing that line. Please read the PHP docs if you don't know how to do that, e.g. http://www.php.net/manual/en/function.mysql-select-db.php


Too bad your mamma never taught you about sharing :-)
Well, maybe you should also share some information about your environment. You haven't followed the board rules, so you should be grateful that you get an answer at all. We cannot help you if you don't tell us what you are using.
Title: Re: PHP registration
Post by: panner on October 20, 2010, 05:35:03 pm
Andre;

So what you are saying is that all I need to do is work with the Coppermine MySQL database directly?

BTW: your "magic line" does not show up in Internet Explorer -- but I was able to get it in FireFox
That's exactly what  I was looking for -- some way to tap into the Coppermine database.

Thanks Andre -- this information is much more useful and helpful -- at least it gives me something to work with.

Re: my sharing probably isn't much relative... I'm using a Unix Server "ixwebhosting" and the Coppermine system is not active yet. (I'm still trying to set it up).

Ron
Title: Re: PHP registration
Post by: Αndré on October 20, 2010, 05:40:52 pm
So what you are saying is that all I need to do is work with the Coppermine MySQL database directly?
Yes. That's basicly what Coppermine does as well. Of course there are additional checks if the user already exists and if the provided information is valid etc.
Title: Re: PHP registration
Post by: panner on October 20, 2010, 05:51:17 pm
Thanks Andre; Much appreciated.

... now that wasn't so hard was it?

Ron