<div class="l-center edit">
        <div class="l-sort clearfix">
          <div class="l-unit-toolbar__buttonstrip">
            <a class="ui-button cancel" id="btn-back" href="/list/db/"><i class="fas fa-arrow-left status-icon blue"></i> <?=__('Back')?></a>
          </div>
          <div class="l-unit-toolbar__buttonstrip float-right">
            <a href="#" class="ui-button" title="<?=__('Save')?>" data-action="submit" data-id="vstobjects"><i class="fas fa-save status-icon purple"></i> <?=__('Save')?></a>
          </div>
        </div>
      </div>
    <div class="l-separator"></div>

    <div class="l-center animated fadeIn">
        <?php
          $back = $_SESSION['back'];
          if (empty($back)) {
            $back = "location.href='/list/db/'";
          } else {
            $back = "location.href='".$back."'";
          }
        ?>
        <form id="vstobjects" name="v_add_db" method="post">
            <input type="hidden" name="token" value="<?=$_SESSION['token']?>" />
            <input type="hidden" name="ok" value="Add" />

            <table class="data mode-add">
                <tr class="data-add">
                    <td class="data-dotted">
                        <table class="data-col1">
                            <tr><td></td></tr>
                        </table>
                    </td>
                    <td class="data-dotted">
                        <table class="data-col2" width="600px">
                            <tr>
                                <td class="step-top">
                                    <span class="page-title"><?=__('Adding database')?></span>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <?php
                                        if (!empty($_SESSION['error_msg'])) {
                                            echo "<span class=\"vst-error\"> <i class=\"fas fa-exclamation-circle status-icon red\"></i> ".htmlentities($_SESSION['error_msg'])."</span>";
                                        } else {
                                            if (!empty($_SESSION['ok_msg'])) {
                                            echo "<span class=\"vst-ok\"> <i class=\"fas fa-check-circle status-icon green\"></i> ".$_SESSION['ok_msg']."</span>";
                                            }
                                        }
                                    ?>
                                </td>
                            </tr>
                            <tr>
                                <td class="step-top hint">
                                    <?php print __('Prefix will be automaticaly added to database name and database user',"<b>".$user."_</b>");?>
                                </td>
                            </tr>
                            <tr>
                                <td class="vst-text input-label">
                                    <?php print __('Database');?>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <input type="text" size="20" class="vst-input" name="v_database" value="<?=htmlentities(trim($v_database, "'"))?>">
                                    <small class="hint"></small>
                                </td>
                            </tr>
                            <tr>
                                <td class="vst-text input-label">
                                    <?php
                                        print __('User');
                                        // if (is_it_mysql_or_mariadb()=='mysql')
                                        echo "&nbsp;&nbsp;&nbsp;&nbsp;<em><small>(".__('maximum characters length, including prefix', 16).")</small></em>";
                                    ?>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <input type="text" size="20" class="vst-input" name="v_dbuser" value="<?=htmlentities(trim($v_dbuser, "'"))?>">
                                    <small class="hint"></small>
                                </td>
                            </tr>
                            <tr>
                                <td class="vst-text input-label">
                                    <?php print __('Password');?> / <a href="javascript:randomString();" class="generate"><?php print __('generate');?></a>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <input type="text" size="20" class="vst-input password" name="v_password"><br />
                                    <meter max="4" id="meter"></meter>
                                </td>
                            </tr>
                            <tr>
                                <td class="vst-text">
                                    <?php print __('Your password must have at least');?>
                                    <ul>
                                        <li><?php print __('8 characters long');?></li>
                                        <li><?php print __('1 uppercase & 1 lowercase character');?></li>
                                        <li><?php print __('1 number');?></li>
                                    </ul>
                                </td>
                            </tr>
                            <tr>
                                <td class="vst-text">
                                    <?php print __('Type');?>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <select class="vst-list" name="v_type">
                                        <?php
                                            foreach ($db_types as $key => $value) {
                                                echo "\n\t\t\t\t\t\t\t\t\t\t<option value=\"".htmlentities($value)."\"";
                                                if ((!empty($v_type)) && ( $value == $v_type )) echo ' selected';
                                                echo ">".htmlentities($value)."</option>";
                                            }
                                        ?>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td class="vst-text input-label">
                                    <?php print __('Host');?>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <select class="vst-list" name="v_host">
                                        <?php
                                            foreach ($db_hosts as $value) {
                                                echo "\n\t\t\t\t\t\t\t\t\t\t<option value=\"".htmlentities($value)."\"";
                                                if ((!empty($v_host)) && ( $value == $v_host )) echo ' selected';
                                                echo ">".htmlentities($value)."</option>";
                                            }
                                        ?>
                                    </select>
                                </td>
                            </tr>

                            <tr>
                                <td class="vst-text input-label">
                                    <?php print __('Charset');?>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <select class="vst-list" name="v_charset">
                                        <option value=big5 <?php if ((!empty($v_charset)) && ( $v_charset == 'big5')) echo 'selected';?> >big5</option>
                                        <option value=dec8 <?php if ((!empty($v_charset)) && ( $v_charset == 'dec8')) echo 'selected';?> >dec8</option>
                                        <option value=cp850 <?php if ((!empty($v_charset)) && ( $v_charset == 'cp850')) echo 'selected';?> >cp850</option>
                                        <option value=hp8 <?php if ((!empty($v_charset)) && ( $v_charset == 'hp8')) echo 'selected';?> >hp8</option>
                                        <option value=koi8r <?php if ((!empty($v_charset)) && ( $v_charset == 'koi8r')) echo 'selected';?> >koi8r</option>
                                        <option value=latin1 <?php if ((!empty($v_charset)) && ( $v_charset == 'latin1')) echo 'selected';?> >latin1</option>
                                        <option value=latin2 <?php if ((!empty($v_charset)) && ( $v_charset == 'latin2')) echo 'selected';?> >latin2</option>
                                        <option value=swe7 <?php if ((!empty($v_charset)) && ( $v_charset == 'swe7')) echo 'selected';?> >swe7</option>
                                        <option value=ascii <?php if ((!empty($v_charset)) && ( $v_charset == 'ascii')) echo 'selected';?> >ascii</option>
                                        <option value=ujis <?php if ((!empty($v_charset)) && ( $v_charset == 'ujis')) echo 'selected';?> >ujis</option>
                                        <option value=sjis <?php if ((!empty($v_charset)) && ( $v_charset == 'sjis')) echo 'selected';?> >sjis</option>
                                        <option value=hebrew <?php if ((!empty($v_charset)) && ( $v_charset == 'hebrew')) echo 'selected';?> >hebrew</option>
                                        <option value=tis620 <?php if ((!empty($v_charset)) && ( $v_charset == 'tis620')) echo 'selected';?> >tis620</option>
                                        <option value=euckr <?php if ((!empty($v_charset)) && ( $v_charset == 'euckr')) echo 'selected';?> >euckr</option>
                                        <option value=koi8u <?php if ((!empty($v_charset)) && ( $v_charset == 'koi8u')) echo 'selected';?> >koi8u</option>
                                        <option value=gb2312 <?php if ((!empty($v_charset)) && ( $v_charset == 'gb2312')) echo 'selected';?> >gb2312</option>
                                        <option value=greek <?php if ((!empty($v_charset)) && ( $v_charset == 'greek')) echo 'selected';?> >greek</option>
                                        <option value=cp1250 <?php if ((!empty($v_charset)) && ( $v_charset == 'cp1250')) echo 'selected';?> >cp1250</option>
                                        <option value=gbk <?php if ((!empty($v_charset)) && ( $v_charset == 'gbk')) echo 'selected';?> >gbk</option>
                                        <option value=latin5 <?php if ((!empty($v_charset)) && ( $v_charset == 'latin5')) echo 'selected';?> >latin5</option>
                                        <option value=armscii8 <?php if ((!empty($v_charset)) && ( $v_charset == 'armscii8')) echo 'selected';?> >armscii8</option>
                                        <option value=utf8 <?php if ((!empty($v_charset)) && ( $v_charset == 'utf8')) echo 'selected';?> <?php if (empty($v_charset)) echo 'selected';?> >utf8</option>
                                        <option value=utf8mb4 <?php if ((!empty($v_charset)) && ( $v_charset == 'utf8mb4')) echo 'selected';?> >utf8mb4</option>
                                        <option value=ucs2 <?php if ((!empty($v_charset)) && ( $v_charset == 'ucs2')) echo 'selected';?> >ucs2</option>
                                        <option value=cp866 <?php if ((!empty($v_charset)) && ( $v_charset == 'cp866')) echo 'selected';?> >cp866</option>
                                        <option value=keybcs2 <?php if ((!empty($v_charset)) && ( $v_charset == 'keybcs2')) echo 'selected';?> >keybcs2</option>
                                        <option value=macce <?php if ((!empty($v_charset)) && ( $v_charset == 'macce')) echo 'selected';?> >macce</option>
                                        <option value=macroman <?php if ((!empty($v_charset)) && ( $v_charset == 'macroman')) echo 'selected';?> >macroman</option>
                                        <option value=cp852 <?php if ((!empty($v_charset)) && ( $v_charset == 'cp852')) echo 'selected';?> >cp852</option>
                                        <option value=latin7 <?php if ((!empty($v_charset)) && ( $v_charset == 'latin7')) echo 'selected';?> >latin7</option>
                                        <option value=cp1251 <?php if ((!empty($v_charset)) && ( $v_charset == 'cp1251')) echo 'selected';?> >cp1251</option>
                                        <option value=cp1256 <?php if ((!empty($v_charset)) && ( $v_charset == 'cp1256')) echo 'selected';?> >cp1256</option>
                                        <option value=cp1257 <?php if ((!empty($v_charset)) && ( $v_charset == 'cp1257')) echo 'selected';?> >cp1257</option>
                                        <option value=binary <?php if ((!empty($v_charset)) && ( $v_charset == 'binary')) echo 'selected';?> >binary</option>
                                        <option value=geostd8 <?php if ((!empty($v_charset)) && ( $v_charset == 'geostd8')) echo 'selected';?> >geostd8</option>
                                        <option value=cp932 <?php if ((!empty($v_charset)) && ( $v_charset == 'cp932')) echo 'selected';?> >cp932</option>
                                        <option value=eucjpms <?php if ((!empty($v_charset)) && ( $v_charset == 'eucjpms')) echo 'selected';?> >eucjpms</option>
                                    </select>
                                </td>
                            <tr>
                                <td class="vst-text input-label">
                                    <?php print __('Send login credentials to email address') ?>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <input type="text"  class="vst-input" name="v_db_email" value="<?=htmlentities(trim($v_db_email, "'"))?>">
                                </td>
                            </tr>
                        </table>
                        <table class="data-col2">
                        </table>
                    </td>
                </tr>
            </table>
        </form>
    </div>

    <script>
        GLOBAL.DB_USER_PREFIX = <?=json_encode($user.'_')?>;
        GLOBAL.DB_DBNAME_PREFIX = <?=json_encode($user.'_')?>;
    </script>
