Ankündigung

Einklappen
Keine Ankündigung bisher.

Passwort in Datenbank

Einklappen

Neue Werbung 2019

Einklappen
X
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • #16
    Hier ist die install.php




    PHP-Code:
             <?
    /*
    Syntax: ../[path]/install.php?db=your_database_name
    MySQL dumping data must be created in DUMP.SQL on the same folder as this script
    */
    $title = "PHP MySQL Database Quick Installer";
    $dump_file = "dump.sql";
    $host_name = "localhost";
    $bg_color = "#91b9dc";
    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    <HEAD>
    <TITLE><?=$title?></TITLE>
    <style>
            A {text-decoration: none}
            A:hover {color: #FFFF00; text-decoration: none}
            A:link {color: #FFFFAA; text-decoration: none}
            A:visited {color: #FFFFFF; text-decoration: none}
            A:active {color: #FFFFFF; text-decoration: none}
            .textfield {font-family: Verdana, Arial; font-size: 8pt; color: #FF0000; background: #FFF3E3; border: 0}
            .textwhite {font-family: Arial, Verdana; font-size: 9pt; color: #FFFFFF}
            .textblack {font-family: Arial, Verdana; font-size: 9pt; color: #003333}
            .formbutton {BORDER: 1; COLOR: #CC0000; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; FONT-SIZE: 11px;}
    </style>
    <BODY bgColor="<?=$bg_color?>" leftMargin=0 topMargin=0 MARGINWIDTH="0" MARGINHEIGHT="0">
    <?if($submit and $db){
    //---------------------------------
    $error = "";
    $dbconn = mysql_connect($host, $user, $pass) or $error="Can not connect to database server";
    if(!$error){
            if($create)
            mysql_query("create database $db") or $error="Can not create database <font color=red>$db</font>";
            if(!$error)
            mysql_select_db($db) or $error="Can not select database";
            if(!$error){
                    $dump = addslashes(fread(fopen($dump_file, "r"), filesize($dump_file)));
                    if(!$dump) $error="Can not read dumping file";
                    else{
                            $queries = split_sql($dump,$drop);
                            for($i=0;$i<count($queries);$i++){
                                    $query = stripslashes(trim($queries[$i]));
                                    if(!empty($query) && $query!="#")
                                    mysql_db_query ($db, $query) or $error="Data dumping failed";
                                    if($error) break;
                            }
                    }
            }
    }
    if($error)
    echo "<span class=textblack>$error</span>";
    else
    echo "<span class=textblack><b>Database installed successfully</b></span>";
    mysql_close($dbconn);
    //---------------------------------
    }else{?>
    <form action="<?=$SCRIPT_NAME?>" method=post>
    <TABLE cellSpacing=0 cellPadding=0 width=750 border=0>
    <TBODY>
      <TR>
        <TD vAlign=top bgColor=#2864ae height=19>
            <SPAN class=textwhite>&nbsp;
            </SPAN>
        </TD>
        <TD align=right bgColor=#2864ae>
            <SPAN class=textwhite><b>Database Installer</b>
            </SPAN>
        </TD>
      </TR>
      <TR>
        <TD width=750 bgColor=#000000 colSpan=8 height=2></TD>
      </TR>
    </TBODY>
    </TABLE>
    <TABLE cellSpacing=0 cellPadding=0 bgColor=#edf5fc border=0>
      <TBODY>
      <TR>
        <TD vAlign=top align=left width=750>
          <TABLE cellSpacing=0 cellPadding=8 width=100% border=0>
            <TBODY>
            <TR>
              <TD class=textblack rowSpan=2 valign=top>
    Before going on be sure that you have seen file <b><?=$dump_file?></b> uploaded
    in this folder, or nothing will be created.<br>
    If you plan to use an existing database, be noted that the action
    may erase all the old data that were input within the database.<br>
    <p>
    Database Name<br>
    <input size=15 class=textfield name=db value="<?=$db?>"><br>
    <input type=checkbox name=create value="1">
    Check this box if you want to create new database<br>
    <input type=checkbox name=drop value="1">
    Check this box if you want to drop tables in existing database
              </TD>
              <TD class=textblack valign=top>
    Database Host<br>
    <input size=20 class=textfield name=host value="<?=$host_name?>"><br>
    Database User<br>
    <input size=20 class=textfield name=user><br>
    Password<br>
    <input size=20 class=textfield type=password name=pass><br>
              </TD>
            </TR>
            <TR>
              <TD class=textblack valign=top>
    <input class=formbutton type=submit name=submit value=" start ">
              </TD>
            </TR>
            </TBODY>
          </TABLE>
        </TD>
      </TR>
      </TBODY>
    </TABLE>
    <TABLE cellSpacing=0 cellPadding=0 bgColor=#edf5fc border=0>
      <TBODY>
      <TR>
        <TD width=750 bgColor=#6699cc height=8>
        </TD>
      </TR>
      <TR>
        <TD width=750 vAlign=top align=left>
        </TD>
      </TR>
      </TBODY>
    </TABLE>
    <TABLE cellSpacing=0 cellPadding=0 border=0>
      <TBODY>
      <TR>
        <TD vAlign=center align=left width=250 bgColor=#2864ae height=23></TD>
        <TD vAlign=center align=right width=500 bgColor=#2864ae height=23>
            <SPAN class=textwhite>Copyright

            </SPAN>
        </TD>
      </TR>
      </TBODY>
    </TABLE>
    </form>
    <?
    }
    //---------------------------------
    function split_sql($sql,$drop=false)
    {
        $sql = trim($sql);
        $sql = ereg_replace("#[^\n]*\n", "", $sql);
        if(!$drop){
          $sql = ereg_replace("drop table[^\n]*\n", "", $sql);
          $sql = ereg_replace("DROP TABLE[^\n]*\n", "", $sql);
        }
        $buffer = array();
        $ret = array();
        $in_string = false;
        for($i=0; $i<strlen($sql)-1; $i++)
        {
             if($sql[$i] == ";" && !$in_string)
            {
                $ret[] = substr($sql, 0, $i);
                $sql = substr($sql, $i + 1);
                $i = 0;
            }
            if($in_string && ($sql[$i] == $in_string) && $buffer[0] != "\\")
            {
                 $in_string = false;
            }
            elseif(!$in_string && ($sql[$i] == "\"" || $sql[$i] == "'") && (!isset($buffer[0]) || $buffer[0] != "\\"))
            {
                 $in_string = $sql[$i];
            }
            if(isset($buffer[1]))
            {
                $buffer[0] = $buffer[1];
            }
            $buffer[1] = $sql[$i];
         }
        if(!empty($sql))
        {
            $ret[] = $sql;
        }
        return($ret);
    }
    ?>
    </BODY>
    </HTML>

    Kommentar


    • #17
      siehe #15

      Kommentar


      • #18
        Klar, man kann die Meinung teilen, dass ein naiver Benutzer nur das Passwort eines selbst erstellten Benutzers nehmen sollte, da so das Passwort bekannt ist.

        Jedoch finde ich dies überaus fragwürdig, da ein Standard-Passwort in einer Benutzerdatenbank mehr als nur eine Sicherheitslücke ist und daher andere mit ziemlich großer Wahrscheinlichkeit auch zu finden sein werden.

        Kommentar


        • #19
          Log dich einfach ein mit

          admin und h9XXkDKzwY432
          [PHP]if ($var != 0) {
          $var = 0;
          }[/PHP]

          Kommentar

          Lädt...
          X