Skip to content

Instantly share code, notes, and snippets.

View ammaridris's full-sized avatar

Ammar Idris ammaridris

View GitHub Profile
@ammaridris
ammaridris / mykad_paparan.php
Last active December 31, 2021 11:13
Paparan Maklumat Tarikh Lahir, Umur, Negeri & Jantina Daripada Kad Pengenalan Menggunakan PHP
<?php
$no_ic = 871118077020; //CONTOH NO IC 871118077020
$tmp_hari = substr($no_ic,4,2);
$tmp_bulan = substr($no_ic,2,2);
$tmp_tahun = substr($no_ic,0,2);
$tmp_negeri = substr($no_ic,6,2);
$tmp_jantina = substr($no_ic,11,1);
//TARIKH LAHIR//////////////////////////////////////
@ammaridris
ammaridris / tarikh_hijri.php
Created February 13, 2016 02:20
Paparan Tarikh Hijri Menggunakan PHP
<?php
$bulan_masihi=date('m');
$hari_masihi=date('d'); //Boleh +-
$tahun_masihi=date('Y');
if (($tahun_masihi>1582)||(($tahun_masihi==1582)&&($bulan_masihi>10))||(($tahun_masihi==1582)&&($bulan_masihi==10)&&($hari_masihi>14)))
{
$zjd=(int)((1461*($tahun_masihi + 4800 + (int)( ($bulan_masihi-14) /12) ))/4) + (int)((367*($bulan_masihi-2-12*((int)(($bulan_masihi-14)/12))))/12)-(int)((3*(int)(( ($tahun_masihi+4900+(int)(($bulan_masihi-14)/12))/100)))/4)+$hari_masihi-32075;
}
else
@ammaridris
ammaridris / borang_maklumbalas_recaptcha2.php
Last active February 14, 2016 05:18
Borang Maklum Balas dengan Google reCAPTCHA 2
<?php
//boleh download di https://code.google.com/archive/p/recaptcha/downloads
//atau https://gist.github.com/ammaridris/94ac9db2ec6b50f3e571
require_once('recaptchalib.php');
//Kena generate ikut domain https://www.google.com/recaptcha/admin#createsite
$secret = "6Ld0OhgTAAAAADe872-FO9Vhcj5wLi9dYFZ2Pqcq";
$response = null;
$reCaptcha = new ReCaptcha($secret);
@ammaridris
ammaridris / recaptchalib.php
Created February 14, 2016 05:14
Borang Maklum Balas dengan Google reCAPTCHA 2 - recaptchalib
<?php
/**
* This is a PHP library that handles calling reCAPTCHA.
* - Documentation and latest version
* https://developers.google.com/recaptcha/docs/php
* - Get a reCAPTCHA API Key
* https://www.google.com/recaptcha/admin/create
* - Discussion group
* http://groups.google.com/group/recaptcha
*
@ammaridris
ammaridris / backup_mysql.php
Last active February 16, 2016 06:34
Backup MySQL Menggunakan PHP
<?php
db_backup('hostname','user','password','namadb');
function db_backup($host,$user,$pass,$namadb,$tables = '*')
{
$link = mysql_connect($host,$user,$pass);
mysql_select_db($namadb,$link);
if($tables == '*')
{
@ammaridris
ammaridris / backup_task.bat
Created February 16, 2016 06:34
Backup MySQL Menggunakan Windows Scheduled Tasks
@echo off
set month=%date:~3,2%
set day=%date:~0,2%
set year=%date:~6,4%
set Srcdir="C:\apps\mysql\data"
set Dstdir="D:\Backup"
echo %year%
xcopy %Srcdir% %Dstdir%\%month%-%day%-%year%-backup\mysqldata\ /h/k/i/s/y
<?xml version="1.0" encoding="utf-8"?>
<extension type="module" method="upgrade" client="">
<name>Borang Maklum Balas</name>
<creationDate>September 2016</creationDate>
<author>Ammar Idris</author>
<authorEmail>ammaridris@gmail.com</authorEmail>
<authorUrl>http://www.ammaridris.com</authorUrl>
<copyright>Copyright © 2016 - All rights reserved.</copyright>
<license>GNU General Public License v2.0</license>
<version>1</version>
<?php
defined('_JEXEC') or die;
if(!empty($_REQUEST['act'])) {
$act = $_REQUEST['act'];
$nama = $_REQUEST['nama'];
$email = $_REQUEST['email'];
$phone = $_REQUEST['phone'];
$mesej = $_REQUEST['mesej'];
$soalan = $_REQUEST['soalan'];
$mesej = stripcslashes($mesej);
<h1>jQuery & CSS3 Skills Bar</h1>
<div class="skillbar clearfix " data-percent="20%">
<div class="skillbar-title" style="background: #d35400;"><span>HTML5</span></div>
<div class="skillbar-bar" style="background: #e67e22;"></div>
<div class="skill-bar-percent">20%</div>
</div> <!-- End Skill Bar -->
<div class="skillbar clearfix " data-percent="25%">
<div class="skillbar-title" style="background: #2980b9;"><span>CSS3</span></div>
body {
font-family: 'Ubuntu', sans-serif;
width:960px;
}
p{
color:#525252;
font-size:12px;
}