Guest User

Aplikasi Al Quran Digital Dgn PHP

a guest
Dec 22nd, 2015
1,182
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html >
  3. <head>
  4. <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  5. <meta name="google" value="notranslate">
  6. <title>Al Quran</title>
  7. <style>
  8.  
  9. @font-face {
  10.   font-family: 'Uthmani';
  11.   src : url('http://localhost/alquran/sources/font/UthmanicHafs1 Ver09.otf') format('truetype');
  12. }
  13.  
  14. h3{
  15.   background:#222;
  16.   color:#f9f9f9;
  17.    padding:5px;
  18. }
  19.  
  20. .arabic{
  21.     font-family: 'Uthmani', serif;
  22.     font-size: 28px; font-weight: normal;
  23.     direction:rtl;
  24.     padding : 0 5px;
  25.     margin : 0;
  26. }
  27. .arabic_number {
  28.     font-size: 28px; font-weight: normal;
  29. }
  30. .arabic_center{
  31.     font-family: 'Uthmani', serif;
  32.     font-size: 28px; font-weight: normal;
  33.     text-align:center;
  34.     padding : 0 5px;
  35.     margin : 0;
  36. }
  37. .latin {
  38.     font-family: serif;
  39.     font-size: 14px; font-weight: normal;
  40.     direction:ltr;
  41.     padding : 0;
  42.     margin : 0;
  43. }
  44.  
  45. </style>
  46.  </head>
  47. <body>
  48. <?php
  49. $surat = isset($_GET['surat']) ? $_GET['surat'] : 0;
  50. $nama = isset($_GET['nama']) ? $_GET['nama'] : '';
  51. if($surat == 0)
  52.     show_daftar();
  53. else
  54.     show_quran($surat, $nama);
  55.  
  56. function show_daftar(){
  57.     mb_internal_encoding('UTF-8');
  58.     $data = database("SELECT `index`, surat_indonesia, arti, jumlah_ayat FROM DaftarSurat");
  59.     echo '<table>';
  60.     echo '<tr><th>No.</th><th>Surah</th><th>Arti</th><th>Juml.Ayat</th></tr>';
  61.     foreach($data as $d){
  62.         echo '<tr><td>'.$d['index'].'</td><td><a href="http://localhost/alquran/index.php?surat='.$d['index'].'&nama='.$d['surat_indonesia'].'">'.$d['surat_indonesia'].'</a></td><td>'.$d['arti'].'</td></td><td>'.$d['jumlah_ayat'].'</td></tr>';
  63.     }
  64.     echo '</table>';
  65. }
  66. function show_quran($surat, $nama=''){ 
  67.     mb_internal_encoding('UTF-8');
  68.     if (($surat < 1) || ($surat > 114)) exit;
  69.     echo '<p><a href="http://localhost/alquran">Kembali ke Index</a></p>';
  70.     echo '<h3>'.$nama.'</h3>';
  71.     if($surat > 1) {
  72.         echo '<p class ="arabic_center">'.mb_strtolower('بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ').'</p>';
  73.         echo '<hr />';
  74.     }
  75.  
  76.     $data = database("SELECT A.text as arabic, B.text as indonesia FROM ArabicQuran A LEFT OUTER JOIN IndonesianQuran B ON A.index=B.index WHERE A.surat = $surat");
  77.  
  78.     $ayat = 1;
  79.     foreach($data as $d){
  80.             $str = mb_strtolower($d['arabic']);
  81.         echo '<p class ="arabic">'. $str .' ﴿'.format_arabic_number($ayat).'﴾</p>';
  82.         echo '<p class ="latin">'.'['.$ayat.'] '.$d['indonesia'] .'</p>';
  83.         echo '<hr />';
  84.         $ayat++;
  85.     }
  86.     echo '<p><a href="http://localhost/alquran">Kembali ke Index</a></p>';
  87. }
  88.  
  89. function database($sql){
  90.     $db = new mysqli("localhost", "root", "", "quran");
  91.     if($db->connect_errno > 0){
  92.             die('Unable to connect to database [' . $db->connect_error . ']');
  93.     }
  94.     $db->query("SET NAMES 'utf8'");
  95.     $db->query('SET CHARACTER SET utf8');
  96.  
  97.     if(!$result = $db->query($sql)){
  98.             die('There was an error running the query [' . $db->error . ']');
  99.     }
  100.        
  101.     $return = array();
  102.     while($row = $result->fetch_array()){
  103.             $return[] = $row;
  104.     }
  105.     $result->free();
  106.     $db->close();
  107.     return $return;
  108. }
  109.  
  110. function format_arabic_number($number){
  111.     $arabic_number = array('٠','١','٢','٣','٤','٥','٦','٧','٨','٩');
  112.     $jum_karakter = strlen($number);
  113.     $temp = "";
  114.     for($i = 0; $i < $jum_karakter; $i++){
  115.         $char = substr($number, $i, 1);
  116.         $temp .= $arabic_number[$char];
  117.     }
  118.     return '<span class="arabic_number">'.$temp.'</span>';
  119. }
  120.  
  121. ?>
  122. </body>
  123. </html>
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×