title: login authentication from saved session in mysql (0,1)
body: <p>i have</p>
  
  <pre><code> foo.com 
   foo.com/foo
  </code></pre>
  
  <p>both sites are the same script.  main site have  <code>Prefix</code>  and second site have <code>Prefix_1</code>
  they share one DB name same db_tables but connects upon the <code>Prefix</code> name. so both sites are executed in same mysql for different <code>prefix</code></p>
  
  <p>example table:</p>
  
  <pre><code>Prefix_users
  Prefix_1_users
  </code></pre>
  
  <p>i manage that when registration from the main foo.com it will also update the <code>prefix_1</code> which are connected to foo.com/foo </p>
  
  <p>in this way if someone register on foo.com he will be also able to login in foo.com/foo
  successfully.</p>
  
  <p>My question is, when session <code>start()</code> on foo.com and create <code>$session-&gt;value('user_id')</code> i want also to start on foo.com/foo so the same user dont need to login again on the other site foo.com/foo</p>
  
  <p>i was thinking to save the session from foo.com into <code>prefix</code> and table <code>prefix_1</code>
  and when user login from foo.com he will be also start the session from foo.com/foo</p>
  
  <p>because they share one DB name , and same user name and password from 2 different table (different prefixed table )  but the session will not start on foo.com/foo
  unless the user post the same user name and password again.</p>
  
  <p>so any suggestions, 
  this is the code</p>
  
  <pre><code>`&lt;pre&gt;session_start();
   define ('IN_SITE', 1);
   include_once ('includes/global.php');
   include_once ('includes/class_user.php');
   include_once ('includes/functions_login.php');
   if (!$session-&gt;value('user_id'))
   {
  header_redirect('login.php');
   }
    else
    {
  $template-&gt;set('session', $session);
  (array) $summary_page_content = null;   
  $default_landing_page = 'summary';
  $default_landing_section = 'summary_main';&lt;/pre&gt;`
  </code></pre>
  
  <p>The Idea IS Here-
   the idea is that from function_login.php   $is_login = $db->num_rows($login_query); are executed on that file and create the session and redirect to member_area.php , so i want to know how i can execute the code and start 2 sessions one for the foo.com/member_area.php and other session to be included for foo.com/foo/member_area.php </p>
  
  <p>remember that both have same tables but different prefixes and both tables have the same user_id , user_name, password </p>