Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6854159
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:35:57+00:00 2026-05-27T01:35:57+00:00

I’m trying to edit login.php for sqlbuddy and not having any luck. I want

  • 0

I’m trying to edit login.php for sqlbuddy and not having any luck. I want to change the default host and user name that it prefills the login page with. I’ve tried changing these lines but the page doesn’t change. 🙁 Can someone give me a hint or 3?

$host = (isset($sbconfig['DefaultHost'])) ? $sbconfig['DefaultHost'] : "localhost";
$user = (isset($sbconfig['DefaultUser'])) ? $sbconfig['DefaultUser'] : "root";
$pass = (isset($sbconfig['DefaultPass'])) ? $sbconfig['DefaultPass'] : "";  

full file:

<?php
/*

SQL Buddy - Web based MySQL administration
http://www.sqlbuddy.com/

login.php
- login to sql buddy

MIT license

2008 Calvin Lough <http://calv.in>

*/

include "functions.php";

$adapter = (isset($sbconfig['DefaultAdapter'])) ? $sbconfig['DefaultAdapter'] : "mysql";
$host = (isset($sbconfig['DefaultHost'])) ? $sbconfig['DefaultHost'] : "localhost";
$user = (isset($sbconfig['DefaultUser'])) ? $sbconfig['DefaultUser'] : "root";
$pass = (isset($sbconfig['DefaultPass'])) ? $sbconfig['DefaultPass'] : "";  

// SQLite only
$database = (isset($sbconfig['DefaultDatabase'])) ? $sbconfig['DefaultDatabase'] : "";  

if ($_POST) {
    if (isset($_POST['ADAPTER']))
        $adapter = $_POST['ADAPTER'];

    if (isset($_POST['HOST']))
        $host = $_POST['HOST'];

    if (isset($_POST['USER']))
        $user = $_POST['USER'];

    if (isset($_POST['PASS']))
        $pass = $_POST['PASS'];

    if (isset($_POST['DATABASE']))
        $database = $_POST['DATABASE'];
}

if (!in_array($adapter, $adapterList)) {
    $adapter = "mysql";
}

if (($adapter != "sqlite" && $host && $user && ($pass || $_POST)) || ($adapter == "sqlite" && $database)) {

    if ($adapter == "sqlite") {
        $connString = "sqlite:database=$database";
        $connCheck = new SQL($connString);
        $user = "";
        $pass = "";
    } else {
        $connString = "$adapter:host=$host";
        $connCheck = new SQL($connString, $user, $pass);
    }

    if ($connCheck->isConnected()) {
        $_SESSION['SB_LOGIN'] = true;
        $_SESSION['SB_LOGIN_STRING'] = $connString;
        $_SESSION['SB_LOGIN_USER'] = $user;
        $_SESSION['SB_LOGIN_PASS'] = $pass;

        $path = $_SERVER["SCRIPT_NAME"];
        $pathSplit = explode("/", $path);

        $redirect = "";

        for ($i=0; $i<count($pathSplit)-1; $i++) {
            if (trim($pathSplit[$i]) != "")
                $redirect .= "/" . $pathSplit[$i];
        }

        if (array_key_exists("HTTPS", $_SERVER) && $_SERVER['HTTPS'] == "on") {
            $protocol = "https://";
        } else {
            $protocol = "http://";
        }

        $redirect = $protocol . $_SERVER["HTTP_HOST"] . $redirect . "/";

        redirect($redirect);
        exit;
    } else {
        $error = __("There was a problem logging you in.");
    }
}

startOutput();

