(Andreas09) Login box in menu (Andreas09) Login box in menu
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

(Andreas09) Login box in menu

Started by Schryvers, November 14, 2012, 09:05:27 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Schryvers

Is it possible without huge scripten to take the login boxxes (email box password box and submit button) into template.html and login from the left menu in andreas09?

schryvers.nl < link (just like the little email form on the menu wich i included with an iframe, i know the login box can't include with an iframe but how do i get it anyway out the login page?

thanks alot

Schryvers

For so far this one:

http://forum.coppermine-gallery.net/index.php/topic,37311.0.html

works for me.

Just adjust the code for 1.5.x

$template_vars = array('{LANG_DIR}' => $lang_text_dir,
        '{TITLE}' => $CONFIG['gallery_name'] . ' - ' . strip_tags(bb_decode($section)),
        '{CHARSET}' => $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset'],
        '{META}' => $meta,
        '{GAL_NAME}' => $CONFIG['gallery_name'],
        '{GAL_DESCRIPTION}' => $CONFIG['gallery_description'],
        '{SYS_MENU}' => theme_main_menu('sys_menu'),
        '{SUB_MENU}' => theme_main_menu('sub_menu'),
        '{ADMIN_MENU}' => theme_admin_mode_menu(),
        '{CUSTOM_HEADER}' => $custom_header,
'{CUSTOM_LOGINBOX}'  => $custom_login_box, // Mod for Custom login box + statistics
        );

    echo template_eval($template_header, $template_vars);
}


into

$template_vars = array('{LANG_DIR}' => $lang_text_dir,
        '{TITLE}' => $CONFIG['gallery_name'] . ' - ' . strip_tags(bb_decode($section)),
        '{CHARSET}' => $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset'],
        '{META}' => $meta,
        '{GAL_NAME}' => $CONFIG['gallery_name'],
        '{GAL_DESCRIPTION}' => $CONFIG['gallery_description'],
        '{MESSAGE_BLOCK}' => $CONFIG['message_block'],
        '{JAVASCRIPT}' => $CONFIG['javascript'],
        '{SYS_MENU}' => theme_main_menu('sys_menu'),
        '{SUB_MENU}' => theme_main_menu('sub_menu'),
        '{ADMIN_MENU}' => theme_admin_mode_menu(),
        '{CUSTOM_HEADER}' => $custom_header,
'{CUSTOM_LOGINBOX}'  => $custom_login_box, // Mod for Custom login box + statistics
        );

    echo template_eval($template_header, $template_vars);
}


i only added:

        '{MESSAGE_BLOCK}' => $CONFIG['message_block'],
        '{JAVASCRIPT}' => $CONFIG['javascript'],



Thanks! looks clean nice and simple.

Only when i want a image as button it doesn't word anymore.. searching for a solution.

Schryvers

Paste this into your theme.php:
// ------------------------------------------------------------------------- //
// BEGIN Mod for Custom login box + statistics                                          //
// ------------------------------------------------------------------------- //
  $query = "SELECT COUNT(OWNER_ID) FROM {$CONFIG['TABLE_PICTURES']} WHERE owner_id = ".USER_ID;
$result = mysql_query($query);
$total_upload = mysql_fetch_assoc($result);
mysql_free_result($result);
 
$query = "SELECT COUNT(author_id) FROM {$CONFIG['TABLE_COMMENTS']} WHERE author_id = ".USER_ID;
$result = mysql_query($query);
$total_comments = mysql_fetch_assoc($result);
mysql_free_result($result);

$query = "SELECT user_regdate FROM {$CONFIG['TABLE_USERS']} WHERE user_id = ".USER_ID;
$result = mysql_query($query);
$regdate = mysql_fetch_assoc($result);
mysql_free_result($result);

