?
Solved

PHPMyAdmin Customisation

Posted on 2005-03-27
10
Medium Priority
?
439 Views
Last Modified: 2012-06-21
Hi,

Ok, this hopefully will be straightforward for someone.

On the log in page for phpmyadmin, where it says username and password all I would like underneath that somewhere is to say Return To Manager and a link to the admin section on my site. I opened index.php for phpmyadmin and could not see any html in there so I don't know how they created their login box(I am not that experienced). So does anyone know how I can create a simple piece of text in there saying Return To Manager? Preferably a code example would be best, like I said I am not that experienced with PHP.

Thanks & Regards
Jon
0
Comment
Question by:jalexan123
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 2
10 Comments
 

Author Comment

by:jalexan123
ID: 13639282
Thanks Coboldinosaur,

I wasn't sure of the best place to put it.

Thanks
Jon
0
 
LVL 4

Expert Comment

by:sint4x
ID: 13639384
Can you post the index.php?

And it also depends on where it is stored. The host might not allow you to modify because they could use it for many different clients.

But if you can find the index.php and post some sample code, then I'd be glad to help.
0
 

Author Comment

by:jalexan123
ID: 13639428
Hi,

I will post the index.php file for phpmyadmin, don't worry about the host, it is my dedicated server.

<?php
/* $Id: index.php,v 2.14 2004/10/19 17:23:09 nijel Exp $ */
// vim: expandtab sw=4 ts=4 sts=4:

/**
 * Gets core libraries and defines some variables
 */
require_once('./libraries/grab_globals.lib.php');
require_once('./libraries/common.lib.php');
/**
 * Includes the ThemeManager if it hasn't been included yet
 */
require_once('./libraries/select_theme.lib.php');

/**
 * Saves collation_connection (coming from main.php) in a cookie
 */

// (from grab_globals)
if (isset($collation_connection)) {
    if (!isset($pma_uri_parts)) {
        $pma_uri_parts = parse_url($cfg['PmaAbsoluteUri']);
        $cookie_path   = substr($pma_uri_parts['path'], 0, strrpos($pma_uri_parts['path'], '/'));
        $is_https      = (isset($pma_uri_parts['scheme']) && $pma_uri_parts['scheme'] == 'https') ? 1 : 0;
    }
    setcookie('pma_collation_connection', $collation_connection, time() + 60*60*24*30, $cookie_path, '', $is_https);
}
// Gets the default font sizes
PMA_setFontSizes();

// Gets the host name
// loic1 - 2001/25/11: use the new globals arrays defined with php 4.1+
if (empty($HTTP_HOST)) {
    if (!empty($_ENV) && isset($_ENV['HTTP_HOST'])) {
        $HTTP_HOST = $_ENV['HTTP_HOST'];
    }
    else if (@getenv('HTTP_HOST')) {
        $HTTP_HOST = getenv('HTTP_HOST');
    }
    else {
        $HTTP_HOST = '';
    }
}
/**
 * Defines the frameset
 */
// loic1: If left light mode -> urldecode the db name
if (isset($lightm_db)) {
// no longer urlencoded because of html entities in the db name
//    $db    = urldecode($lightm_db);
    $db    = $lightm_db;
    unset($lightm_db);
}
$url_query = PMA_generate_common_url(isset($db) ? $db : '');
header('Content-Type: text/html; charset=' . $GLOBALS['charset']);

require_once('./libraries/relation.lib.php');
$cfgRelation = PMA_getRelationsParam();

if ($cfg['QueryHistoryDB'] && $cfgRelation['historywork']) {
    PMA_purgeHistory($cfg['Server']['user']);
}

$phpmain_hash = md5($cfg['PmaAbsoluteUri']);
$phpmain_hash_js = time();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $available_languages[$lang][2]; ?>" lang="<?php echo $available_languages[$lang][2]; ?>" dir="<?php echo $text_dir; ?>">
<head>
<title>phpMyAdmin <?php echo PMA_VERSION; ?> - <?php echo $HTTP_HOST; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo $charset; ?>" />
<link rel="stylesheet" type="text/css" href="./css/phpmyadmin.css.php?lang=<?php echo $lang; ?>&amp;js_frame=right" />
</head>

