<?php
// Define the parameters for the shell command
$location = "\\pc-share\Downloads";
$user = "administrator";
$pass = "password";
$letter = "Z";
// Map the drive
system("net use ".$letter.": \"".$location."\" ".$pass." /user:".$user." /persistent:no>nul 2>&1");
// Open the directory
$dir = opendir($letter.":/tes");
$files = scandir($letter.":/tes", 0);
$n = 0;
for($i = 2; $i < count($files); $i++){
$n++;
//if($n%2==0){echo $n;}
echo $files[$i]."</BR> ";
}
?>
Wednesday, February 3, 2016
Thursday, January 7, 2016
Listbox PHP value dari MYSQL
<?php
$koneksi_db = mysql_connect("localhost", "root", ""); //membuka koneksi ke database
mysql_select_db("db_hclab", $koneksi_db); //proses masuk ke database
$sql = "
SELECT
`tbl_getdata`.`instrument_id`
FROM
`tbl_getdata`
GROUP BY
`tbl_getdata`.`instrument_id`
";
$query = mysql_query($sql);
?>
<select class="form-control" name="id_kategori">
<option value=""></option>
<?php
while($hasil = mysql_fetch_array($query)){
?>
<option value="<?php echo $hasil["instrument_id"];?>"><?php echo $hasil["instrument_id"];?></option>
<?php
}
?>
</select>
$koneksi_db = mysql_connect("localhost", "root", ""); //membuka koneksi ke database
mysql_select_db("db_hclab", $koneksi_db); //proses masuk ke database
$sql = "
SELECT
`tbl_getdata`.`instrument_id`
FROM
`tbl_getdata`
GROUP BY
`tbl_getdata`.`instrument_id`
";
$query = mysql_query($sql);
?>
<select class="form-control" name="id_kategori">
<option value=""></option>
<?php
while($hasil = mysql_fetch_array($query)){
?>
<option value="<?php echo $hasil["instrument_id"];?>"><?php echo $hasil["instrument_id"];?></option>
<?php
}
?>
</select>
Wednesday, January 6, 2016
Format Tanggal di PHP
<?php
$tanggal = "2016-01-01";
echo date("d F Y", strtotime($tanggal)); // 01 January 2016
echo "<BR>";
echo date("F j, Y, g:i a", strtotime($tanggal)); // January 1, 2016, 12:00 am
echo "<BR>";
echo date("m.d.y", strtotime($tanggal)); // 01.01.16
echo "<BR>";
echo date("j, n, Y, strtotime($tanggal)"); // 6, 1, 2016, 2731Wed, 06 Jan 2016 11:12:27 +0700312016311201Asia/Jakarta(2016-01-01)
echo "<BR>";
echo date("Ymd", strtotime($tanggal)); // 20160101
echo "<BR>";
echo date('h-i-s, j-m-y, it is w Day', strtotime($tanggal)); // 12-00-00, 1-01-16, 0031 0000 5 Friam16
echo "<BR>";
echo date('\i\t \i\s \t\h\e jS \d\a\y.', strtotime($tanggal)); // it is the 1st day.
echo "<BR>";
echo date("D M j G:i:s T Y", strtotime($tanggal)); // Fri Jan 1 0:00:00 WIB 2016
echo "<BR>";
echo date('H:m:s \m \i\s\ \m\o\n\t\h', strtotime($tanggal)); // 00:01:00 m is month
echo "<BR>";
echo date("H:i:s", strtotime($tanggal)); // 00:00:00
echo "<BR>";
echo date("Y-m-d H:i:s", strtotime($tanggal)); // 2016-01-01 00:00:00
?>
$tanggal = "2016-01-01";
echo date("d F Y", strtotime($tanggal)); // 01 January 2016
echo "<BR>";
echo date("F j, Y, g:i a", strtotime($tanggal)); // January 1, 2016, 12:00 am
echo "<BR>";
echo date("m.d.y", strtotime($tanggal)); // 01.01.16
echo "<BR>";
echo date("j, n, Y, strtotime($tanggal)"); // 6, 1, 2016, 2731Wed, 06 Jan 2016 11:12:27 +0700312016311201Asia/Jakarta(2016-01-01)
echo "<BR>";
echo date("Ymd", strtotime($tanggal)); // 20160101
echo "<BR>";
echo date('h-i-s, j-m-y, it is w Day', strtotime($tanggal)); // 12-00-00, 1-01-16, 0031 0000 5 Friam16
echo "<BR>";
echo date('\i\t \i\s \t\h\e jS \d\a\y.', strtotime($tanggal)); // it is the 1st day.
echo "<BR>";
echo date("D M j G:i:s T Y", strtotime($tanggal)); // Fri Jan 1 0:00:00 WIB 2016
echo "<BR>";
echo date('H:m:s \m \i\s\ \m\o\n\t\h', strtotime($tanggal)); // 00:01:00 m is month
echo "<BR>";
echo date("H:i:s", strtotime($tanggal)); // 00:00:00
echo "<BR>";
echo date("Y-m-d H:i:s", strtotime($tanggal)); // 2016-01-01 00:00:00
?>
Tuesday, January 5, 2016
MYSQL - Mengelompokkan Berdasarkan Tanggal Pada format DATETIME
SELECT
date(`tbl_getdata`.`created_dt`)
FROM
`tbl_getdata`
GROUP BY
date(`tbl_getdata`.`created_dt`);
date(`tbl_getdata`.`created_dt`)
FROM
`tbl_getdata`
GROUP BY
date(`tbl_getdata`.`created_dt`);
Menampilkan Daftar Tanggal di Antara Dua Tanggal
<?php
// Start date
$tanggal_awal = '2016-01-01';
// End date
$tanggal_akhir = '2016-02-31';
while (strtotime($tanggal_awal) <= strtotime($tanggal_akhir)) {
echo "$tanggal_awal<BR>";
$tanggal_awal = date ("Y-m-d", strtotime("+1 day", strtotime($tanggal_awal)));
}
?>
// Start date
$tanggal_awal = '2016-01-01';
// End date
$tanggal_akhir = '2016-02-31';
while (strtotime($tanggal_awal) <= strtotime($tanggal_akhir)) {
echo "$tanggal_awal<BR>";
$tanggal_awal = date ("Y-m-d", strtotime("+1 day", strtotime($tanggal_awal)));
}
?>
Subscribe to:
Posts (Atom)