Senin, 29 Juni 2020

Library COde 2020

<?php
 $sql="select `id_pedagang` from `$tbpedagang` order by `id_pedagang` desc";
  $q=mysqli_query($conn, $sql);
  $jum=mysqli_num_rows($q);
  $th=date("y");
  $bl=date("m")+0;if($bl<10){$bl="0".$bl;}

  $kd="PDG".$th.$bl;//KEG1610001
  if($jum > 0){
   $d=mysqli_fetch_array($q);
   $idmax=$d["id_pedagang"];
 
   $bul=substr($idmax,5,2);
   $tah=substr($idmax,3,2);
    if($bul==$bl && $tah==$th){
     $urut=substr($idmax,7,3)+1;
     if($urut<10){$idmax="$kd"."00".$urut;}
     else if($urut<100){$idmax="$kd"."0".$urut;}
     else{$idmax="$kd".$urut;}
    }//==
    else{
     $idmax="$kd"."001";
     } 
   }//jum>0
  else{$idmax="$kd"."001";}
  $id_pedagang=$idmax;
 
  ?>
 
 
<?php
  $sql="select `id_user` from `$tbuser` order by `id_user` desc";
  $jum= getJum($conn,$sql);
  $kd="USR";
if($jum > 0){
$d=getField($conn,$sql);
    $idmax=$d['id_user'];
$urut=substr($idmax,3,2)+1;//01
if($urut<10){$idmax="$kd"."0".$urut;}
else{$idmax="$kd".$urut;}
}
else{$idmax="$kd"."01";}
$id_user=$idmax;
?>


<tr>
<td><label for="nama_user">Nama User</label>
<td>:
<td colspan="2"><input required placeholder="Nama User" title="Nama User" name="nama_user" class="form-control" type="text" id="nama_user" value="<?php echo $nama_user;?>" size="30" /></td>
</tr>

<tr>
<td height="24"><label for="telepon">Telepon</label>
<td>:<td colspan="2"><input required name="telepon" class="form-control" type="number" id="telepon" value="<?php echo $telepon;?>" size="15" />
</td>
</tr>

<tr>
<td height="24"><label for="email">Email</label>
<td>:
<td><input name="email" type="email" class="form-control" id="email" value="<?php echo $email;?>" size="30" />
</td>
</tr>



<script type="text/javascript">
function PRINT(pk){
win=window.open('customer/print.php?pk='+pk,'win','width=1000, height=400, menubar=0, scrollbars=1, resizable=0, location=0, toolbar=0, username=0'); }
</script>



INI CALLER NYA:
| <img src='ypathicon/print.png' alt='PRINT' OnClick="PRINT('<?php echo $status;?>')"> |




INI CODE PRINTNYA:
<style type="text/css">body {width: 100%;} </style>
<body OnLoad="window.print()" OnFocus="window.close()">
<?php
include "../konmysqli.php";
echo"<link href='../ypathcss/$css' rel='stylesheet' type='text/css' />";
$YPATH="../ypathfile";

$pk="";
$field="id_customer";
$TB="$tbcustomer";
$item="Customer";

$sql="select * from `$TB` order by `$field` asc";
if(isset($_GET["pk"])){
 $pk=$_GET["pk"];
  $sql="select * from `$TB` where `$field` ='$pk' order by `$field` asc";
}
?>


<h3><center>Laporan Data <?php echo $item;?> <?php echo $pk;?></h3>


<table width="98%" border="0">
  <tr>
    <th width="2%">No</td>
    <th width="50%">Nama Customer</td>
    <th width="10%">Status</td>
 <th width="40%">Keterangan</td>
  </tr>
<?php 

  $jum=getJum($conn,$sql);
  $no=0;
  if($jum > 0){
 $arr=getData($conn,$sql);
  foreach($arr as $d) {       
  $no++;
    $id_customer=$d["id_customer"];
    $nama_customer=$d["nama_customer"];
    $alamat=$d["alamat"];
    $telepon=$d["telepon"];
    $email=$d["email"];
    $username=$d["username"]
    ;$password=$d["password"];
    $status=$d["status"];
    $keterangan=$d["keterangan"];
 $color="#cccccc";   
if($no %2==1){$color="#dddddd";}

echo"<tr bgcolor='$color'>
    <td>$no</td>
    <td><b><a href='mailto:$email'>$nama_customer</b> ($id_customer)</a></br>
    Alamat : <i>$alamat $telepon</i></td>
    <td>$status</td>
    <td>$keterangan</td>
    </tr>";
   
   }//while
  }//if
  else{echo"<tr><td colspan='7'><blink>Maaf, Data $item Belum Tersedia...</blink></td></tr>";}
  ?>

</table>





<a href="excel.php?tabel=tb_admin&pk=id_admin">EXCEL</a>

<?php
date_default_timezone_set("Asia/Jakarta");

require_once"koneksivar.php";