$custom_login_box = <<<EOT
<div style="float:right; width:290px; border:1px #CCCCCC solid;" align="left">
<form action="login.php?referer=index.php" method="post" name="loginbox" style="margin:0px;">
<div class="tableh1">Enter your username and password to login</div>
<div style="padding-top:2px;">
<div style="width:100px;float:left;padding-left:10px;">Username</div>
<div><input type="text" class="textinput" name="username" style="width:150px;height:13px;" tabindex="1" /></div>
</div>
<div style="padding-top:2px;">
<div style="width:100px;float:left;padding-left:10px;">Password</div>
<div><input type="password" class="textinput" name="password" style="width: 150px;height:13px;" tabindex="2" /></div>
<div style="">
<div style="float:right; padding-top:2px; padding-right:22px;"><input name="submitted" type="submit" class="button" value="Login" tabindex="4" /></div>
</div>
</div>
<div>
<div style="width:100px;float:left;padding-left:10px;height:13px;"></div><div style="float:left;height:13px;">Remembr Me</div>
<div><input name="remember_me" type="checkbox" value="1" tabindex="3" style="height:13px;width:13px;"/></div>
</div>
<div>
<div style="font-size:9px;padding-left:10px;float:left; width:200px;"><a href="forgot_passwd.php">I forgot my password</a></div>
</div>
</form>
</div>
EOT;
// ------------------------------------------------------------------------- //
// End Mod for Custom login box + statistics                                            //
// ------------------------------------------------------------------------- //

function pageheader($section, $meta = '')
{
    global $CONFIG, $THEME_DIR;
    global $template_header, $lang_charset, $lang_text_dir, $custom_login_box;
global $total_upload, $total_comments, $regdate; // Mod for Custom statistics

    $custom_header = cpg_get_custom_include($CONFIG['custom_header_path']);

    header('P3P: CP="CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT DEM PRE"');
    user_save_profile();
// ------------------------------------------------------------------------- //
// BEGIN Mod for Custom login box + statistics                                         //
// ------------------------------------------------------------------------- //
$custom_username = stripslashes(USER_NAME);
if(USER_ID)
$custom_login_box = <<<EOT
<div style="float:right; width:290px; border:1px #CCCCCC solid;" align="left">
              <div class="tableh1"> Welcome <strong>{$custom_username}</strong> !</div>
  <div style="padding-left:10px; height:15px; margin-top:2px;">Joined at : <span style="color:#993366;">{$regdate['user_regdate']}</span>
  </div>
  <div style="padding-left:10px; height:15px; margin-top:2px;">Total uploaded file by you : <span style="color:#993366;">{$total_upload['COUNT(OWNER_ID)']}</span>
  </div>
  <div style="padding-left:10px; height:15px; margin-top:2px;">Total comment by you : <span style="color:#993366;">{$total_comments['COUNT(author_id)']}</span>
  </div>
  <div style="padding-left:10px; height:15px; margin-top:3px; margin-bottom:2px;"><a href="logout.php?referer=index.php" title="Logout {$custom_username}">Log Out</a>
  </div>
          </div>
EOT;
// ------------------------------------------------------------------------- //
// End Mod for Custom login box + statistics                                            //
// ------------------------------------------------------------------------- //
$template_vars = array('{LANG_DIR}' => $lang_text_dir,
        '{TITLE}' => $CONFIG['gallery_name'] . ' - ' . strip_tags(bb_decode($section)),
        '{CHARSET}' => $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset'],
        '{META}' => $meta,
        '{GAL_NAME}' => $CONFIG['gallery_name'],
        '{GAL_DESCRIPTION}' => $CONFIG['gallery_description'],
        '{MESSAGE_BLOCK}' => $CONFIG['message_block'],
        '{JAVASCRIPT}' => $CONFIG['javascript'],
        '{SYS_MENU}' => theme_main_menu('sys_menu'),
        '{SUB_MENU}' => theme_main_menu('sub_menu'),
        '{ADMIN_MENU}' => theme_admin_mode_menu(),
        '{CUSTOM_HEADER}' => $custom_header,
'{CUSTOM_LOGINBOX}'  => $custom_login_box, // Mod for Custom login box + statistics
        );

    echo template_eval($template_header, $template_vars);
}


And add {CUSTOM_LOGINBOX} Wherever u want into your theme's Template.html

Enjoy.

SOLVED

Schryvers

Only what i add to them just solve the errors, but javascript doesnt work anymore then and the site message also not.

Schryvers

SOLVED

CODE for CUSTOM LOGINBOX:

Okay if you want a CUSTOM login box on your template.html for 1.5.x

