Hallo! Selamat Datang di Marketplace produk digital, Freelancer terbaik di indonesia (63327 Members, 751 Products, 4859 Topic, 12426 Comments)

Butuh karyawan baru? atau seorang Web Developer (Part-time/Freelance/Full-time), cari disini : Members Area Jobs!

Apa yang salah di dalam code ini ya, saya edit tapi database tidak masuk??? Mohon bantuannya

Dibuat
Login Terakhir 13 Hari lalu,
Telah Dilihat 138 Kali
Sugandi Anarki Mengatakan : Premium
Assalamualaikum Warahmatullahi Wabarakatuh...

<?php
    error_reporting
(1);
    include 
"../../assets/config/koneksi.php";
    include 
"../../assets/phpqrcode/qrlib.php";

    
// Star Webcam
    
$img $_POST['webcam'];
    
$folderPath "../../assets/img/user/";
    
$image_parts explode(";base64,"$img);
    
$image_type_aux explode("image/"$image_parts[0]);
    
$image_type $image_type_aux[1];
    
$image_base64 base64_decode($image_parts[1]);
    
$fileNama uniqid() . '.png';
    
$file $folderPath $fileNama;
    
file_put_contents($file$image_base64);
    
// End Webcam

    
$nama $_POST['a']; //isi QR code
    //$nama1 = $_POST['d']; //isi QR code
    
$nam $_POST['a']; //isi QR code

    
$nameqrcode    $nam.'.'.'png';              //nama QR Code yang disimpan ke folder dan database
    
$tempdir        "../../assets/img/qrcode/";   // Nama Folder file QR Code kita nantinya akan disimpan
    
$isiqrcode     $nama;
    
$quality        'H';
    
$Ukuran         10;
    
$padding        0;

    
QRCode::png($isiqrcode,$tempdir.$nameqrcode,$quality,$Ukuran,$padding); // simpan qrcode

    
date_default_timezone_set('Asia/Jakarta');
    
$tgl date("Y-m-d");
    
$time date("G:i:s");
    
$pass=md5($_POST['password']);
    if (
$_FILES['gambar']['size'] != 0)
    {
        
$fileName $_FILES['gambar']['name'];
        
$move move_uploaded_file($_FILES['gambar']['tmp_name'], "../../assets/img/user/".$_FILES['gambar']['name']);
        if(
$move)
        {
        
mysqli_query($koneksi"INSERT INTO user (gambar,  nama_sekolah, nis, id_level, username, password, nama, jk, tmp_lhr, tgl_lhr, alamat, id_prov, id_kab, id_kec, id_kel, hp, email, tgl_input, waktu, qrcode) VALUES ('$fileName',  '$_POST[o]', '$_POST[a]', '$_POST[b]', '$_POST[c]', '$pass', '$_POST[d]', '$_POST[e]', '$_POST[f]', '$_POST[g]', '$_POST[h]', '$_POST[i]', '$_POST[j]', '$_POST[k]', '$_POST[l]', '$_POST[m]', '$_POST[n]', '$tgl', '$time', '$nameqrcode')");
        echo 
"<script>window.alert('Data Berhasil di Input!');
                window.location='../view-data'</script>"
;
        }
    }
    else
     {  
    
mysqli_query($koneksi"INSERT INTO user (gambar,  nama_sekolah, nis, id_level, username, password, nama, jk, tmp_lhr, tgl_lhr, alamat, id_prov, id_kab, id_kec, id_kel, hp, email, tgl_input, waktu, qrcode) VALUES ('$fileNama',  '$_POST[o]', '$_POST[a]', '$_POST[b]', '$_POST[c]', '$pass', '$_POST[d]', '$_POST[e]', '$_POST[f]', '$_POST[g]', '$_POST[h]', '$_POST[i]', '$_POST[j]', '$_POST[k]', '$_POST[l]', '$_POST[m]', '$_POST[n]', '$tgl', '$time', '$nameqrcode')");
        echo 
"<script>window.alert('Data Berhasil di Input!');
                window.location='../view-data'</script>"
;
    }