$conn = new mysqli($DBServer, $DBUser, $DBPass, $DBName);
if ($conn->connect_error) {
  trigger_error('Database connection failed: '  . $conn->connect_error, E_USER_ERROR);
}

$NT="tb_admin";
$PK="id_admin";
if(isset($_GET["tabel"])){
 $NT=$_GET["tabel"];
 $PK=$_GET["pk"];
}


?>
<!DOCTYPE html>
<html>
<head>
 <title>Export Data Kuisioner - <?php echo $NT;?></title>
</head>
<body>
 <style type="text/css">
 body{
  font-family: sans-serif;
 }
 table{
  margin: 20px auto;
  border-collapse: collapse;
 }
 table th,
 table td{
  border: 1px solid #3c3c3c;
  padding: 3px 8px;

 }
 a{
  background: blue;
  color: #fff;
  padding: 8px 10px;
  text-decoration: none;
  border-radius: 2px;
 }
 </style>

 <?php
 header("Content-type: application/vnd-ms-excel");
 header("Content-Disposition: attachment; filename=$NT.xls");
 ?>

 <center>
  <h1> <?php echo strtoupper("Data Kuisioner Tracert Study ".$NT);?><br/>
  https://www.upnvj.ac.id/id.html</h1>
 </center>
<?php

$sql="select * from `".$NT."`";
$result = mysqli_query($conn,$sql);
$jc=mysqli_num_fields($result);


$gab="<table border='1'><tr><th>No</th>";
for($i=1;$i<$jc;$i++){
 $colObj = mysqli_fetch_field_direct($result,$i);                         
 $col= $colObj->name;
 $ar[$i-1]=$col;
 $gab.="<th>$col</th>";
}
$gab.="</tr>";

$sql="select * from `".$NT."` order by `".$PK."` asc";
  $jum=getJum($conn,$sql);
  if($jum > 0){
  $arr=getData($conn,$sql);
  $no=1;
  foreach($arr as $d) {
   $gab.="<tr><td>$no</td>";
   for($i=1;$i<$jc;$i++){
    $v=$ar[$i-1];
    $data=$d["$v"];
    $gab.="<td>$data</td>";
   }//for
   $gab.="</tr>";
   $no++;
  }//foreach
  }//jum
 else{
  $gab.="<tr colspan='$jc'>data belum tersedia</tr>";
}
$gab.="</table>";

echo $gab;
?>

</body>
</html>




<?php
$tanggal=date("Y-m-d");
$LAT1=-6.306187;
$LON1=106.873144;
$uri = $_SERVER['REQUEST_URI'];
//echo $uri; // Outputs: URI
$protocol = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || $_SERVER['SERVER_PORT'] == 443) ? "https://" : "http://";
// echo"<hr>";
$url = $protocol . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
//echo $url; // Outputs: Full URL
 //echo"<hr>";
$query = $_SERVER['QUERY_STRING'];
//echo $query; // Outputs: Query String
 //echo"<hr>";
$cari="index.php?".$query;
$PATH=str_replace($cari,"",$url);
//echo $PATH;
?>
    <link rel="stylesheet" href="https://unpkg.com/leaflet@1.6.0/dist/leaflet.css" integrity="sha512-xwE/Az9zrjBIphAcBb3F6JVqxf46+CDLwfLMHloNu6KEQCAWi6HcDUbeOfBIptF7tcCzusKFjFw2yuvEpDL9wQ==" crossorigin=""/>
    <script src="https://unpkg.com/leaflet@1.6.0/dist/leaflet.js" integrity="sha512-gZwIG9x3wUXg2hdXF6+rVkLF/0Vi9U8D2Ntg4Ga5I5BZpVkVxlJWbSQtXPSiUTtC0TjtGOmxa1AJPuV0CPthew==" crossorigin=""></script>


<div id="mapid" style="width: 100%; height: 600px;"></div>
<script>
//-6.356602, 106.831307
//http://localhost/webtracking_pedagang/dir/direction/?lat1=5.022020&lon1=96.095108&lat2=5.121929&lon2=96.253036


var mymap = L.map('mapid').setView([<?php echo $LAT1;?>, <?php echo $LON1;?>], 13);
//andree:pk.eyJ1IjoiYW5kcmUzMjE3OTgiLCJhIjoiY2tia3VmcnczMTJzZzJubHRqdWk1aHozbyJ9.br1i2UWx5I-4AZGuUUoqxw
//default:pk.eyJ1IjoibWFwYm94IiwiYSI6ImNpejY4NXVycTA2emYycXBndHRqcmZ3N3gifQ.rJcFIG214AriISLbB6B5aw
L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token=pk.eyJ1IjoiYW5kcmUzMjE3OTgiLCJhIjoiY2tia3VmcnczMTJzZzJubHRqdWk1aHozbyJ9.br1i2UWx5I-4AZGuUUoqxw', {
maxZoom: 18,
attribution: 'Map data &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> contributors, ' +
'<a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>, ' +
'Imagery © <a href="https://www.mapbox.com/">Mapbox</a>',
id: 'mapbox/streets-v11',
tileSize: 512,
zoomOffset: -1
}).addTo(mymap);

