Author Topic: [MOD] Logout from ACP (Admin Control Panel)  (Read 43373 times)

0 Members and 1 Guest are viewing this topic.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
[MOD] Logout from ACP (Admin Control Panel)
« on: March 11, 2005, 12:45:37 AM »
This mod will let admin logout from ACP without needed go to the main page to do so.

Step 1.
Open admin/index.php
Find:
Code: [Select]
        <td align="right"><b><a href="<?php echo $site_sess->url(ROOT_PATH); ?>" target="_blank"><?php echo $lang['goto_homepage']; ?></a>&nbsp;&nbsp;</b></TD>Insert below:
Code: [Select]
<!-- MOD ACP LOGOUT INSERT //-->
        <td align="right"><b><a href="<?php echo $site_sess->url("index.php?action=logout"); ?>" target="_parent"><?php echo $lang['logout']; ?></a>&nbsp;&nbsp;</b></TD>
<!-- MOD ACP LOGOUT END INSERT //-->


Step 2.
Open admin/admin_globals.php
Find:
Code: [Select]
require(ROOT_PATH.'lang/'.$config['language_dir'].'/admin.php');

Insert above:
Code: [Select]
/*
  MOD ACP LOGOUT
  START INSERT
*/
if ($action == "logout") {
  $site_sess->logout($user_info['user_id']);
  if (defined('ADMIN_SAFE_LOGIN') && ADMIN_SAFE_LOGIN == 1) {
    setcookie("adminon", "", 0, '/');
    unset($HTTP_COOKIE_VARS['adminon']);
  }
  Header("Location: ".$site_sess->url("index.php"));
  exit;
}
/*
  MOD ACP LOGOUT
  END INSERT
*/


If everything done correctly u should see logout link on top-right corner in ACP
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline aymanati

  • Full Member
  • ***
  • Posts: 214
    • View Profile
    • http://lqta.com
Re: [MOD] Logout from ACP (Admin Control Panel)
« Reply #1 on: March 12, 2005, 02:25:55 PM »
V@no ..
What about just kiiling the browser window ..
Is there any issue with that?

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Logout from ACP (Admin Control Panel)
« Reply #2 on: March 12, 2005, 06:26:28 PM »
that would work to, unless u logged in from the main page and checked the checkbox "Log me on automatically next visit?"
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

b.o.fan

  • Guest
Re: [MOD] Logout from ACP (Admin Control Panel)
« Reply #3 on: March 14, 2005, 05:11:17 PM »
that my index.php from the admin

Code: [Select]
<?php
/**************************************************************************
 *                                                                        *
 *    4images - A Web Based Image Gallery Management System               *
 *    ----------------------------------------------------------------    *
 *                                                                        *
 *             File: index.php                                            *
 *        Copyright: (C) 2002 Jan Sorgalla                                *
 *            Email: jan@4homepages.de                                    *
 *              Web: http://www.4homepages.de                             *
 *    Scriptversion: 1.7.1                                                *
 *                                                                        *
 *    Never released without support from: Nicky (http://www.nicky.net)   *
 *                                                                        *
 **************************************************************************
 *                                                                        *
 *    Dieses Script ist KEINE Freeware. Bitte lesen Sie die Lizenz-       *
 *    bedingungen (Lizenz.txt) für weitere Informationen.                 *
 *    ---------------------------------------------------------------     *
 *    This script is NOT freeware! Please read the Copyright Notice       *
 *    (Licence.txt) for further information.                              *
 *                                                                        *
 *************************************************************************/

define('IN_CP'1);
define('ROOT_PATH''./../');
require(
'admin_global.php');

if (
$redirect != "") {
  
show_admin_header("<meta http-equiv=\"Refresh\" content=\"0; URL=".$site_sess->url($redirect)."\">");
  echo 
"<p>".$lang['admin_login_redirect']."</p>";
  
show_admin_footer();
  exit;
}
if (
$action == "") {
  
$action "frames";
}