<?php
$logo_image = $GLOBALS['pmaThemeImage'] . 'logo_left.png';
$query_frame_height = 0;
if ($cfg['LeftDisplayLogo'] && @file_exists($logo_image)) {
    $tmp_imgsize = @getimagesize($logo_image);
    $query_frame_height = ($tmp_imgsize[1] + 60);
    // increase the height to take into account font size differences in
    // theme 'original'? (TODO: improve with a parameter in layout.inc.php)
    $query_frame_height += ((!isset($GLOBALS['theme']) || $GLOBALS['theme']=='original') ? 25 : 0);
}
if ($query_frame_height == 0) {
    $query_frame_height = 60;
}
// increase the height to take into account font size differences in
// theme 'original'? (TODO: improve with a parameter in layout.inc.php)
$query_frame_height += ((!isset($GLOBALS['theme']) || $GLOBALS['theme']=='original') ? 20 : 10);

if ($cfg['LeftDisplayServers'] && !$cfg['DisplayServersList']) {
    $query_frame_height += 40;
}
if ($server > 0) {
    PMA_availableDatabases(); // this function is defined in "common.lib.php"
} else {
    $num_dbs = 0;
}
if ($num_dbs > 1) {
    if ($cfg['LeftFrameLight']) {
        $query_frame_height += 20;
    }
}
if ($cfg['QueryFrame']) {
    /* Will we show list of servers? */
    if ($cfg['LeftDisplayServers'] && $cfg['DisplayServersList'] && count($cfg['Servers']) > 1) {
        $query_frame_height += (count($cfg['Servers']) + 1)*15;
    }

    if ($cfg['QueryFrameJS']) {
        echo '<script type="text/javascript">' . "\n";
        echo '<!--' . "\n";
        echo '    document.writeln(\'<frameset cols="' . $cfg['LeftWidth'] . ',*" rows="*" border="1" frameborder="1" framespacing="1" name="mainFrameset" id="mainFrameset">\');' . "\n";
        echo '    document.writeln(\'    <frameset rows="' . $query_frame_height . ', *" framespacing="0" frameborder="0" border="0" name="leftFrameset" id="leftFrameset">\');' . "\n";
        echo '    document.writeln(\'        <frame src="queryframe.php?' . $url_query . '&amp;hash=' . $phpmain_hash . $phpmain_hash_js . '" name="queryframe" frameborder="0" scrolling="no" id="leftQueryframe" />\');' . "\n";
        echo '    document.writeln(\'        <frame src="left.php?' . $url_query . '&amp;hash=' . $phpmain_hash . $phpmain_hash_js . '" name="nav" frameborder="0" id="leftFrame" />\');' . "\n";
        echo '    document.writeln(\'    </frameset>\');' . "\n";
        echo '    document.writeln(\'    <frame src="' . (empty($db) ? $cfg['DefaultTabServer']  : $cfg['DefaultTabDatabase']) . '?' . $url_query . '" name="phpmain' . $phpmain_hash . $phpmain_hash_js . '" border="0" frameborder="0" style="border-left: 1px solid #000000;" id="rightFrame" />\');' . "\n";
        echo '    document.writeln(\'    <noframes>\');' . "\n";
        echo '    document.writeln(\'        <body bgcolor="#FFFFFF">\');' . "\n";
        echo '    document.writeln(\'            <p>' . str_replace("'", "\'", $strNoFrames) . '</p>\');' . "\n";
        echo '    document.writeln(\'        </body>\');' . "\n";
        echo '    document.writeln(\'    </noframes>\');' . "\n";
        echo '    document.writeln(\'</frameset>\');' . "\n";
        echo '//-->' . "\n";
        echo '</script>' . "\n";
        echo "\n";
        echo '<noscript>' . "\n";
    }

    echo '<frameset cols="' . $cfg['LeftWidth'] . ',*" rows="*"  border="1" frameborder="1" framespacing="1" name="mainFrameset" id="mainFrameset">' . "\n";
    echo '    <frameset rows="' . $query_frame_height . ', *" framespacing="0" frameborder="0" border="0" name="leftFrameset" id="leftFrameset">' . "\n";
    echo '        <frame src="queryframe.php?' . $url_query . '&amp;hash=' . $phpmain_hash . '" name="queryframe" frameborder="0" scrolling="no" id="leftQueryframe" />' . "\n";
    echo '        <frame src="left.php?' . $url_query . '&amp;hash=' . $phpmain_hash . '" name="nav" frameborder="0" id="leftFrame" />' . "\n";
    echo '    </frameset>' . "\n";
    echo '    <frame src="' . (empty($db) ? $cfg['DefaultTabServer']  : $cfg['DefaultTabDatabase']) . '?' . $url_query . '" name="phpmain' . $phpmain_hash . '" frameborder="0" id="rightFrame" />' . "\n";

} else {

    echo '<frameset cols="' . $cfg['LeftWidth'] . ',*" rows="*" border="1" frameborder="1" framespacing="1" id="leftFrameset" >' . "\n";
    echo '    <frame src="left.php?' . $url_query . '&amp;hash=' . $phpmain_hash . '" name="nav" frameborder="0" id="leftFrame" />' . "\n";
    echo '    <frame src="' . (empty($db) ? $cfg['DefaultTabServer']  : $cfg['DefaultTabDatabase']) . '?' . $url_query . '" name="phpmain' . $phpmain_hash . '" id="rightFrame" frameborder="1" />' . "\n";

}
?>

    <noframes>
        <body bgcolor="#FFFFFF">
            <p><?php echo $strNoFrames; ?></p>
        </body>
    </noframes>