//
L.marker([<?php echo $LAT1;?>, <?php echo $LON1;?>]).addTo(mymap).bindPopup("<b>Hello UHAMKA!</b><br />Saya Ada di UHAMKA.").openPopup();

//var myIcon = L.divIcon({className: 'Emoji sunglasses'});
// you can set .my-div-icon styles in CSS
//L.marker([-6.306187, 106.873144], {icon: myIcon}).addTo(map);


L.circle([<?php echo $LAT1;?>, <?php echo $LON1;?>], 1000, {
color: 'yellow',
fillColor: '#fafa03',
fillOpacity: 0.5
}).addTo(mymap).bindPopup("Ini WIlayah Radius UHAMKA");

<?php 
  $sql="select * from `$tbtracking` where `tanggal`<='$tanggal'  group by `id_pedagang` order by id_tracking desc";
  $arr=getData($conn,$sql);
foreach($arr as $d) {
$id_tracking=$d["id_tracking"];
$jam=$d["jam"];
$latitude=$d["latitude"];
$longitude=$d["longitude"];
$id_pedagang=$d["id_pedagang"];

$LINK=$PATH."dir/direction/?lat1=$LAT1&lon1=$LON1&lat2=$latitude&lon2=$longitude";
//$LINK="?mnu=dir&lat1=$LAT1&lon1=$LON1&lat2=$latitude&lon2=$longitude";

$sql2="select `nama_pedagang`,`telepon` from `$tbpedagang` where `id_pedagang`='$id_pedagang'";
$d2=getField($conn,$sql2);
$nama_pedagang=$d2["nama_pedagang"];
$telepon=$d2["telepon"];
$gab="";
$sql3="select `id_produk`,`nama_produk` from `$tbproduk` where `id_pedagang`='$id_pedagang' and `status`='Tersedia'";
$jum3=getJum($conn,$sql3);
if($jum3 > 0){
$arr3=getData($conn,$sql3);
foreach($arr3 as $d3) {
$id_produk=$d3["id_produk"];
$nama_produk=$d3["nama_produk"];
$gab.="$nama_produk, ";
}//foreach
$gab=substr($gab,0,strlen($gab)-2);
}//jum3
else{
$gab="Tidak Ada Produk di jual...";
}
$info="$nama_pedagang ($telepon)";
$jual="Produk: $gab <a href='$LINK'>direction</a>";


?>

L.marker([<?php echo $latitude;?>, <?php echo $longitude;?>]).addTo(mymap).bindPopup("<b><?php echo $info;?></b><br /><?php echo $jual;?>");//.openPopup();

<?php
}//while
?>

var popup = L.popup();

function onMapClick(e) {
popup
.setLatLng(e.latlng)
.setContent("You clicked the map at " + e.latlng.toString())
.openOn(mymap);
}

mymap.on('click', onMapClick);

</script>



</body>
</html>



<!DOCTYPE html>
<html>
  <body>
    <!-- 1. The <iframe> (and video player) will replace this <div> tag. -->
    <div id="player"></div>

    <script>
      // 2. This code loads the IFrame Player API code asynchronously.
      var tag = document.createElement('script');
      tag.src = "https://www.youtube.com/AIzaSyAKM239U9OdNjTeEExilchlN7gJQf_-IhU";
      var firstScriptTag = document.getElementsByTagName('script')[0];
      firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

      // 3. This function creates an <iframe> (and YouTube player)
      //    after the API code downloads.
      var player;
      function onYouTubeIframeAPIReady() {
        player = new YT.Player('player', {
          height: '390',
          width: '640',
          videoId: 'M7lc1UVf-VE',
          events: {
            'onReady': onPlayerReady,
            'onStateChange': onPlayerStateChange
          }
        });
      }

      // 4. The API will call this function when the video player is ready.
      function onPlayerReady(event) {
        event.target.playVideo();
      }

      // 5. The API calls this function when the player's state changes.
      //    The function indicates that when playing a video (state=1),
      //    the player should play for six seconds and then stop.
      var done = false;
      function onPlayerStateChange(event) {
        if (event.data == YT.PlayerState.PLAYING && !done) {
          setTimeout(stopVideo, 6000);
          done = true;
        }
      }
      function stopVideo() {
        player.stopVideo();
      }
    </script>
  </body>
</html>

<iframe id="player" type="text/html" width="640" height="390"
  src="http://www.youtube.com/embed/M7lc1UVf-VE?enablejsapi=1&origin=http://example.com"
  frameborder="0"></iframe>

Tidak ada komentar:

Posting Komentar

global_priv WARNING Selalu

 Jika muncul pesan kesalahan: Warning in .\libraries\classes\Dbal\DbiMysqli.php#209  mysqli::query(): (HY000/1034): Index for table 'glo...