if (
$action == "frames") {
  if (
$goto != "") {
    
$framesrc $site_sess->url(urldecode($goto));
  }
  else {
    
$framesrc $site_sess->url("home.php");
  }
?>

<html dir="<?php echo $lang['direction']; ?>">
  <head>
    <title><?php echo $config['site_name']; ?> Control Panel</title>
    <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $lang['charset']; ?>">
  </head>
  <frameset rows="70,*" framespacing="0" border="0" frameborder="0" frameborder="no" border="0">
    <frame src="<?php echo $site_sess->url("index.php?action=head"); ?>" name="head" scrolling="NO" NORESIZE frameborder="0" marginwidth="0" marginheight="0" border="no">
    <frameset cols="216,*"  framespacing="0" border="0" frameborder="0" frameborder="no" border="0">
      <frame src="<?php echo $site_sess->url("index.php?action=nav"); ?>" name="nav" scrolling="auto" NORESIZE frameborder="0" marginwidth="0" marginheight="0" border="no">
      <frame src="<?php echo $framesrc ?>" name="main" scrolling="auto" NORESIZE frameborder="0" marginwidth="20" marginheight="20" border="no">
    </frameset>
  </frameset>
</html>
<?php
}

if (
$action == "head") {
?>

<html dir="<?php echo $lang['direction']; ?>">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $lang['charset']; ?>">
    <link rel="stylesheet" href="./cpstyle.css">
  </head>
  <body leftmargin="0" background="images/bg_header.gif" topmargin="0" marginwidth="0" marginheight="0" bgcolor="#FCDC43">
    <table border="0" cellpadding=0 cellspacing=0 width="100%">
      <tr>
        <td><img src="images/logo.gif"></td>
        <td align="right"></TD>
      </tr>
    </table>
    <table border="0" cellpadding=4 cellspacing=0 width="100%">
      <tr>
        <td valign=top>

        </td>
        <td align="center">
        <script language="JavaScript" type="text/javascript" src="http://www.4homepages.de/version/version.php"></script>
        <script language="JavaScript" type="text/javascript">
        <!--
        if ('<?php echo SCRIPT_VERSION?>' != latestversion) {
          document.write(latestversioninfo);
        }
        // -->
        </script>
        </td>
        <td align="right">
        <?php echo date("l d F, Y");
echo <<<END
<span id=tick2>
</span>

<script>
<!--

/*By JavaScript Kit
http://javascriptkit.com
Credit MUST stay intact for use
*/

function show2(){
if (!document.all&&!document.getElementById)
return
thelement=document.getElementById? document.getElementById("tick2"): document.all.tick2
var Digital=new Date()
var hours=Digital.getHours()
var minutes=Digital.getMinutes()
var seconds=Digital.getSeconds()
var dn="pm"
if (hours<12)
dn="am"
if (hours>12)
hours=hours-12
if (hours==0)
hours=12
if (minutes<=9)
minutes="0"+minutes
var ctime=hours+":"+minutes+""+dn
thelement.innerHTML="&nbsp;"+ctime+""
setTimeout("show2()",1000)
}
window.onload=show2
//-->
</script>
END;
?>

        </td>
      </tr>
    </table>
  </body>
</html>
<?php
}