?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/REC-html40/strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" version="-//W3C//DTD XHTML 1.1//EN" xml:lang="en">
    <head>
        <title>SQL Buddy</title>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <link type="text/css" rel="stylesheet" href="<?php echo smartCaching("css/common.css"); ?>" />
        <link type="text/css" rel="stylesheet" href="<?php echo smartCaching("css/navigation.css"); ?>" />
        <link type="text/css" rel="stylesheet" href="<?php echo smartCaching("css/print.css"); ?>" media="print" />
        <link type="text/css" rel="stylesheet" href="<?php echo themeFile("css/main.css"); ?>" />
        <!--[if lte IE 7]>
            <link type="text/css" rel="stylesheet" href="<?php echo themeFile("css/ie.css"); ?>" />
        <![endif]-->
        <script type="text/javascript" src="<?php echo smartCaching("js/mootools-1.2-core.js"); ?>"></script>
        <script type="text/javascript" src="<?php echo smartCaching("js/helpers.js"); ?>"></script>
        <script type="text/javascript" src="<?php echo smartCaching("js/movement.js"); ?>"></script>
    </head>
    <body style="background: none">
    <div id="container">
    <div id="loginform">
        <form name="loginform" method="post">
        <div class="loginspacer">
        <?php

        // make sure they aren't using IE below version 7

        $ua = $_SERVER['HTTP_USER_AGENT'];

        $ie = strstr($ua, 'MSIE') ? true : false;
        $ieVer = $ie ? preg_split('/msie/i', $ua) : false;
        $ieVer = $ieVer ? floatval($ieVer[1]) : false;

        // turn into whole number
        $ieVer = (int)($ieVer);

        if ($ua && $ie && $ieVer < 7) {

            ?>
            <table cellpadding="0" id="tb">
            <tr>
            <td class="loginheader"><h3><?php echo __("Unsupported browser"); ?></h3><a href="http://www.sqlbuddy.com/help/" title="Help"><?php echo __("Help!"); ?></a></td>
            </tr>
            <tr>
            <td><?php echo __("We're sorry, but currently only Internet Explorer 7 is supported. It is available as a free download on Microsoft's website. Other free browsers are also supported, including Firefox, Safari, and Opera."); ?></td>
            </tr>
            </table>
            <?php

        } else {

            ?>
            <table cellpadding="0" id="tb">
            <tr>
            <td colspan="2"><div class="loginheader"><h3><strong><?php echo __("Login"); ?></strong></h3><a href="http://www.sqlbuddy.com/help/" title="Help"><?php echo __("Help!"); ?></a></div></td>
            </tr>
            <?php
            if (isset($error)) {
                echo '<tr><td colspan="2"><div class="errormess">' . $error . '</div></td></tr>';
            }
            if (isset($_GET['timeout'])) {
                echo '<tr><td colspan="2"><div class="errormess">' . __("Your session has timed out. Please login again.") . '</div></td></tr>';
            }

            if (sizeof($adapterList) > 1) {

            ?>
            <tr>
            <td class="field"></td>
            <td>
            <select name="ADAPTER" id="ADAPTER" onchange="adapterChange()">
            <?php

            if (in_array("mysql", $adapterList)) {
                ?>
                <option value="mysql"<?php if ($adapter == "mysql") echo " selected"; ?>><?php echo __("MySQL"); ?></option>
                <?php
            }

            if (in_array("sqlite", $adapterList)) {
                ?>
                <option value="sqlite"<?php if ($adapter == "sqlite") echo " selected"; ?>><?php echo __("SQLite"); ?></option>
                <?php
            }

            ?>
            </select>
            </td>
            </tr>
            <?php

            }

            ?>
            </table>
            <table cellpadding="0" id="REGOPTIONS"<?php if ($adapter == "sqlite") echo ' style="display: none"'; ?>>
            <tr>
            <td class="field"><?php echo __("Host"); ?>:</td>
            <td><input type="text" class="text" name="HOST" value="<?php echo $host; ?>" /></td>
            </tr>
            <tr>
            <td class="field"><?php echo __("Username"); ?>:</td>
            <td><input type="text" class="text" name="USER" value="<?php echo $user; ?>" /></td>
            </tr>
            <tr>
            <td class="field"><?php echo __("Password"); ?>:</td>
            <td><input type="password" class="text" name="PASS" id="PASS" /></td>
            </tr>
            </table>
            <table cellpadding="0" id="LITEOPTIONS"<?php if ($adapter == "mysql") echo ' style="display: none"'; ?>>
            <tr>
            <td class="field"><?php echo __("Database"); ?>:</td>
            <td><input type="text" class="text" name="DATABASE" id="DATABASE" value="<?php echo $database; ?>" /></td>
            </tr>
            </table>
            <table cellpadding="0">
            <tr>
            <td class="field"></td>
            <td><input type="submit" class="inputbutton" value="<?php echo __("Submit"); ?>" /></td>
            </tr>
            </table>
            <?php

        }

        ?>
        </div>
        </form>
    </div>
    </div>
    <script type="text/javascript">
    <!--

    <?php

    if ($adapter != "sqlite") {
        echo "$('PASS').focus();";
    } else {
        echo "$('DATABASE').focus();";
    }

    ?>

    if (!navigator.cookieEnabled) {
        var tb = $('tb');
        var newTr = new Element('tr');
        var newTd = new Element('td');
        newTd.setAttribute("colspan", 2);
        var newDiv = new Element('div');
        newDiv.className = "errormess";
        newDiv.set('text', "<?php echo __("You don't appear to have cookies enabled. For sessions to work, most php installations require cookies."); ?>");
        newTd.appendChild(newDiv);
        newTr.appendChild(newTd);
        tb.appendChild(newTr);
    }

    function adapterChange() {
        var adapter = $('ADAPTER');
        var currentAdapter = adapter.options[adapter.selectedIndex].value;

        if (currentAdapter == "sqlite") {
            $('REGOPTIONS').style.display = 'none';
            $('LITEOPTIONS').style.display = '';
            $('DATABASE').focus();
        } else {
            $('REGOPTIONS').style.display = '';
            $('LITEOPTIONS').style.display = 'none';
            $('PASS').focus();
        }

    }

    // -->
    </script>
</body>
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T01:35:58+00:00Added an answer on May 27, 2026 at 1:35 am

    Have you tried changing the config array?

    $sbconfig[‘DefaultHost’]

    if that exists then it will use that (im guessing you know how ternary statements work? there just simple IF/ELSE statements)

    Edit:

    Inside config.php you will see near the top of the file

    $sbconfig['DefaultHost'] = "localhost";
    $sbconfig['DefaultUser'] = "root";
    

    Change those values. Thats should work for you

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm trying to create an if statement in PHP that prevents a single post
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I would like to count the length of a string with PHP. The string
this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.