<?php
$serverName = "192.168.19.12, 1433"; 
$connectionInfo = array( "UID"=>"sekolah", "PWD"=>"Pass123", "Database"=>"ODS_Situbondo");
$conn = sqlsrv_connect( $serverName, $connectionInfo);
?>
<!DOCTYPE html>
<html lang="en">

    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta http-equiv="Permissions-Policy" content="interest-cohort=()">
        <title>Install Website</title>
        <!-- Favicon -->
        <link rel="shortcut icon" type="image/icon" href="data:image/png;base64, "/>
        <link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,500i,700,700i,900" rel="stylesheet">
        <link href="assets/css/font-awesome.min.css" rel="stylesheet"> 
        <link href="assets/css/bootstrap-grid.css" rel="stylesheet">
        <link href="assets/css/multistep.min.css" rel="stylesheet">
        <link href="assets/css/animate.css" rel="stylesheet">
        <link href="assets/css/main.css" rel="stylesheet">
    </head>

    <body>
        <div class="loader"></div>
        <!--Multi Step Wizard Start-->
        <div id="rms-wizard" class="rms-wizard">
        <!--Wizard Container-->
            <div class="rms-container">
                <!--Wizard Header-->
                <div class="rms-wizard-header">
                    <h2 class="title">pengaturan pembuat  <span>situs web</span></h2>
                </div>
                <?php if($conn): ?>
                <!--Wizard Header Close--> 
                <div class="rms-form-wizard">
                    <!--Wizard Step Navigation Start-->
                    <div class="rms-step-section" data-step-counter="false" data-step-image="false">
                        <ul class="rms-multistep-progressbar"> 
                            <li class="rms-step rms-current-step">
                                <span class="step-icon"><i class="fa fa-lock" aria-hidden="true"></i></span>
                                <span class="step-title">Informasi Akun</span>
                                <span class="step-info">Data ini digunakan untuk login administrator website</span>
                            </li> 
                            <li class="rms-step ">
                                <span class="step-icon"><i class="fa fa-user" aria-hidden="true"></i></span>
                                <span class="step-title">Informasi Lembaga</span>
                                <span class="step-info">Silahkan pilih data lembaga yang telah disediakan</span>
                            </li>
                            <li class="rms-step ">
                                <span class="step-icon ml10"><i class="fa fa-credit-card" aria-hidden="true"></i></span>
                                <span class="step-title">Informasi Server</span>
                                <span class="step-info">Detail Server Pendukung</span>
                            </li>
                            <li class="rms-step ">
                                <span class="step-icon"><i class="fa fa-file-text" aria-hidden="true"></i></span>
                                <span class="step-title">Selesai</span>
                                <span class="step-info">Website siap diakses</span>
                            </li>
                        </ul>
                    </div>
                    <!--Wizard Navigation Close-->
                    <!--Wizard Content Section Start-->
                    <form method="POST" action="install.php" id="form-id">
                    <div class="rms-content-section">
                        <div class="rms-content-box rms-current-section">
                            <div class="rms-content-area"> 
                                <div class="rms-content-title">
                                    <div class="leftside-title"><b> <i class="fa fa-lock" aria-hidden="true"></i> Account</b> Information</div>
                                    <div class="step-label">Step 1 - 4 </div> 
                                </div>
                                <div class="rms-content-body"> 
                                    <div class="row">
                                        <div class="col-md-8">
                                        <div class="row user-profile">
                                                <div class="col-md-12">
                                                    <div class="inpt-form-group"> 
                                                        <label for="username">Nama Lengkap</label>
                                                    <div class="inpt-group">
                                                        <span class="inpt-group-addon"><i class="fa fa-user" aria-hidden="true"></i></span> 
                                                        <input type="text" name="name" value="Administrator" id="name" class="inpt-control required" placeholder="Ahmad Helwi Dinoto Boto"> 
                                                            
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-md-12">
                                                    <div class="inpt-form-group"> 
                                                        <label for="username">Username</label>
                                                    <div class="inpt-group">
                                                        <span class="inpt-group-addon"><i class="fa fa-user" aria-hidden="true"></i></span> 
                                                        <input type="text" name="username" id="username" class="inpt-control required" placeholder="ahmadhelwi"> 
                                                            
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-md-12">
                                                    <div class="inpt-form-group"> 
                                                        <label for="password">Password</label>
                                                        <div class="inpt-group">
                                                            <input type="password" name="password" min="5" max="20" id="password" class="inpt-control required" placeholder="Password">
                                                            
                                                        </div> 
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-md-12">
                                                    <div class="inpt-form-group"> 
                                                        <label for="confirmpassword">Confirm Password</label>
                                                        <div class="inpt-group">
                                                            <input type="password" name="cpassword" id="cpassword" class="inpt-control required" placeholder="Password">
                                                            
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <!-- <div class="row">
                                                <div class="col-md-12">
                                                    <div class="inpt-form-group"> 
                                                    <label for="Email">Email</label>
                                                    <div class="inpt-group"> 
                                                        <span class="inpt-group-addon"><i class="fa fa-envelope" aria-hidden="true"></i></span>
                                                        <input type="text" name="email" id="email" class="inpt-control required" placeholder="Please Enter your mail ID">
                                                        
                                                        </div>
                                                    </div>
                                                </div>
                                            </div> -->
                                        </div> 
                                    </div> 
                                </div> 
                            </div>
                        </div>
                        <div class="rms-content-box">
                            <div class="rms-content-area">
                                <div class="rms-content-title">
                                    <div class="leftside-title"><b> <i class="fa fa-user" aria-hidden="true"></i> Informasi</b> Lembaga</div>
                                    <div class="step-label">Step 2 - 4 </div> 
                                </div>
                                <div class="rms-content-body"> 
                                    <div class="row">
                                        <div class="col-md-8">
                                        <div class="row">
                                                <div class="col-md-12">
                                                    <div class="inpt-form-group"> 
                                                    <label for="Salutation">Bentuk Pendidikan</label>
                                                    <div class="inpt-group dropdown-select-icon"> 
                                                        <select name="bentuk_pendidikan_id" id="bentuk_pendidikan_id" class="inpt-control select required">
                                                            <option value="null" disabled selected >Select</option>
                                                                <?php $n=1;
                                                                $result = sqlsrv_query($conn,"SELECT * from  ref.bentuk_pendidikan WHERE bentuk_pendidikan_id in(1,2,3,4,5,6,24,27,40)");
                                                                while( $r = sqlsrv_fetch_object( $result )) { ?>
                                                                    <option value="<?=$r->bentuk_pendidikan_id?>"><?=$n++.". ".$r->nama?></option>

                                                                <?php } ?>

                                                            </select> 
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-md-12">
                                                    <div class="inpt-form-group"> 
                                                    <label for="Salutation">Pilih Kecamatan</label>
                                                    <div class="inpt-group dropdown-select-icon"> 
                                                        <select name="kecamatan" id="kecamatan" class="inpt-control select required">
                                                            <option value="null" disabled selected>Select</option>
                                                                <?php $n=1;
                                                                $result = sqlsrv_query($conn, "SELECT * from  ref.mst_wilayah where mst_kode_wilayah='052300' ORDER BY kode_wilayah ASC");
                                                                while( $r = sqlsrv_fetch_object( $result )) { ?>
                                                                    <option value="<?=$r->kode_wilayah?>"><?=$n++.". ".$r->nama?></option>

                                                                <?php } ?>

                                                            </select> 
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-md-12">
                                                    <div class="inpt-form-group"> 
                                                    <label for="Salutation">Pilih Sekolah</label>
                                                    <div class="inpt-group dropdown-select-icon"> 
                                                        <select name="sekolah" id="sekolah" class="inpt-control select required">
                                                            
                                                            </select> 
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="" id="data"></div>                                            
                                        </div> 
                                    </div> 
                                </div> 
                            </div> 
                        </div>

                        <div class="rms-content-box">
                            <div class="rms-content-area">
                                <div class="rms-content-title">
                                    <div class="leftside-title"><b> <i class="fa fa-credit-card" aria-hidden="true"></i> Informasi</b> Server</div>
                                    <div class="step-label">Step 3 - 4 </div>
                                
                                </div>
                                <div class="rms-content-body"> 
                                    <div class="row">
                                        <div class="col-md-8">
                                            <div class="row">
                                                <div class="col-md-12">
                                                    <div class="inpt-form-group"> 
                                                    <label for="holdername">HOST</label>
                                                    <div class="inpt-group"> 
                                                        <span class="inpt-group-addon"><i class="fa fa-server" aria-hidden="true"></i></span>
                                                        <input type="text" class="inpt-control required" value="localhost" disabled="">
                                                        <input type="hidden" name="database_host" id="database_host" class="inpt-control required" placeholder="localhost" value="localhost">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-md-9">
                                                    <div class="inpt-form-group"> 
                                                        <label for="cardnum">Nama Database</label>
                                                        <div class="inpt-group">
                                                            <input type="text" name="database_name" id="database_name" class="inpt-control required" placeholder="usernamecpanel_webdb" required>
                                                            
                                                        </div> 
                                                    </div>
                                                </div>
                                                <div class="col-md-3">
                                                    <div class="inpt-form-group"> 
                                                        <label for="cvc">PORT</label>
                                                        <div class="inpt-group">
                                                            <input type="text" class="inpt-control required" value="3306" disabled="">
                                                            <input type="hidden" name="database_port" id="database_port" value="3306" class="inpt-control required" placeholder="3306">
                                                        </div> 
                                                    </div>
                                                </div>
                                            </div> 
                                            <div class="row">
                                                <div class="col-md-12">
                                                    <div class="inpt-form-group"> 
                                                    <label for="holdername">Username</label>
                                                    <div class="inpt-group"> 
                                                        <span class="inpt-group-addon"><i class="fa fa-user" aria-hidden="true"></i></span>
                                                        <input type="text" name="database_user" id="database_user" class="inpt-control required" placeholder="username cpanel" >
                                                        
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                            <div class="row">
                                                <div class="col-md-12">
                                                    <div class="inpt-form-group"> 
                                                    <label for="holdername">Password</label>
                                                    <div class="inpt-group"> 
                                                        <span class="inpt-group-addon"><i class="fa fa-key" aria-hidden="true"></i></span>
                                                        <input type="password" name="database_password" id="database_password" class="inpt-control required" placeholder="password cpanel" >

                                                        
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        
                                        </div> 
                                    </div> 
                                </div> 
                            </div> 
                        </div>
                        <div class="rms-content-box">
                            <div class="rms-content-area">
                                <div class="rms-content-title">
                                    <div class="leftside-title"><b> <i class="fa fa-file-text" aria-hidden="true"></i> Confirm</b> Details</div>
                                    <div class="step-label">Step 4 - 4 </div> 
                                </div>
                                <div class="rms-content-body"> 
                                    <div class="row">
                                        <div class="col-md-8">
                                            <div class="row">
                                                <div class="col-md-12">
                                                    <div class="desc-container">
                                                        <div class="desc-table">

                                                        <h1>Silahkan Klik Submit</h1>
                                                        <!--  <table>
                                                                <tbody>
                                                                    <tr>
                                                                        <td class="desc-label">Username</td>
                                                                        <td class="desc-val">John_503in</td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td class="desc-label">Email </td>
                                                                        <td class="desc-val">john_doe@gmail.com</td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td class="desc-label">Nama Lengkap</td>
                                                                        <td class="desc-val">John Doe</td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td class="desc-label">NPSN</td>
                                                                        <td class="desc-val"></td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td class="desc-label">Sekolah</td>
                                                                        <td class="desc-val"></td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td class="desc-label">Alamat</td>
                                                                        <td class="desc-val">111 W.App Ave. Suite 123, Sunway, CA</td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td class="desc-label">Host</td>
                                                                        <td class="desc-val"></td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td class="desc-label">Database</td>
                                                                        <td class="desc-val"></td>
                                                                    </tr>
                                                                    <tr>
                                                                        <td class="desc-label">Port</td>
                                                                        <td class="desc-val"></td>
                                                                    </tr>
                                                                    
                                                                </tbody>
                                                            </table> -->
                                                        </div>
                                                    </div>
                                                </div>
                                            </div> 
                                        </div> 
                                    </div> 
                                </div> 
                            </div> 
                        </div>
                    </div>
                    <!--Wizard Content Section Close-->
                    <!--Wizard Footer section Start-->
                    <div class="rms-footer-section">
                        <div class="button-section">
                            <span class="next">
                                <a href="javascript:void(0)" class="btn">Next Step
                                    <small>Your information</small>
                                </a>
                            </span>
                            <span class="prev">
                                <a href="javascript:void(0)" class="btn" >Previous Step
                                    <small>Your information</small>
                                </a>
                            </span>
                            <span class="submit">
                            <!--  <input type="submit" name="" class="btn"> -->
                                <a href="javascript:void(0)" onclick="document.getElementById('form-id').submit();" class="btn" id="submit" >Submit
                                    <small>Your information</small>
                                </a>
                            </span> 
                        </div>
                    </div>
                    <!--Wizard Footer Close-->
                    </form>
                </div>
                <?php else: ?>
                <div class="rms-form-wizard">
                    <!--Wizard Step Navigation Start-->
                    <div class="rms-step-section" data-step-counter="false" data-step-image="false">
                        <ul class="rms-multistep-progressbar"> 
                            <li class="rms-step rms-current-step">
                                <span class="step-icon"><i class="fa fa-lock" aria-hidden="true"></i></span>
                                <span class="step-title">Informasi Akun</span>
                                <span class="step-info">Data ini digunakan untuk login administrator website</span>
                            </li> 
                            <li class="rms-step ">
                                <span class="step-icon"><i class="fa fa-user" aria-hidden="true"></i></span>
                                <span class="step-title">Informasi Lembaga</span>
                                <span class="step-info">Silahkan pilih data lembaga yang telah disediakan</span>
                            </li>
                            <li class="rms-step ">
                                <span class="step-icon ml10"><i class="fa fa-credit-card" aria-hidden="true"></i></span>
                                <span class="step-title">Informasi Server</span>
                                <span class="step-info">Detail Server Pendukung</span>
                            </li>
                            <li class="rms-step ">
                                <span class="step-icon"><i class="fa fa-file-text" aria-hidden="true"></i></span>
                                <span class="step-title">Selesai</span>
                                <span class="step-info">Website siap diakses</span>
                            </li>
                        </ul>
                    </div>
                    <!--Wizard Navigation Close-->
                    <!--Wizard Content Section Start-->
                    <div class="rms-content-section">
                        <div class="rms-content-box rms-current-section">
                            <div class="rms-content-area">
                                <div class="rms-content-title">
                                    <div class="leftside-title"><b> <i class="fa fa-lock" aria-hidden="true"></i> Account</b> Information</div>
                                    <div class="step-label">Step 1 - 4 </div> 
                                </div>
                                <div class="rms-content-body"> 
                                    <div class="row">
                                        <div class="col-md-12">
                                            <div class="row">
                                                <div class="col-md-12">
                                                    <div class="desc-container">
                                                        <div class="desc-table">        
                                                            <h1>Gagal Menghubungkan ke Server Database!</h1>
                                                            <h4><?php echo print_r(sqlsrv_errors(), true) ?></h4>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div> 
                                        </div> 
                                    </div> 
                                </div> 
                            </div> 
                        </div>
                    </div>
                    <!--Wizard Content Section Close-->
                    <!--Wizard Footer section Start-->
                    <div class="rms-footer-section">
                        <div class="button-section">
                            <span>
                                <button class="btn btn-md btn-info" id="reconnectDB">Retry
                                    <small>Reconnect to Database</small>
                                </button>
                            </span> 
                        </div>
                    </div>
                    <!--Wizard Footer Close-->
                </div>
                <?php endif; ?>
            </div>
        <!--Wizard Container Close-->
        </div>
        <!--Multi Step Wizard Close-->
        <!-- jQuery 3 -->
        <script src="assets/js/jquery.min.js"></script>
        <!-- jQuery UI 1.11.4 -->
        <script src="assets/js/jquery-ui.min.js"></script>
        <script type="text/javascript" src="assets/js/multistep.min.js"></script>
        <script type="text/javascript" src="assets/js/main.js"></script>
    </body>
</html>













