The Joomla! Forum ™






Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: ambil session di joomla
PostPosted: Tue Jul 03, 2012 4:58 am 
Joomla! Fledgling
Joomla! Fledgling

Joined: Tue Jul 03, 2012 4:48 am
Posts: 3
siang master ane mau tanya cara mengambil sesson di joomla
temen dulu pernah buatin php, kalau di hostingan jalan normal cuma pas di co ba di localhost kenapa gak mau ya

ini beberapa sampelnya, di joomlanya menggunakan fasilitas wrapper

Code:
<?php include"../getsess.php"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Transkrip Nilai</title>
<style type="text/css">
<!--
a {
   color: #126bf1;
   text-decoration: none;
}

a:hover, a:active, a:focus {
   color: #000;
}
a img {
   border: none;
}
.judul {
   border-left : 1px solid #000000;
   text-align: center;
   border-right : 1px solid #000000;
   border-top : 1px solid #000000;
}
.kode {
   text-align: center;
   border-right : 1px solid #000000;
   border-top : 1px solid #000000;
}
.nilai {
   text-align: center;
   border-right : 1px solid #000000;
   border-top : 1px solid #000000;
}
.xxx {
   border-top : 1px solid #000000;
}
.sks {
   text-align: center;
   border-right : 1px solid #000000;
   border-top : 1px solid #000000;
}
.bobot {
   text-align: center;
   border-right : 1px solid #000000;
   border-top : 1px solid #000000;
}
.bobot2 {
   text-align: center;
   border-right : 1px solid #000000;
   border-top : 1px solid #000000;
   border-bottom : 1px solid #000000;
}
.jip {
   text-align: left;
   border-right : 1px solid #000000;
   border-top : 1px solid #000000;
}
.jip2 {
   text-align: left;
   border-right : 1px solid #000000;
   border-bottom : 1px solid #000000;
   border-top : 1px solid #000000;
}
.namatkul {
   text-align: left;
   border-right : 1px solid #000000;
   border-top : 1px solid #000000;
}
.namatkul2 {
   text-align: left;
   border-right : 1px solid #000000;
   border-bottom : 1px solid #000000;
}
.jm {
   text-align: center;
   border-right : 1px solid #000000;
   border-left : 1px solid #000000;
}
.judul_tebal {
   font-weight: bold;
}
.tabelku{
   border : 1px solid #000000;
   background-color:#FFFFFF;
}
.tabel{
   background-color:#FFFFFF;
}
-->
</style>
</head>