ADD THESE TO YOUR YOURTHEME/THEME.php
// BEGIN Mod for Custom login box + statistics                                          //
// ------------------------------------------------------------------------- //
  $query = "SELECT COUNT(OWNER_ID) FROM {$CONFIG['TABLE_PICTURES']} WHERE owner_id = ".USER_ID;
$result = mysql_query($query);
$total_upload = mysql_fetch_assoc($result);
mysql_free_result($result);
 
$query = "SELECT COUNT(author_id) FROM {$CONFIG['TABLE_COMMENTS']} WHERE author_id = ".USER_ID;
$result = mysql_query($query);
$total_comments = mysql_fetch_assoc($result);
mysql_free_result($result);

$query = "SELECT user_regdate FROM {$CONFIG['TABLE_USERS']} WHERE user_id = ".USER_ID;
$result = mysql_query($query);
$regdate = mysql_fetch_assoc($result);
mysql_free_result($result);

$custom_login_box = <<<EOT
<form action="login.php?referer=index.php" method="post" name="loginbox" style="margin:0px;">
      <P STYLE="font-size: 8pt;"><b><font color="ab3921" face="Verdana">Gebruikersnaam:</font></b><br>
      <input type="text" class="textinput" size=17 name="username" tabindex="1" style="font-family: Verdana; font-size: 10px; color: #000000" /><br>
<font face="Verdana">&nbsp;</font><br>
<font face="Verdana" color="ab3921"><span style="font-size: 8pt; font-weight: 700">Wachtwoord:</span></font><br>
      <input type="password" class="textinput" maxlength=16 size=17 name="password" tabindex="2" style="font-family: Verdana; font-size: 10px; color: #000000" />
<br>
<input name="remember_me" type="checkbox" value="1" tabindex="3" style="height:13px;width:13px;"/>
<font face="Verdana" size="1">Onthoud mij!</font><br>
<input name="submitted" type="submit" class="button" value="login" tabindex="4">
</form>
EOT;
// ------------------------------------------------------------------------- //
// End Mod for Custom login box + statistics                                            //
// ------------------------------------------------------------------------- //