?>
===================================================================================
<?php include "header.php" ?>
<div class="wrapper">
  <!-- Star menu -->
  <?php include "menu.php";?>
  <!-- End menu -->

  <!-- Start content -->
  <div class='content-wrapper'>
    <!-- Content Header (Page header) -->
    <section class='content-header'>
      <h1>
        <?php echo "$i[nama] "?>
        <small>Control panel</small>
      </h1>
      <ol class='breadcrumb'>
        <li><a href='home'><i class='fa fa-dashboard'></i> Home</a></li>
        <li class='active'>Tambah Data</li>
      </ol>
    </section>

    <!-- Main content -->
    <section class='content'>
      <div class='row'>
        <div class='col-md-12'>
          <div class='box box-success'>
            <div class='box-header with-border'>
              <h3 class='box-title'><i class='fa fa-edit'></i> FORM TAMBAH USER</h3>
            </div>
            <form class='form-horizontal' role='form' method=POST action='aksi/user_simpanx2.php' enctype='multipart/form-data'>
              <div class='box-body'>
              <div class='form-group'>
                
                <label class='col-sm-2 control-label'>Nama Sekolah : </label>
                <div class='col-sm-4'>
                  <input type='text' class='form-control' name='o'  placeholder='Tuliskan Nama Sekolah'>
                </div>
              </div>
                <div class='form-group'>
                  <label class='col-sm-2 control-label'>Level User :</label>
                  <div class='col-sm-4'>
                   <select name='b' class='form-control'>
                    <?php 
                    $tampil 
mysqli_query($koneksi"SELECT * FROM level where id_level='2' ORDER BY id_level ");
                    while(
$r=mysqli_fetch_array($tampil))
                    {
                      echo 
"<option value='".$r['id_level']."' selected>".$r['level']."</option>";
                    }
                    
?>
                  </select>
                </div>
              </div>
              <div class='form-group'>
                <label class='col-sm-2 control-label'>Username :</label>
                <div class='col-sm-4'>
                  <input type='text' class='form-control' name='c' placeholder='Tuliskan Username'>
                </div>
                <label class='col-sm-2 control-label'>Password : </label>
                <div class='col-sm-4'>
                  <input type='password' class='form-control' name='password'  placeholder='Tuliskan Password'>
                </div>
              </div>
              <div class='form-group'>
                <label class='col-sm-2 control-label'>Nama :</label>
                <div class='col-sm-4'>
                  <input type='text' class='form-control' name='d' placeholder='Tuliskan Nama Lengkap'>
                </div>
                <label class='col-sm-2 control-label'>JK :</label>
                <div class='col-sm-4'>
                 <select name='e' class='form-control'>
                  <option value='' selected>Pilih Jenis Kelamin</option>
                  <option value='Laki-laki' >Laki-laki</option>
                  <option value='Perempuan' >Perempuan</option>
                </select>
              </div>
            </div>
            <div class='form-group'>
              <label class='col-sm-2 control-label'>Tempat lahir:</label>
              <div class='col-sm-4'>
                <input class='form-control' name='f'  placeholder='Tuliskan Tempat Lahir'>
              </div>
              <label class='col-sm-2 control-label'>Tanggal Lahir : </label>
              <div class='col-sm-4'>
                <input type='date' class='form-control' name='g'  value="<?php echo date('Y-m-d'); ?>">
              </div>
            </div> 
            <div class='form-group'>
              <label class='col-sm-2 control-label'>Alamat :</label>
              <div class='col-sm-4'>
                <textarea class='form-control' name='h'  placeholder='Tuliskan Alamat Rumah'></textarea>
              </div>
              <label class='col-sm-2 control-label'>Provinsi :</label>
              <div class='col-sm-4'>
               <select id="provinsi" name='i' class='form-control'>
                <option value="">Pilih Provinsi</option>
                <?php
                $tampil 
mysqli_query($koneksi"SELECT * FROM provinsi ORDER BY nama_provinsi");
                while(
$row=mysqli_fetch_array($tampil)) {
                  
?>
                  <option value="<?php echo $row['id_prov']; ?>"><?php echo $row['nama_provinsi']; ?></option>
                  <?php
                
}
                
?>
              </select>
            </div>
          </div>
          <div class='form-group'>
            <label class='col-sm-2 control-label'>Kabupaten :</label>
            <div class='col-sm-4'>
             <select id="kabupaten" name='j' class='form-control' >
              <option value='' selected>Pilih Kabupaten</option>
              <?php
              $tampil 
mysqli_query($koneksi"SELECT * FROM kabupaten ORDER BY nama_kabupaten");
              while(
$row=mysqli_fetch_array($tampil)) {
                
?>
                <option id="kabupaten" class="<?php echo $row['id_prov']; ?>" value="<?php echo $row['id_kab']; ?>"><?php echo $row['nama_kabupaten']; ?></option>
                <?php
              
}
              
?>
            </select>
          </div>
          <label class='col-sm-2 control-label'>Kecamatan :</label>
          <div class='col-sm-4'>
           <select id="kecamatan" name='k' class='form-control'>
            <option value='' selected>Pilih Kecamatan</option>
            <?php
            $tampil 