if (
$action == "nav") {
?>

<html dir="<?php echo $lang['direction']; ?>">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=<?php echo $lang['charset']; ?>">
    <link rel="stylesheet" href="./cpstyle.css">
    <base target="main">
  </head>
  <body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
    <table width="200" height="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td colspan="2" height="1"><img src="images/spacer.gif" height="1"></td>
      </tr>
      <tr>
        <td bgcolor="#EEEEEE" width="199" height="100%" valign="top">
          <table width="199" border="0" cellpadding="0" cellspacing="0" bgcolor="#EEEEEE">
          <?php
          $root_path 
$site_sess->url(ROOT_PATH);
          
show_nav_header($lang['nav_navigation_main']);
          
show_nav_option($lang['nav_navigation_admin_index'], "home.php?action=home");
          
show_nav_option($lang['nav_navigation_site_home'], "$root_path");
          
show_nav_option($lang['nav_navigation_phpmyadmin'], "http://s170.evanzo-server.de/support/admin/mysql.php3");
          
show_nav_header($lang['nav_categories_main']);
          
show_nav_option($lang['nav_categories_edit'], "categories.php?action=modifycats");
          
show_nav_option($lang['nav_categories_add'], "categories.php?action=addcat");

          
show_nav_header($lang['nav_images_main']);
          
show_nav_option($lang['nav_images_edit'], "images.php?action=modifyimages");
          
show_nav_option($lang['nav_images_add'], "images.php?action=addimages");
          
show_nav_option($lang['nav_images_validate'], "validateimages.php?action=validateimages");
          
show_nav_option($lang['nav_images_check'], "checkimages.php?action=checkimages");
          
show_nav_option($lang['nav_images_thumbnailer'], "thumbnailer.php?action=checkthumbnails");
          
show_nav_option($lang['nav_images_resizer'], "resizer.php?action=selectoptions");
          
show_nav_header('DREAMBOARD');
          
show_nav_option('Board Manager'"board_admin.php");
          
show_nav_option('Config Board'"board_config.php");

          
show_nav_header($lang['nav_comments_main']);
          
show_nav_option($lang['nav_comments_edit'], "comments.php?action=modifycomments");

          
show_nav_header($lang['news_main']);
show_nav_option($lang['news_add'], "news.php?action=addnews");
show_nav_option($lang['modify_news'], "news.php?action=modifynews");

          
show_nav_header($lang['nav_users_main']);
          
show_nav_option($lang['nav_users_edit'], "users.php?action=modifyusers");
          if (!
defined('USER_INTEGRATION')) {
            
show_nav_option($lang['nav_users_add'], "users.php?action=addusers");
          }
          
show_nav_option($lang['nav_usergroups'], "usergroups.php?action=modifygroups");
          if (!
defined('USER_INTEGRATION')) {
            
show_nav_option($lang['nav_users_email'], "email.php?action=emailusers");
          }

          
show_nav_header($lang['nav_general_main']);
          
show_nav_option($lang['nav_general_settings'], "settings.php?action=modifysettings");
          
show_nav_option($lang['nav_general_templates'], "templates.php?action=modifytemplates");
          
show_nav_option($lang['nav_general_backup'], "backup.php?action=modifybackups");
          
show_nav_option($lang['nav_general_stats'], "stats.php?action=resetstats");

          if (@
is_dir("plugins")) {
            
show_nav_header("PlugIns");
            
$handle = @opendir("plugins/");
            while (
$file = @readdir($handle)) {
              if (
eregi("^\.{1,2}$"$file) || !eregi("\.php$"$file)) {
                continue;
              }
              
$plugin_file file("./plugins/".$file);
              
$plugin_file[0] = trim($plugin_file[0]);
              if (
preg_match("/PLUGIN_TITLE:([a-zäöüß0-9\-_ ]+)/i"$plugin_file[0], $regs)) {
                
show_nav_option(trim($regs[1]), "./plugins/".$file);
              }
              else {
                
show_nav_option($file"./plugins/".$file);
              }
            }
            @
closedir($handle);
          }
          
?>

          </table>
        </td>
        <td bgcolor="#004C75" width="1"><img src="images/spacer.gif"></td>
      </tr>
    </table>
  </body>
</html>
<?php
}
?>

where i must insert the
Code: [Select]
<!-- MOD ACP LOGOUT INSERT //-->
        <td align="right"><b><a href="<?php echo $site_sess->url("index.php?action=logout"); ?>" target="_parent"><?php echo $lang['logout']; ?></a>&nbsp;&nbsp;</b></TD>
<!-- MOD ACP LOGOUT END INSERT //-->
??