<body>
<table width="100%" border="0" class="tabel">
  <tr>
    <td height="42" colspan="6"><center>
       <img src="logo.png"><br>
       <b>SEKOLAH TINGGI AGAMA ISLAM TASIKMALAYA</b> <br />Jl. Noenoeng Tisna Saputra No.16 Phone & Fax. (0265)331501 Tasikmalaya<br />web</center></td>
  </tr>
  <tr>
    <td colspan="6"><center><b>TRANSKRIP NILAI SEMENTARA</b></center></td>
  </tr>
  <?php
    include"../getsess.php";
    $stai_user=$user->username;
    include"koneksi.php";
    $query="select n.NIM as NIM,n.Kd_matakuliah as Kd_matakuliah,n.Thn_akademik as Thn_akademik,n.Nilai as Nilai,n.Bobot as Bobot,s.Nm_mhs as Nm_mhs,s.Tempat_lahir as Tempat_lahir,s.Tgl_lahir as Tgl_lahir,m.Nm_matakuliah as Nm_matakuliah,m.Semester as Semester,m.SKS as SKS,m.Jurusan as Jurusannya,x.Jurusan as nm_jur,t.Judul_SK_TA,t.Judul_KP,t.Tgl_lulus,t.Thn_akademik from jurusan as x left outer join mata_kuliah as m on m.Jurusan=x.Kode_jurusan left outer join penilaian as n on n.Kd_matakuliah=m.Kd_matakuliah left outer join mahasiswa as s on n.NIM=s.NIM left outer join tugas_akhir as t on n.NIM=t.NIM where s.NIM='$stai_user' order by m.Nm_matakuliah";
    $qnilai=mysql_query($query);
    $data=mysql_fetch_array($qnilai);
    $npm=$data['NIM'];
    $nama=$data['Nm_mhs'];
    $prog=$data['nm_jur'];
    $ta=$data['Judul_SK_TA'];
    $kp=$data['Judul_KP'];
  ?>
  <tr>
    <td colspan="3" valign="top">
    <table width="100%" border="0">
      <tr>
        <td width="42%" valign="top">Nama</td>
        <td width="3%" valign="top">:</td>
        <td width="55%" valign="top"><?php echo"$nama"; ?></td>
      </tr>
      <tr>
        <td valign="top">Nomor Pokok Mahasiswa</td>
        <td valign="top">:</td>
        <td valign="top"><?php echo"$npm"; ?></td>
      </tr>
    </table>
    </td>
    <td width="50%" colspan="3" valign="top">
    <table width="100%" border="0">
      <tr>
        <td width="42%" valign="top">PROGRAM PENDIDIKAN</td>
        <td width="3%" valign="top">:</td>
        <td width="55%" valign="top"><?php echo"$prog"; ?></td>
      </tr>
      <tr>
        <td valign="top">STATUS</td>
        <td valign="top">:</td>
        <td valign="top">TERAKREDITASI BAN-PT</td>
      </tr>
    </table>
    </td>
   
  </tr>
  <tr>
    <td colspan="6">
       <table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr class="judul_tebal">
        <td width="8%" class="judul">No</td>
        <td width="12%" class="kode">Kode</td>
        <td width="46%" class="namatkul">&nbsp;&nbsp;Nama Matakuliah</td>
        <td width="11%" class="nilai">Nilai</td>
        <td width="12%" class="sks">SKS</td>
        <td width="11%" class="bobot">Bobot</td>
      </tr>
      <?php
         $i=1;
         $qmatkul=mysql_query($query);
         while ($datanilai=mysql_fetch_array($qmatkul)){
            $kode=$datanilai['Kd_matakuliah'];
            $namat=$datanilai['Nm_matakuliah'];
            $nilai=$datanilai['Nilai'];
            $sks=$datanilai['SKS'];
            $bobot=$datanilai['Bobot'];
            $cari=",";
             $ganti=".";
             $bot=str_ireplace($cari,$ganti,$bobot);
             $bt=$bot*$sks;
             $tt += $bt;
             $ss += $sks;
      ?>
      <tr>
        <td width="8%" class="judul"><?php echo"$i"; ?></td>
        <td width="12%" class="kode"><?php echo"$kode"; ?></td>
        <td width="46%" class="namatkul">&nbsp;&nbsp;<?php echo"$namat"; ?></td>
        <td width="11%" class="nilai"><?php echo"$nilai"; ?></td>
        <td width="12%" class="sks"><?php echo"$sks"; ?></td>
        <td width="11%" class="bobot"><?php echo"$bt"; ?></td>
      </tr>
      <?php
         $i++;
          }
      ?>
      <tr>
      <?php
         $IPK=$tt/$ss;
         $format_ipk=number_format($IPK,2,'.','.');
      ?>
        <td colspan="3" rowspan="2" valign="top" style="border-right:1px solid #000000;">
           <table width="100%" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td width="31%" class="xxx" >JUDUL TUGAS AKHIR</td>
            <td width="2%" class="xxx">:</td>
            <td width="67%" class="xxx"><?php echo"$kp"; ?></td>
          </tr>
        </table></td>
        <td class="jip" valign="top">&nbsp;&nbsp;Jumlah</td>
        <td class="bobot" valign="top"><?php echo"$ss"; ?></td>
        <td class="bobot" valign="top"><?php echo"$tt"; ?></td>
      </tr>
      <tr>
        <td colspan="2" class="jip2">&nbsp;&nbsp;Indeks Prestasi</td>
        <td class="bobot2"><?php echo"$format_ipk"; ?></td>
      </tr>
      <tr>
        <td colspan="3"
        <table width="100%" border="0" cellpadding="0" cellspacing="0">
          <tr>
            <td width="31%" valign="top">JUDUL KERJA PRAKTEK</td>
            <td width="2%" valign="top">:</td>
            <td width="67%" valign="top"><?php echo"$ta"; ?></td>
          </tr>
        </table>
        </td>
      </tr>
      <tr>
    <td width="100%" colspan="6">
       <table width="100%" border="0">
         <tr>
          <td width="50%" valign="top"><br><br>
             A = 4 = Memuaskan<br>
             B = 3 = Baik<br>
             C = 2 = Cukup<br>
             D = 1 = Kurang<br>
             E = 0 = Tidak Lulus<br>
          </td>
          <td width="50%" valign="top"><br>
             <table width="100%" border="0">
                <tr>
                   <td valign="top" style="text-align:center;">Tasikmalaya,
                      <?php
                         include"tanggal.php";
                         echo $today;
                      ?>
                   </td>
                </tr>
                <tr>
                   <td valign="top" style="text-align:center;">Pembantu Ketua Bidang Akademik
                   </td>
                </tr>
                <tr>
                   <td valign="top" style="text-align:center;" height="100">
                   </td>
                </tr>
                <tr>
                   <td valign="top" style="text-align:center;">Drs. Ana Suryana AS, M.Pd
                   </td>
                </tr>
             </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
    </table>
    </td>
  </tr>
