Is this doable?

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
My customer has a login form on their site that goes to a remote database.
The remote database creates its own login errors if the user (say) types in
the password incorrectly. The customer wants customized messages.
My thinking is to have a form go first to a php form handling page on the
customer's server, check for errors. If there are errors then custom
messages can be echoed back to the login page. The issue is how can the, now
accurate, ID and PW get passed to the remote database automatically?
 I am guessing that the initial error checking page would not encrypt the
password as that gets done on the remote database of which I have no

My php skills are very basic. Any help would be appreciated. Is this at
least doable?

Re: Is this doable?

Hello, are you connecting to the database from your PHP script and issue
queries to check user credentials? if so, why does it matter whether the
database is remote or not? please clarify. Or by "remote database" you mean
a different web application? then how does your application communicates
with the other one?

Quoted text here. Click to load it

Re: Is this doable?

Quoted text here. Click to load it
Sorry if I am not clear. When I say remote db it is one that I have no
access to other than as a user via the login form on a web page.
That db has a script that issues its own error message. I have no control
over that script and I don't even know what language it is written in. I
know it doesn't make much logical sense, but the cutomer wants their own
text echoed back to the login screen if a user screws up. My suggestion may
not be the most elegant solution. But I thought I could hide the original
login form, create my own which would go to another db that I do have access
to in order to generate error messages of the type acceptable. But then my
question is how does the PHP handling page pass the correct login id and pw
to the primary db (the one I have no control over). I guess it boils down to
how do I get the PHP script to pass values into fields on a login form I
have no control over? It seem to me that I should be able to grab the code
(which accepts the input on the orginial form) and put that in a PHP script
which would log into the original db. Does this make sense and it is likely
to work? I am probably missing something obvious to those that know their
stuff. I only wish I did. Thanks.
Hope this claifies.

Re: Is this doable?

it looks like your PHP code needs to submit another http request to the
other server and to parse its html response.

forms are usually submitted using the HTTP POST verb with the form data in
the body of the message. usually you specify content-encoding header with
"application/x-form-urlencoded" value and put the data in to the body in the
form similar to that for url query strings for GET requests:


so all you need to do is to send this request to your other web server and
get its response in the form of html and parse it.

Quoted text here. Click to load it

Re: Is this doable?

if you are connecting to the DB remotely you can have the page make the
connection and verify it then save it in a session variable.

Something like:
page 1 - login form sends input to ->
page 2 - verify form input and try to connect (ex: mysql_connect,
mysql_select_DB).  If a valid connection is made you can then save the
input into a session variable ($_SESSION) and use it whenever and where
ever you need to interact with the DB.  If there is no valid connection
you send back an error message (Ex: The database will not allow you to
connect with that information.  Please check your data and try again.)

Make sense or did I lose you at the last left. :)

Christopher Richards wrote:
Quoted text here. Click to load it
types in
the, now

Re: Is this doable?

Quoted text here. Click to load it

Maybe a slight swerve.

There are two databases. (1)Primary db(don't know what language scripts are
written in that interact with it and I have no access to it only as a user)
(2)My (proposed) substitute db PHP and mySQL on my server.

page 1 My substitute login input form goes to mySQL DB (on my server) to
check if ID and PW valid. If no, then send whatever messages back to the
login page.

If there are no errors and the ID and PW are correct then:

I want to pass the ID and PW into the ID and PW fields of the  original
login form which will go to the db I have no control over. How about using
the code from the original login form (the one that I substituted my own
for) in the PHP script so that now logs into the primary db number one I
have no control over? That script wont generate errors because I have
already checked for errors in my substitute script.  I don't (yet) know
enough about how the $_SESSION constant would work here. Is this more clear?
Thanks for your help.

Site Timeline