sending a response back to a PHP site from rails application

Hi    I have an existing php application running commercially..Now I have a new rails application..So I have three fields like user_name ,password and company in the php page .Which when submitting connecting to my rails application ..To elaborate suppose I enter

username= user1 password = pass1 company = company1

    Then when submitting the php page it should goes to my rails application on port 3000 This I could do..Similary if I give a different company name then it wii be connected to my rails application on port 3001

       Now my request is if anything error happens for wrong password or wrong company name (for example) I need to redirect from rails controller action to the php login page it self..This I dont know how to do...I am totally new to this type of interconnecting two platforms...Could you please help me to solve this problem

Thanks in advance Sijo

you must have some kind of authentication system in Rails app.

so after comparing posted values..

if user exists then redirect_to "home/index" [home is controller and index action for rails app] else redirect_to "http://abc.com/login.php"

let me know

Ajit