I have the following question. I have 2 databases on 2 different servers for 2 different sites. The first one is the system admin. The second one is the actual site with login and some usage and stuff. When the user register itself on t开发者_C百科he second site, I want his information to be inserted in the 2 databases but I don't want to include the user and the password for the admin site in the web site. For an example: I am in http://mysite.com/login.php - here I make the db connection and insert the user. From here I want this info to be inserted in the database of the admin which is on http://myadmin.com but I don't want to include the user and password for the admin in the web site files. How do I achieve this in PHP? Some people say Web Services like SOAP, but I don't know. Any suggestions? Thanks in advance.
you can create a php page on the mysite server that can receive an HTTP request with POST data with the user's information to insert, and another checksum field for security.
the php on the server will insert into the DB, and the request will be sent over http with no credentials necessary.
however security issues may still be a problem here
- Create a PHP page in myadmin.com that would insert the records. It would accept data in form of PUT (PUT http requests)
- Make it password protected with PHP code or via .htacess
- For additional security, allow requests ONLY from the IP addresses of mysite.com
- On any new registration on mysite.com,call http://myadmin.com/db/newreg.php
Make sure username/password for newreg.php is different from MySQL or other system passwords.
精彩评论