mysqli_query($koneksi"SELECT * FROM kecamatan ORDER BY nama_kecamatan");
            while(
$row=mysqli_fetch_array($tampil)) {
              
?>
              <option id="kecamatan" class="<?php echo $row['id_kab']; ?>" value="<?php echo $row['id_kec']; ?>"><?php echo $row['nama_kecamatan']; ?></option>
              <?php
            
}
            
?>
          </select>
        </div>
      </div>
      <div class='form-group'>
        <label class='col-sm-2 control-label'>Kelurahan : </label>
        <div class='col-sm-4'>
          <select id="kelurahan" name='l' class='form-control'>
            <option value='' selected>Pilih Kelurahan</option>
            <?php
            $tampil 
mysqli_query($koneksi"SELECT * FROM kelurahan ORDER BY nama_kelurahan");
            while(
$row=mysqli_fetch_array($tampil)) {
              
?>
              <option id="kelurahan" class="<?php echo $row['id_kec']; ?>" value="<?php echo $row['id_kel']; ?>"><?php echo $row['nama_kelurahan']; ?></option>
              <?php
            
}
            
?>
          </select>
        </div>
        <label class='col-sm-2 control-label'>Telp./Hp. : </label>
        <div class='col-sm-4'>
          <input type='text' class='form-control' name='m' placeholder='Tuliskan Nomor Telp./Hp.'>
        </div>
      </div>
      <div class='form-group'>
        <label class='col-sm-2 control-label'>Email  : </label>
        <div class='col-sm-4'>
          <input type='email' class='form-control' name='n' placeholder='Contoh: hadisaputra.bambang@gmail.com'>
        </div>
        <label class='col-sm-2 control-label'>Unggah Foto :</label>
        <div class='col-sm-4'>
          <input type='file' class='form-control' name='gambar'>
        </div>
      </div>
      
      <div class='form-group'>
        <label class='col-sm-2 control-label'>Foto Webcam  : </label>
        <div class='col-sm-4'>
          <div class="box box-solid box-primary">
            <div class="box-header">
              <h3 class="panel-title"><i class="fa fa-camera"></i> Camera Webcam</h3>
            </div><!-- /.box-header -->
            <div class="box-body">
              <center> <div id="my_camera"></div><center><br><button class="class='form-control btn btn-flat bg-orange" type=button onClick="take_snapshot()"><i class="glyphicon glyphicon-camera"></i> Ambil Gambar</button>
                <input type="hidden" name="webcam" class="image-tag">
              </div><!-- /.box-body -->
            </div><!-- /.box -->
          </div>                  
          <div class="col-md-2"></div>
          <div class="col-md-4">
            <div class="box box-solid box-danger">
              <div class="box-header">
                <h3 class="panel-title"><i class="fa fa-camera"></i> Hasil Camera Webcam</h3>
              </div><!-- /.box-header -->
              <div class="box-body">
                <center><div id="results" class="img-thumbnail"><i class="glyphicon glyphicon-camera"></i></center>
                </div><!-- /.box-body -->
              </div><!-- /.box -->
            </div>
          </div>

        </div>

        <div class='box-footer'>
          <label class='col-sm-2 control-label'></label>
          <div class='col-sm-10'>
            <button style='width: 150px;' type="submit" class="btn btn-flat btn-primary"><i class="glyphicon glyphicon-floppy-save"></i> S I M P A N</button>
            <a style='width: 150px;' href="view-data" type="button" class="btn btn-flat btn-danger"><i class="glyphicon glyphicon-floppy-remove"></i> B A T A L</a>
          </div>
        </div>
      </div>
    </form>
  </div>
</div>
</section>
<!-- /.content -->
</div>
<!-- End content --><script src="../assets/webcam/java.js"></script>
<script src="../assets/webcam/webcam.min.js"></script>
<script language="JavaScript">
  Webcam.set({
      // live preview size
      width: 300,
      height: 230,
      
      // device capture size
      dest_width: 300,
      dest_height: 230,
      
      // final cropped size
      crop_width: 184,
      crop_height: 230,
      
      // format and quality
      image_format: 'jpeg',
      jpeg_quality: 90
    });

  Webcam.attach( '#my_camera' );

  function take_snapshot() {
    Webcam.snap( function(data_uri) {
      $(".image-tag").val(data_uri);
      document.getElementById('results').innerHTML = '<img src="'+data_uri+'"/>';
    } );
  }
</script>
<?php include "footer.php";?>
1
Maaf, Untuk Memberikan Komentar Anda Harus Login !!!