function pageheader($section, $meta = '')
{
    global $CONFIG, $THEME_DIR;
    global $template_header, $lang_charset, $lang_text_dir, $custom_login_box;
global $total_upload, $total_comments, $regdate; // Mod for Custom statistics

    $custom_header = cpg_get_custom_include($CONFIG['custom_header_path']);

    header('P3P: CP="CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT DEM PRE"');
    user_save_profile();
// ------------------------------------------------------------------------- //
// BEGIN Mod for Custom login box + statistics                                         //
// ------------------------------------------------------------------------- //
$custom_username = stripslashes(USER_NAME);
if(USER_ID)
$custom_login_box = <<<EOT
<b><font size="8pt" face="Verdana" color="#000000"><span style="font-size: 8pt">Welkom</span></font></b> <font face="Verdana" color="#ab3921"><b><span style="font-size: 8pt">{$custom_username}</span></b> !<br>
</font><br>
<b><font face="verdana" size="1">Geregistreerd:</font></b><br><font face="verdana" size="1"> {$regdate['user_regdate']}</font><br><br>
<font face="Verdana">
<b><font face="verdana" size="1">Reacties gegeven:</font></b><br><font face="verdana" size="1"> {$total_comments['COUNT(author_id)']}</font></font>
EOT;
// ------------------------------------------------------------------------- //
// End Mod for Custom login box + statistics                                            //
// ------------------------------------------------------------------------- //

$template_vars = array('{LANG_DIR}' => $lang_text_dir,
        '{TITLE}' => $CONFIG['gallery_name'] . ' - ' . strip_tags(bb_decode($section)),
        '{CHARSET}' => $CONFIG['charset'] == 'language file' ? $lang_charset : $CONFIG['charset'],
        '{META}' => $meta,
        '{GAL_NAME}' => $CONFIG['gallery_name'],
        '{GAL_DESCRIPTION}' => $CONFIG['gallery_description'],
        '{SYS_MENU}' => theme_main_menu('sys_menu'),
        '{SUB_MENU}' => theme_main_menu('sub_menu'),
        '{ADMIN_MENU}' => theme_admin_mode_menu(),
        '{CUSTOM_HEADER}' => $custom_header,
        '{JAVASCRIPT}' => theme_javascript_head(),
        '{MESSAGE_BLOCK}' => theme_display_message_block(),
'{CUSTOM_LOGINBOX}'  => $custom_login_box, // Mod for Custom login box + statistics
        );

    echo template_eval($template_header, $template_vars);
}
/******************************************************************************
** Section <<<theme_html_picture>>> - END
******************************************************************************/
/******************************************************************************
** Section <<<theme_display_album_list_cat>>> - START
******************************************************************************/
// Function to display first level Albums of a category
function theme_display_album_list_cat(&$alb_list, $nbAlb, $cat, $page, $total_pages)
{
    global $CONFIG, $STATS_IN_ALB_LIST, $statistics, $template_tab_display, $template_album_list_cat, $lang_album_list;
    if (!$CONFIG['first_level']) {
        return;
    }

    $theme_alb_list_tab_tmpl = $template_tab_display;

    $theme_alb_list_tab_tmpl['left_text'] = strtr($theme_alb_list_tab_tmpl['left_text'], array('{LEFT_TEXT}' => $lang_album_list['album_on_page']));
    $theme_alb_list_tab_tmpl['page_link'] = strtr($theme_alb_list_tab_tmpl['page_link'], array('{LINK}' => 'index.php?cat=' . $cat . '&amp;page=%d'));

    $tabs = create_tabs($nbAlb, $page, $total_pages, $theme_alb_list_tab_tmpl);
    // echo $template_album_list_cat;
    $template_album_list_cat1 = $template_album_list_cat;
    $album_cell = template_extract_block($template_album_list_cat1, 'c_album_cell');
    $empty_cell = template_extract_block($template_album_list_cat1, 'c_empty_cell');
    $tabs_row = template_extract_block($template_album_list_cat1, 'c_tabs');
    $stat_row = template_extract_block($template_album_list_cat1, 'c_stat_row');
    $spacer = template_extract_block($template_album_list_cat1, 'c_spacer');
    $header = template_extract_block($template_album_list_cat1, 'c_header');
    $footer = template_extract_block($template_album_list_cat1, 'c_footer');
    $rows_separator = template_extract_block($template_album_list_cat1, 'c_row_separator');

    $count = 0;

    $columns = $CONFIG['album_list_cols'];
    $column_width = ceil(100 / $columns);
    $thumb_cell_width = $CONFIG['alb_list_thumb_size'] + 2;

    starttable('99%'); // '100%' destroys the layout if $CONFIG['main_table_width'] is a pixel value

    if ($STATS_IN_ALB_LIST) {
        $params = array('{STATISTICS}' => $statistics,
            '{COLUMNS}' => $columns,
            );
        echo template_eval($stat_row, $params);

    }
    echo $header;

    if (is_array($alb_list)) {
        foreach($alb_list as $album) {
            $count ++;

            $params = array('{COL_WIDTH}' => $column_width,
                '{ALBUM_TITLE}' => $album['album_title'],
                '{THUMB_CELL_WIDTH}' => $thumb_cell_width,
                '{ALB_LINK_TGT}' => "thumbnails.php?album={$album['aid']}",
                '{ALB_LINK_PIC}' => $album['thumb_pic'],
                '{ADMIN_MENU}' => $album['album_adm_menu'],
                '{ALB_DESC}' => $album['album_desc'],
                '{ALB_INFOS}' => '',
                '{ALB_HITS}' => $album['alb_hits'],
                );

            echo template_eval($album_cell, $params);

            if ($count % $columns == 0 && $count < count($alb_list)) {
                echo $rows_separator;
            }
        }
    }

    $params = array('{COL_WIDTH}' => $column_width,
          '{SPACER}' => $thumb_cell_width
          );
    $empty_cell = template_eval($empty_cell, $params);

    while ($count++ % $columns != 0) {
        echo $empty_cell;
    }

    echo $footer;
    // Tab display
    $params = array('{COLUMNS}' => $columns,
        '{TABS}' => $tabs,
        );
    echo template_eval($tabs_row, $params);

    endtable();

    echo $spacer;
}



AND ADD THIS WHEREVER YOU WANT THE LOGINBOX SHOULD COME
{CUSTOM_LOGINBOX}


I think alot of people like this one. Its workin 100%

Schryvers

Pictures: