Kamis, 30 Oktober 2025
Kamis, 25 Februari 2021
Selasa, 16 Februari 2021
Install ISPCONFIG on Debian
apt-get update && apt-get upgrade
apt-get install unzip
cd /tmp
wget --no-check-certificate https://github.com/servisys/ispconfig_setup/archive/master.zip
unzip master.zipcd ispconfig_setup-master/
./install.sh1. Initially, we login as a root user and find the ISPConfig config file that contains MySQL information.
cat /usr/local/ispconfig/server/lib/mysql_clientdb.confThe result looks like,
$conf['db_database'] = 'dbispconfig';
$clientdb_host = ‘localhost’;
$clientdb_user = ‘root’;
$clientdb_password = ‘Password’;
2. After that, we log into the MySQL server from the command line with the information extracted from mysql_clientdb.conf. This helps us to confirm that the password actually works.
mysql -h localhost -p dbispconfig3. Then we set this password in the MySQL database by running:
UPDATE sys_user SET passwort = md5('YourNewPassword') WHERE username = 'admin';
FLUSH PRIVILEGES;
quit;5. Finally, restart MySQL service.
Senin, 04 Januari 2021
AES128bit
sumber :
http://adammaus.com/wp/2012/11/rijndael-encryption-and-decryption-vb-net-php-python/
VB.NET
' Keys required for Symmetric encryption / decryption
Dim rijnKey As Byte() = {&H1, &H2, &H3, &H4, &H5, &H6, &H7, &H8, &H9, &H10, &H11, &H12, &H13, &H14, &H15, &H16}
Dim rijnIV As Byte() = {&H1, &H2, &H3, &H4, &H5, &H6, &H7, &H8, &H9, &H10, &H11, &H12, &H13, &H14, &H15, &H16}
Function Decrypt(S As String)
If S = "" Then
Return S
End If
' Turn the cipherText into a ByteArray from Base64
Dim cipherText As Byte()
Try
' Replace any + that will lead to the error
cipherText = Convert.FromBase64String(S.Replace("BIN00101011BIN", "+"))
Catch ex As Exception
' There is a problem with the string, perhaps it has bad base64 padding
Return S
End Try
'Creates the default implementation, which is RijndaelManaged.
Dim rijn As SymmetricAlgorithm = SymmetricAlgorithm.Create()
Try
' Create the streams used for decryption.
Using msDecrypt As New MemoryStream(cipherText)
Using csDecrypt As New CryptoStream(msDecrypt, rijn.CreateDecryptor(rijnKey, rijnIV), CryptoStreamMode.Read)
Using srDecrypt As New StreamReader(csDecrypt)
' Read the decrypted bytes from the decrypting stream and place them in a string.
S = srDecrypt.ReadToEnd()
End Using
End Using
End Using
Catch E As CryptographicException
Return S
End Try
Return S
End Function
Function Encrypt(S As String)
'Creates the default implementation, which is RijndaelManaged.
Dim rijn As SymmetricAlgorithm = SymmetricAlgorithm.Create()
Dim encrypted() As Byte
Using msEncrypt As New MemoryStream()
Dim csEncrypt As New CryptoStream(msEncrypt, rijn.CreateEncryptor(rijnKey, rijnIV), CryptoStreamMode.Write)
Using swEncrypt As New StreamWriter(csEncrypt)
'Write all data to the stream.
swEncrypt.Write(S)
End Using
encrypted = msEncrypt.toArray()
End Using
' You cannot convert the byte to a string or you will get strange characters so base64 encode the string
' Replace any + that will lead to the error
Return Convert.ToBase64String(encrypted).Replace("+", "BIN00101011BIN")
End Function
PHP
$rijnKey = "\x1\x2\x3\x4\x5\x6\x7\x8\x9\x10\x11\x12\x13\x14\x15\x16";
$rijnIV = "\x1\x2\x3\x4\x5\x6\x7\x8\x9\x10\x11\x12\x13\x14\x15\x16";
function Decrypt($s){
global $rijnKey, $rijnIV;
if ($s == "") { return $s; }
// Turn the cipherText into a ByteArray from Base64
try {
$s = str_replace("BIN00101011BIN", "+", $s);
$s = base64_decode($s);
$s = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $rijnKey, $s, MCRYPT_MODE_CBC, $rijnIV);
} catch(Exception $e) {
// There is a problem with the string, perhaps it has bad base64 padding
// Do Nothing
}
return $s;
}
function Encrypt($s){
global $rijnKey, $rijnIV;
// Have to pad if it is too small
$block = mcrypt_get_block_size(MCRYPT_RIJNDAEL_128, 'cbc');
$pad = $block - (strlen($s) % $block);
$s .= str_repeat(chr($pad), $pad);
$s = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $rijnKey, $s, MCRYPT_MODE_CBC, $rijnIV);
$s = base64_encode($s);
$s = str_replace("+", "BIN00101011BIN", $s);
return $s;
}
Senin, 21 Desember 2020
ajax fill from json
contoh 1
function loadbrg(id,vnd){
document.forms['fmedit'].querySelectorAll('input[name^="a"]').forEach(function(el){el.value='';});
$("#modaledit").modal();
//if(id==0)document.forms['fmtarget'].querySelectorAll('input[name^="a"]').forEach(function(el){el.value=el.name;});
if(id==0)return;
var oTXT=document.forms['fmedit'].querySelectorAll('input[name^="a"]');
$.post("?act=loadbrg&id="+id+"&vnd="+vnd).done(function(response){
console.log(response);
$.each(oTXT, function( key, value ) {
var otxt=value.name.replace('a[','').replace(']','');
value.value=response[otxt];
//console.log(key+"="+value.value+"->"+otxt);
});
});
}
contoh 2
var fmtarget=document.forms['fmpopup'];
fmtarget.querySelectorAll('input').forEach(function(el){el.value='';});
$.post("?act=loadlembar",{idobj:idobj}).done(function(response){
console.log(response);
$.each(response, function( key, value ) {
try {
fmtarget["a["+key+"]"].value=value;
}
catch(err) {console.log("a["+key+"]"+err.message);}
});
});
Selasa, 10 November 2020
Popup Submit
document.getElementById("btnsumbit").addEventListener("click",function(){
$('#popup').modal('hide');
$.post("?act=save",$(this.form).serialize()).done(function(response){
console.log(response);
if(response.split("<<<")[1]==" reload ")location.reload(true);
});
event.preventDefault();
});
fmtarget.querySelectorAll('input[type=text]').forEach(function(el){
console.log(el.name);
el.value='';
});
Rabu, 04 November 2020
Falidate Form
function validateForm() {
var ct=0;
var inputs=document.getElementsByTagName("input");
for (i = 0; i < inputs.length; i++) {
try{
if(inputs[i].value == '' && inputs[i].title.toLowerCase() == 'penting') {
ct = 1;
inputs[i].style.background= "blue";
}
}catch(e){}
}
if (ct != 0) {
alert("Yang Berwarna kuning harus di isi");
return false;
}
}
x = document.querySelectorAll(".example");
for (i = 0; i < x.length; i++) {
x[i].style.backgroundColor = "red";
}
Selasa, 03 November 2020
HTML Basic
HTML Check Checked
dd
Kamis, 22 Oktober 2020
Rabu, 07 Oktober 2020
Upload file using VB.NET and PHP
VB COde
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Using wc As New System.Net.WebClient()
wc.UploadFile("http://apps.pastioke.com/info.php", "x:\wa.php")
End Using
End Sub
PHP CODE
<?
if($_FILES){
$myfile = fopen("newfile.txt", "w") or die("Unable to open file!");
$txt = print_r($_FILES, true);
$target_file = 'ff.txt';
move_uploaded_file($_FILES["file"]["tmp_name"], $target_file);
fwrite($myfile, $txt);
$txt = print_r($_GET);
fwrite($myfile, $txt);
fclose($myfile);
}
?>
s
Minggu, 04 Oktober 2020
Little Javascript Trick
Move Document to End (Scroll to end)
window.scrollTo(0,document.body.scrollHeight);
Rabu, 30 September 2020
Javascript event listener on all class
const divs = document.querySelectorAll('.hitung');
or
const divs = document.querySelector('button[type="submit"]');
divs.forEach(el => el.addEventListener('keyup', event => {
var fm=el.form;
fm['a[harga1]'].value=fm["a[bruto]"].value - (fm["a[diskon1]"].value * fm["a[bruto]"].value / 100);
fm['a[harga2]'].value=fm["a[harga1]"].value - (fm["a[diskon2]"].value * fm["a[harga1]"].value / 100);
fm['a[harga3]'].value=fm["a[harga2]"].value - (fm["a[diskon3]"].value * fm["a[harga2]"].value / 100);
fm['a[harga]'].value=fm['a[harga3]'].value;
event.preventDefault();
//console.log(event.target.classList[1]);
}));
Minggu, 27 September 2020
Ajax JSON to fill form
form to display data
code to load data
code to display
Minggu, 13 September 2020
PHP Menghitung sisa waktu mengerjakan CBT
$mulai=explode(":",$logtugas->jammulai)[0]*3600 + explode(":",$logtugas->jammulai)[1]*60 + explode(":",$logtugas->jammulai)[2]*1;
$sekarang=date("H")*3600 + date("i")*60 + date("s")*1;
$akhir=$mulai*1 + ($logtugas->durasi*60) ;
$sisawaktu=$akhir*1 - $sekarang*1;
Senin, 07 September 2020
Let's encrypt Wilcard ssl on Centos 7
yum install epel-release
yum install yum-utils
yum install python2-certbot-apache
yum install python2-certbot-nginx
certbot certonly --manual -d *.easyware.id -d easyware.id --agree-tos --manual-public-ip-logging-ok --preferred-challenges dns-01 --server https://acme-v02.api.letsencrypt.org/directory
certbot certonly --manual -d *.pastioke.com --agree-tos --manual-public-ip-logging-ok --preferred-challenges dns-01 --server https://acme-v02.api.letsencrypt.org/directory --register-unsafely-without-email
key
/etc/letsencrypt/live/easyware.id/privkey.pem
cert atas // CA bundle bawah
/etc/letsencrypt/live/easyware.id/fullchain.pem
Selasa, 25 Agustus 2020
Query Select Left Join with sum
a
b
Rabu, 12 Agustus 2020
VBA Excel Macro - Create List a to z
a'''
Sub u()
ichr = Asc("a")
For i = 0 To 26
Cells(i, 1) = Chr(ichr + i)
'---------------------------------------------
'USER ACTION
' Your letter is stored in the variable Letter.
' Do what you want with it here.
' For example: Range("A" & i) = Letter
'---------------------------------------------
Next i
End Sub
v
Sabtu, 01 Agustus 2020
Radio Button Event Handler
var rad = document.myForm.myRadios;
var prev = null;
for (var i = 0; i < rad.length; i++) {
rad[i].addEventListener('change', function() {
(prev) ? console.log(prev.value): null;
if (this !== prev) {
prev = this;
}
console.log(this.value)
});
}<form name="myForm">
<input type="radio" name="myRadios" value="1" />
<input type="radio" name="myRadios" value="2" />
</form>Rabu, 29 Juli 2020
Give All Form Input Same Class
Sabtu, 25 Juli 2020
href confirmation
<a href="delete.php?id=22" onclick="return confirm('Are you sure?')">Link</a><a href="delete.php?id=22" onclick="return confirm('Are you sure?')">Link</a><button onclick="if(confirm('Are you sure?')) saveandsubmit(event);"></button>
atau
<button onclick="return confirm('Are you sure?')?saveandsubmit(event):'';"></button>