</frameset>
<?php
if ($cfg['QueryFrame'] && $cfg['QueryFrameJS']) {
    echo '</noscript>' . "\n";
}
?>

</html>

I hope that helps though if you view it in Dreamweave it just shows the php symbol and nothing else, so I don't know if they are pulling in code from external sources.

All I want is a bit on the index page that says Back To Manager. Basically it is because I access phpmyadmin through the admin manager section on my site and it gives me a way back.

Thanks
Jon
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 4

Expert Comment

by:sint4x
ID: 13639821
Do u want this to be accessable for every page (the Back To.. Link) or just on the login.

If on everypage; then i suggest you add it to the queryframe.php page, so throw up the code from that page, and I will help ya out.
0
 

Author Comment

by:jalexan123
ID: 13639874
Hi,

Thanks for the help. I only really need it on the login screen, as I will use the logout function already in phpmyadmin, which then takes you back to the login screen anyway.

Thank you

Jon
0
 

Author Comment

by:jalexan123
ID: 13640427
Hi Again,

All I need to do really is add a Back To Manager link in that index file but I wouldn't know where to put it!! :(

Thanks
Jon
0
 
LVL 6

Accepted Solution

by:
neorush earned 2000 total points
ID: 13641816
The file you need to edit is:
phpMyAdminRoot/libraries/auth/cookie.auth.lib.php
the username password form is echoed in this file mine was on about line 340 its quicker just to look for the text 'pma_username' (no qoutes)
it should look something like this:

  .......<tr>
        <td align="right" bgcolor="<?php echo $GLOBALS['cfg']['BgcolorOne']; ?>"><b><?php echo $GLOBALS['strLogUsername']; ?>&nbsp;</b></td>
        <td align="<?php echo $cell_align; ?>" bgcolor="<?php echo $GLOBALS['cfg']['BgcolorOne']; ?>">
            <input type="text" name="pma_username" value="<?php echo (isset($default_user) ? $default_user : ''); ?>" size="24" class="textfield" onfocus="this.select()" />
        </td>
    </tr>
    <tr>
        <td align="right" bgcolor="<?php echo $GLOBALS['cfg']['BgcolorOne']; ?>"><b><?php echo $GLOBALS['strLogPassword']; ?>&nbsp;</b></td>
        <td align="<?php echo $cell_align; ?>" bgcolor="<?php echo $GLOBALS['cfg']['BgcolorOne']; ?>">
            <input type="password" name="pma_password" value="" size="24" class="textfield" onfocus="this.select()" />
        </td>
    </tr>
..then you can just add in yours...
    <tr>
       <td colspan="2">
            <center><a href="http://www.example.com">Return To Manager</a></center>
        </td>
    </tr>
...then on with the rest of the doc...

    <?php
    if (count($cfg['Servers']) > 1) {
        echo "\n";
        ?>
    <tr>
        <td align="right" bgcolor="<?php echo $GLOBALS['cfg']['BgcolorOne']; ?>"><b><?php echo $GLOBALS['strServerChoice']; ?>:&nbsp;</b></td>......

hope this helps...
       
0
 

Author Comment

by:jalexan123
ID: 13642110
Hi,

That is fantastic, I am travelling home today after being away for Easter and I will try that as soon as I get in.

Many thanks for your assistance.

Jon
0
 

Author Comment

by:jalexan123
ID: 13646459
Thanks Neorush, that worked perfectly!!!!


Regards
Jon
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
The viewer will learn how to dynamically set the form action using jQuery.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question