b.o.fan

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Logout from ACP (Admin Control Panel)
« Reply #4 on: March 15, 2005, 04:27:02 AM »
replace your
Code: [Select]
        <td align="right"></TD>
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline marcus_s

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: [MOD] Logout from ACP (Admin Control Panel)
« Reply #5 on: March 17, 2005, 05:31:56 PM »
hi.

i got a question on step 2: 
should i replace the code or insert it before? or after?

thanks

m

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Logout from ACP (Admin Control Panel)
« Reply #6 on: March 18, 2005, 12:08:13 AM »
hi.

i got a question on step 2: 
should i replace the code or insert it before? or after?

thanks

m
:?
Quote
Insert above:
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline marcus_s

  • Newbie
  • *
  • Posts: 33
    • View Profile
Re: [MOD] Logout from ACP (Admin Control Panel)
« Reply #7 on: March 18, 2005, 12:01:01 PM »
ok ok.  :oops:

i inserted it before (above), after and replaced it and got an error message in eache case …
thats why my question.

so i need to insert it before?
gonna try i t again.

thanks

marcus

Offline Vincent

  • 4images Moderator
  • Addicted member
  • *****
  • Posts: 1.195
    • View Profile
    • www.foto-kocher.com
Re: [MOD] Logout from ACP (Admin Control Panel)
« Reply #8 on: March 29, 2005, 12:33:35 PM »
if you logout - it would be nice to go back to the main page and not to the page to login!

sincerly
vincent
Beati pauperi spiritus

4images 1.7 // My Installed Mods


Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [MOD] Logout from ACP (Admin Control Panel)
« Reply #9 on: March 29, 2005, 08:47:42 PM »
if you logout - it would be nice to go back to the main page and not to the page to login!

sincerly
vincent
try replace
Code: [Select]
  Header("Location: ".$site_sess->url("index.php"));with:
Code: [Select]
  Header("Location: ".$site_sess->url(ROOT_PATH."index.php"));
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline Vincent

  • 4images Moderator
  • Addicted member
  • *****
  • Posts: 1.195
    • View Profile
    • www.foto-kocher.com
Re: [MOD] Logout from ACP (Admin Control Panel)
« Reply #10 on: March 30, 2005, 06:49:05 PM »
works perfect thanks V@no!

 :P
vincent
Beati pauperi spiritus

4images 1.7 // My Installed Mods


TheOracle

  • Guest
Re: [MOD] Logout from ACP (Admin Control Panel)
« Reply #11 on: July 04, 2005, 10:25:42 PM »
For people interested,

below the :

Quote

show_nav_option($lang['nav_general_stats'], "stats.php?action=resetstats");


line - this part :

Code: [Select]

show_nav_header($lang['nav_general_header_logout']);
show_nav_option($lang['nav_general_logout'], "index.php?action=logout");


Then, in your lang/english/admin.php file,

find :

Quote

$lang['nav_general_stats'] = "Reset Stats";


add the following below :

Code: [Select]

$lang['nav_general_header_logout'] = "Account status";
$lang['nav_general_logout'] = "Logout";


These additions will add a new header from the right with the ' logout ' link. From there, you'll have one logout link on the top and one logout link on the left.

Cheers.

Offline Nasser

  • Full Member
  • ***
  • Posts: 105
    • View Profile
Re: [MOD] Logout from ACP (Admin Control Panel)
« Reply #12 on: November 01, 2005, 08:23:36 PM »
its working ..
many thanks to you

Offline Bear

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
Re: [MOD] Logout from ACP (Admin Control Panel)
« Reply #13 on: November 02, 2005, 12:27:08 AM »
very useful mod, appreciated
thank you :wink:

Offline himu

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
    • Point Of View
Re: [MOD] Logout from ACP (Admin Control Panel)
« Reply #14 on: March 15, 2006, 11:09:29 AM »
Step 2.
Open admin/admin_globals.php

V@no small typo...  :wink:

I think the above should be:
Open admin/admin_global.php