1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

Log out redirect to different page

Discussion in 'Plesk for Linux - 8.x and Older' started by Garp, Jul 6, 2005.

  1. Garp

    Garp Guest

    Hello All.

    I am looking for a way to redirect the users that log out of the Controlpanel (7.5.2) to another page than the default page. The destination should offcourse be our companies website, where we also provide a central login.

    Now i know that logout.php3 has something to do with this process and that i can find it in '/usr/local/psa/admin/htdocs', but that's all. I would really appreciate it if someone could point me in the right direction or even know the downright answer.

    Anyone fixed this successfully? I STF'ed, but found no real usefull info for 7.5.2




    Ok, i found something.

    make a backup of /usr/local/psa/admin/htdocs/logout.php3

    # cd /usr/local/psa/admin/htdocs/
    # cp logout.php3 logout_backup.php3
    # touch newlogout.php3
    # chgrp psaadm newlogout.php3
    # chmod 550 newlogout.php3

    Script to go into newlogout.php

    # vi newlogout.php3

    mysql_connect ("localhost", "admin", "your admin password");
    mysql_select_db ("psa");
    mysql_query ("DELETE FROM sessions WHERE session_id = '$sid'");
    header ("Location: http://www.page-to-redirect.to");

    # cp newlogout.php3 logout.php3

    You should be done now; it works for me. Only thing is doesn't do right is remove the user session.

    3 questions remain;

    1. Can anyone confirm that this method doesn't create any problems, now or in the future?
    2. Who can help me adjust this script so it does actually log out the user?
    3. What's the syntax to cat the admin pass in this scipt without actually putting the admin pass in the script?

    Any help in creating a working script would be grately appreciated by me and probably a lot of other people....
  2. serve-you.net

    serve-you.net Guest

    I haven't tried this method recently, so I can't say for sure if it still works. Why not try it out and find out? Worst case is you copy the backup back if it doesn't work.

    `cat /etc/psa/,psa.shadow`
  3. Garp

    Garp Guest

    Well, i did try it and it works just fine. Only thing is doesn't do right is actually removes the user session; the sql commands aren't right i guess.

    The thing is that i'm not really a mysql or script hero....

    Agian; if someone could help me with the proper removal of the session it is greatly appreciated....
  4. jamesyeeoc

    jamesyeeoc Guest

    1. Actually the first thing to check is that your $sid is getting a proper value.

    If $sid ends up with no value, then the rest of the mySQL commands could be correct but won't remove a session with a null value.

    2. I am able to login to Plesk CP with cookies disabled. Even when I allow cookies and login, I can still find no cookie file corresponding to my logged in session.

    3. As of PHP 4.1.0 the $HTTP_COOKIE_VARS has been deprecated per www.php.net docs. Has been replaced by superglobal $_COOKIE

    4. Try the following to see what the arrays hold:

    Hope this helps. If you figure it out, please post here to help future readers.
  5. Garp

    Garp Guest

    Well, Plesk doesn't appear to use a cookie i guess then. The output of your little script shows no plesk session.

    I'm stuck....
  6. Garp

    Garp Guest

    The logoutredirect has been working fine for over a month, only the sessions are not disconnected nicely. Did anyone get any bright ideas over the last 30 days?

  7. jamesyeeoc

    jamesyeeoc Guest

    Just re-read the thread. Ummm, bright idea #1, why not delete the session based on the 'ip_address' field of the connection? This would assume that only one connection to the control panel would exist for a given ip_address.
  8. Garp

    Garp Guest

    Ok, and how should one accomplish that?

    Any idea what the mysql query should look like (or be)?
  9. jamesyeeoc

    jamesyeeoc Guest

    Disclaimer: The basic code was what you posted, all I have done is change it to reflect IP Address instead of session number.

    If the original code is flawed, you will have to work that out since it is not my code or SQL query. And I am not an expert on thinking up queries, that's why I use phpMyAdmin! YMMV

    Hopefully your backup server will be running before you try this out.
  10. munkynpunky

    munkynpunky Guest

    I did what it says above, but now when i log out all its says is
    so im slightly confused as to what ive done wrong...
    I've checked and checked and tried both the versions written above and they both cause the error..