</table>
<br>
<a href="cetak_nilai.php?npm=<?php echo $stai_user; ?>" title="Print" onclick="window.open(this.href,'win2','status=yes,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=no,width=640,height=480,directories=no,location=no'); return false;" rel="nofollow"><img src="../images/printButton.png" alt="Print"  />PRINT</a>
</body>
</html>


scrip ambil sesion dari joomla nya
Code:
<?php
define( '_JEXEC', 1 );
define('JPATH_BASE', dirname(__FILE__) );
define( 'DS', DIRECTORY_SEPARATOR );
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
$mainframe =& JFactory::getApplication('site');
$user =& JFactory::getUser();
//echo $user->username;
//echo "<p>Your name is {$user->name}, your email is {$user->email}, and your username is {$user->username}</p>";
//echo "<p>Your usertype is {$user->usertype} which has a group id of {$user->gid}.</p>";
?>


koneksi nya
Code:
<?php
$host = "localhost";
$user = "******";
$password = "*****";
$database = "*******";
$connect=mysql_connect($host,$user,$password);
if (!$connect) {
      die('<b>Tidak Dapat Terhubung Ke MySQL Server :</b> ' . mysql_error());
}else{
      $pilih_database=mysql_select_db($database,$connect);
      if (!$pilih_database){
          die('<b>Database Error : </b>' . mysql_error());
      }
}
?>


Top
 Profile  
 
PostPosted: Tue Jul 03, 2012 5:25 am 
Joomla! Fledgling
Joomla! Fledgling

Joined: Tue Jul 03, 2012 4:48 am
Posts: 3
selalu keluar seperti ini

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in D:\@Database\htdocs\stai\akademik\nilaiasli.php on line 111

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in D:\@Database\htdocs\stai\akademik\nilaiasli.php on line 163

Warning: Division by zero in D:\@Database\htdocs\stai\akademik\nilaiasli.php on line 190

dan saat kembali ke home selalu logout


Top
 Profile  
 
 Post subject: --- PROBLEM SOLVED ---
PostPosted: Sat Jul 07, 2012 6:41 am 
Joomla! Fledgling
Joomla! Fledgling

Joined: Tue Jul 03, 2012 4:48 am
Posts: 3
ADA MASALAH DI STRUKTUR MYSQL NYA KARNA BERBEDA ANTARA TABEL YANG SATU DENGAN YANG LAIN BAHASANYA
SETELAH DI SET latin1_swedish_ci SEMUA NORMAL

YANG MASIH BELUM KELAR SEKARANG SETIAP KEMBALI KE HOME SELALU LOGOUT KENAPA YA ???


Top
 Profile  
 
PostPosted: Wed Nov 21, 2012 3:23 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Sun Nov 18, 2012 2:11 pm
Posts: 22
bisa jadi cookies browsernya boss

_________________
http://fluser.com/ - Business Directories
http://www.news.fluser.com/ - Fluser Top News


Top
 Profile  
 
PostPosted: Mon Nov 26, 2012 1:48 pm 
Joomla! Apprentice
Joomla! Apprentice

Joined: Fri Nov 23, 2012 7:03 am
Posts: 5
program'a belum sempurna mas bro seperti'a masih ada masalah di bagian MYSQL.coba diteliti kembali.

_________________
http://www.kristalindouno.com
http://poles-marmer-jakarta-poles-marmer-murah.com


Top
 Profile  
 
PostPosted: Wed Nov 05, 2014 5:13 pm 
Joomla! Intern
Joomla! Intern

Joined: Fri May 16, 2014 1:35 pm
Posts: 58
bisa juga browser yang agan gunakan ada masalah, apa sudah coba dibuka di browser lain?

_________________
I want to be a Joomla Master
http://www.salonmobil.asia - salon mobil
http://www.serviceac.asia - service ac jakarta selatan


Top
 Profile  
 
PostPosted: Sat Nov 08, 2014 8:55 am 
Joomla! Intern
Joomla! Intern

Joined: Sun Dec 15, 2013 1:35 pm
Posts: 52
Silahkan cek di dokumentasi online http://api.joomla.org/index.html
utk session di sini http://api.joomla.org/Joomla-Framework/ ... ssion.html

_________________
Jogja Kota Budaya dan Pariwisata Kultural


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 



Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group