ispCP - Board - Support
Login from website to ispCP - Printable Version

+- ispCP - Board - Support (http://www.isp-control.net/forum)
+-- Forum: ispCP Omega Support Area (/forum-30.html)
+--- Forum: System Setup & Installation (/forum-32.html)
+--- Thread: Login from website to ispCP (/thread-13096.html)



Login from website to ispCP - davidxone - 03-20-2011 02:05 AM

Hello,

I need for my website make new "external login".
User is loged in my own system and there he has his hosting accounts > my idea is - if user click on his hosting account from list, that automatically log him to choosed hosting ispCP account.

So I need PHP script to make this...
I tried it, but still a cant login into ispCP.

Now I´m using this sessions:
$_SESSION['user_logged'] = $name;
$_SESSION['user_pass'] = $pass;
$_SESSION['user_type'] = $type;
$_SESSION['user_id'] = $id;
$_SESSION['user_email'] = $email;
$_SESSION['user_created_by'] = $by;
$_SESSION['user_login_time'] = $cas;
$_SESSION['logged_from'] = $id;
$_SESSION['logged_from_id'] = Here i dont know value to asign.

Database insert:
INSERT INTO login(session_id,ipaddr,lastaccess,user_name) VALUES('".session_id()."','".$_SERVER["REMOTE_ADDR"]."','".$time."','".$name."')

AND

write_log($name." logged in.");

...
what i need more to make it happend? Thank you for your answers Smile


RE: Login from website to ispCP - kilburn - 03-20-2011 04:48 AM

You can not create the session directly into the database, since the corresponding session file (located in /var/www/ispcp/gui/phptmp) will be missing.

What you should do is:

1. Login the user by submitting a proper POST request to the login page (as if it was a guy with a browser performing the login).
2. Update the "ipaddr" field in the "login" table of the ispcp database.
3. Redirect the user to ispcp.


RE: Login from website to ispCP - davidxone - 03-20-2011 10:08 AM

(03-20-2011 04:48 AM)kilburn Wrote:  You can not create the session directly into the database, since the corresponding session file (located in /var/www/ispcp/gui/phptmp) will be missing.

What you should do is:

1. Login the user by submitting a proper POST request to the login page (as if it was a guy with a browser performing the login).
2. Update the "ipaddr" field in the "login" table of the ispcp database.
3. Redirect the user to ispcp.

Thank you for answer.

But I have one problem - I can read user password from database only in hash - i dont have source(of password - non-hash) necessary for proper login.

Can you give advice, how I can solve this? Smile