Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>First, if you are placing the rails app in a sub directory it is possible to use mod_rails. In your configuration for the PHP site you can have a location that has a root for rails.</p> <pre><code>&lt;Location /railsapp&gt; DocumentRoot /.../app/public &lt;/Location&gt; </code></pre> <p>To get a session over to the rails side, you could either create a connect page on the rails and call it from the PHP side and pass in some data to login. You just need to protect this page from any request not from the localhost (easy to do).</p> <p>You could also switch rails to use a database to store its sessions, you should then be able to generate a session id, store it in a cookie with the correct name and secret, and create a session in the database manually with that id.</p> <p>You can also (which I recommend) have proxy page on the rails side which logs the user in and redirects them to their desired page. You could do it like this (<em>not actual working code, but you get the idea)</em>:</p> <p>PHP</p> <pre><code>$key = md5hash($user_id . $user_password_hash . $timestamp) $url = "/railsapp/proxy?userid=" . $user_id . "&amp;key=" . $key . "&amp;page=home%2Fwelcome" &lt;a href="&lt;$ $url $&gt;"&gt;Rails App&lt;/a&gt; </code></pre> <p>Rails</p> <pre><code>map.proxy 'proxy', :controller =&gt; 'proxy', :action =&gt; 'connect' class ProxyController &lt; ActionController::Base def connect key = ... if params[:key] == key login_user params[:userid] redirect_to params[:page] else render :nothing, :status =&gt; 403 end end end </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload