Folder SMP6 Folder SMP6/connect Folder SMP6/include Koneksi ke MySQL
Untuk koneksi ke database server MySQL kita harus menggunakan suatu sintaks separti berikut; conn.php // file simpan Folder SMP6/connect
<?
error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR); $dbservertype='mysql'; $servername='localhost'; $dbusername='root'; $dbpassword='root'; $dbname='smp6'; { global $link; $link=mysql_connect ("$servername","$dbusername","$dbpassword"); if(!$link){die("Could not connect to MySQL");}
mysql_select_db("$dbname",$link) or die ("could not open db".mysql_error()); }
?>
<! --- Connect selesai --->
newsession.php // file simpan Folder SMP6/connect <?php
//error_reporting(E_ERROR | E_PARSE | E_CORE_ERROR); $session['userid']=$userid;
//echo $session['userid']; ?>
<! --- newsession selesai --->
session.php // file simpan Folder SMP6/connect <?php
session_start();
session_register("session"); ?>
<! --- session selesai --->
index.php // file simpan folder SMP6/ <?
$user = $suser;
include "connect/conn.php"; include "connect/session.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> <title>Official Website By Bambang Nurdiyansah</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" media="screen,projection,print" href="CSS/style.css"> </head> <body onload="MM_preloadImages('index.php_files/index_r1_c2_f2.gif','images/index_r1_c3_f2.gif','images/index_r1_c5 _f2.gif','images/index_r1_c6_f2.gif','images/index_r1_c8_f2.gif','images/index_r1_c9_f2.gif');" bgcolor="#ffffff" topmargin="0"> <? if(empty($main)){ $main = "main"; ?>
<table width="759" align="center" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable-->
<tbody><tr>
<td width="49"><img src="index.php_files/spacer.gif" alt="" width="100%" border="0" height="1"></td> <td width="85"><img src="index.php_files/spacer.gif" alt="" width="100%" border="0" height="1"></td> <td colspan="2"><img src="index.php_files/spacer.gif" alt="" width="100%" border="0" height="8"></td> <td colspan="2"><img src="index.php_files/spacer.gif" alt="" width="100%" border="0" height="8"></td> <td colspan="3"><!--DWLayoutEmptyCell--> </td>
<td colspan="2"><img src="index.php_files/spacer.gif" alt="" width="100%" border="0" height="8"><img src="index.php_files/spacer.gif" alt="" width="83" border="0" height="1"></td>
</tr> <tr>
<td><img name="index_r1_c1" src="index.php_files/index_r1_c1.gif" id="index_r1_c1" alt="" width="49" border="0" height="40"></td>
<td><a href="index.php"><img src="index.php_files/index_r1_c2.gif" id="index_r1_c2" alt="" width="85" border="0" height="40"></a></td>
<td colspan="2"><a href="index.php?main=profil"><img name="index_r1_c3"
src="index.php_files/index_r1_c3.gif" id="index_r1_c3" alt="" width="155" border="0" height="40"> </a> </td> <td width="128"><a href="index.php?main=fasilitas"><img name="index_r1_c5"
src="index.php_files/index_r1_c5.gif" id="index_r1_c5" alt="" width="128" border="0" height="40"></a></td> <td colspan="3"><a href="index.php?main=presst_siswa"><img name="index_r1_c6"
src="index.php_files/index_r1_c6.gif" id="index_r1_c6" alt="" width="118" border="0" height="40"></a></td> <td width="97"><a href="index.php?main=info_guru"><img name="index_r1_c8"
src="index.php_files/index_r1_c8.gif" id="index_r1_c8" alt="" width="94" border="0" height="40"></a></td> <td width="89"> <a href=mailto:bam_n2@yahoo.co.id target="_parent"><img name="index_r1_c9"
src="index.php_files/index_r1_c9.gif" id="index_r1_c9" alt="" width="83" border="0" height="40"></a></td> <td width="47"><img name="index_r1_c10" src="index.php_files/index_r1_c10_main.gif" id="index_r1_c10" alt="" width="47" border="0" height="40"></td>
</tr> <tr>
<td style="border-left: 1px solid rgb(119, 119, 119);" bgcolor="#e8e8e7" height="143"> </td> <td colspan="9" valign="top" bgcolor="#e6e6e6"><img src="images/gb4.jpg" border="0"/>
</td>
<td style="border-right: 1px solid rgb(153, 153, 153);" bgcolor="#e6e6e6"> </td> </tr>
<tr>
<td style="border-left: 1px solid rgb(119, 119, 119);" bgcolor="#e8e8e7" height="117"> </td> <td colspan="6" valign="top" background="index.php_files/index_r3_c2.gif" bgcolor="#e6e6e6"> <div style="border: 1px solid rgb(153, 153, 153); padding: 10px; background-color: rgb(255, 255, 255);" align="center">
<?
$pad = "include/"; $eks = ".php";
$main = $pad.$main.$eks; include $main;
?> </div>
</td>
<td colspan="3" valign="top" bgcolor="#e6e6e6" style="padding: 0px 0px 0px 20px;">
<table width="100%" align="center" border="0" cellpadding="1" cellspacing="1"> <tbody>
<tr>
<td style="border-bottom: 1px solid rgb(153, 153, 153); padding: 4px 0px; color: rgb(51, 51, 51);"> <?
if($sstatus=="a"||$sstatus=="b"||$sstatus=="s"){ if(!empty($masuk))
?>
<a href="out_user.php" class="navigation"><strong><font color="#FF0000"> Log Out [ <? echo "$userid"?> ] </font></strong></a> <? } ?>
</td> </tr> <tr>
<td style="border-bottom: 1px solid rgb(153, 153, 153); padding: 4px 0px; color: rgb(51, 51, 51);"><div align="center"><strong>Main Menu </strong></div></td>
</tr> <tr>
<td style="border-bottom: 1px solid rgb(153, 153, 153); padding: 4px 0px; color: rgb(51, 51, 51);"><strong><img src="index.php_files/bullet_2b.gif" align="absmiddle" border="0"> <a href="index.php?main=info_siswa">Profile Siswa </a></strong></td>
</tr> <tr>
<td style="border-bottom: 1px solid rgb(153, 153, 153); padding: 4px 0px; color: rgb(51, 51, 51);"><strong><img src="index.php_files/bullet_2b.gif" align="absmiddle" border="0"> <a href="index.php?main=info_guru">Profile Guru </a></strong></td>
</tr> <tr>
<td style="border-bottom: 1px solid rgb(153, 153, 153); padding: 4px 0px; color: rgb(51, 51, 51);"><strong><img src="index.php_files/bullet_2b.gif" align="absmiddle" border="0"><a href="index.php?main=kalender_akademik"> Kalendar Sekolah </a></strong></td> </tr>
<tr>
<td style="border-bottom: 1px solid rgb(153, 153, 153); padding: 4px 0px; color: rgb(51, 51, 51);"><strong><img src="index.php_files/bullet_2b.gif" align="absmiddle" border="0"><a href="index.php?main=berita&awal=0"> News </a></strong></td>
</tr> </tbody> </table> <br>
<? if(! session_is_registered(masuk)){ ?>
<table width="100%" align="center" border="0" cellpadding="1" cellspacing="1"> <tbody>
<tr>
<td style="border-bottom: 1px solid rgb(153, 153, 153); padding: 4px 0px; color: rgb(51, 51, 51);"><div align="center"><strong>Informasi</strong></div></td>
</tr> <tr>
<td style="border-bottom: 1px solid rgb(153, 153, 153); padding: 4px 0px; color: rgb(51, 51, 51);"><strong><img src="index.php_files/bullet_2b.gif" align="absmiddle" border="0" /> <a href="index.php?main=login">Login User </a></strong></td>
</tr> </tbody> </table> <? } ?> <? // status a = Administrator // status b = Guru // status s = siswa if($sstatus=="s"){
?> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr>
<td class="judul"><hr /> <strong>Menu Siswa</strong> <hr /> </td>
</tr> <tr> <td>
<table width="98%" border="0" align="right" cellpadding="1" cellspacing="1" class="style1"> <tr>
<td style="border-bottom: 1px solid rgb(153, 153, 153); padding: 4px 0px; color: rgb(51, 51,
51);"><strong><img src="index.php_files/bullet_2b.gif" align="absmiddle" border="0">Data Tugas </td> </tr>
<tr>
<td style="border-bottom: 1px solid rgb(153, 153, 153); padding: 4px 0px; color: rgb(51, 51, 51);"><strong><img src="index.php_files/bullet_2b.gif" align="absmiddle" border="0"><a href="index.php?send=jadwal_pelajaran" class="link style1">Jadwal Pelajaran </a> </td> </tr>
<tr>
<td style="border-bottom: 1px solid rgb(153, 153, 153); padding: 4px 0px; color: rgb(51, 51, 51);"><strong><img src="index.php_files/bullet_2b.gif" align="absmiddle" border="0"> <a href="index.php?send=daftar_nilai" class="link">Jadwal Ujian </a></td>
</tr> </table> </td> </tr> <tr> </tr> <tr> </tr> </table> <? } ?> <? // status a = Administrator // status b = Guru // status s = siswa if($sstatus=="b"){ ?>
<table width="100%" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable-->
<tr>
<td width="150" class="judul"><hr /> <strong>Menu Guru</strong> <hr /></td>
</tr> <tr>
<td>
<table width="98%" border="0" align="right" cellpadding="1" cellspacing="1"> <tr>
<td style="border-bottom: 1px solid rgb(153, 153, 153); padding: 4px 0px; color: rgb(51, 51, 51);"><strong><img src="index.php_files/bullet_2b.gif" align="absmiddle" border="0"> <a href="index.php?main=cari_jadwal" class="link">Jadwal Mengajar </a></td>
</tr> <tr>
<td style="border-bottom: 1px solid rgb(153, 153, 153); padding: 4px 0px; color: rgb(51, 51, 51);"><strong><img src="index.php_files/bullet_2b.gif" align="absmiddle" border="0"> <a href="index.php?main=down" class="link">Data Tugas Siswa </a></td>
</tr> </table> </td> </tr> <tr> </tr> <tr> </tr> <tr> </tr> </table> <? } ?> <br> <? // status a = Administrator // status b = Guru // status s = siswa if($sstatus=="a"){ ?>
<table width="100%" border="0" cellpadding="1" cellspacing="1"> <!--DWLayoutTable-->
<tr>
<td width="150" class="judul"><hr /> <strong> Menu Admnistrator </strong> <hr /></td>
</tr> <tr> <td>
<table width="100%" border="0" align="right" cellpadding="1" cellspacing="1"> <tr>
<td style="border-bottom: 1px solid rgb(153, 153, 153); padding: 4px 0px; color: rgb(51, 51, 51);"><strong><img src="index.php_files/bullet_2b.gif" align="absmiddle" border="0"> <a
href="index.php?main=InptGuru" class="link">Data Guru </a></td> </tr>
<tr>
<td style="border-bottom: 1px solid rgb(153, 153, 153); padding: 4px 0px; color: rgb(51, 51, 51);"><strong><img src="index.php_files/bullet_2b.gif" align="absmiddle" border="0"> <a
href="index.php?main=Inptsiswa" class="link">Data Siswa </a></td> </tr>
<tr>
<td style="border-bottom: 1px solid rgb(153, 153, 153); padding: 4px 0px; color: rgb(51, 51, 51);"><strong><img src="index.php_files/bullet_2b.gif" align="absmiddle" border="0"> <a
href="index.php?main=cari_guru" class="link">Data Jadwal Mengajar </a> </td> </tr>
<td style="border-bottom: 1px solid rgb(153, 153, 153); padding: 4px 0px; color: rgb(51, 51, 51);"><strong><img src="index.php_files/bullet_2b.gif" align="absmiddle" border="0"> <a
href="index.php?main=jadwal_pelajaran" class="link">Jadwal Pelajaran</a></td> </tr>
<tr>
<td style="border-bottom: 1px solid rgb(153, 153, 153); padding: 4px 0px; color: rgb(51, 51, 51);"><strong><img src="index.php_files/bullet_2b.gif" align="absmiddle" border="0"> <a href="index.php?main=isi_berita" class="link">Add News </a></td>
</tr> </table> </td> </tr> <tr> </tr> <tr> </tr> <tr> </tr> </table> <? } ?>
<table width="100%" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable--> <tr> <td width="150" class="judul"></td> </tr> <tr> </tr> <tr>
<td align="center" class="style3"><img src="images/logo_diknas.gif" width="54" height="53" /><img src="images/sekolah2000.gif" width="90" height="40" /></td>
</tr> <tr>
<td align="center" class="style3"> </td> </tr>
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr>
<td colspan="3" align="center">Anda pengujung Ke :</td> </tr> <tr> <td> </td> <td align="center"> <? if ($b=="") { $fp = fopen("counter/counter.txt","r"); $jumlah = fgets($fp,255); fclose($fp); if ($jumlah == 999999) { $jumlah = 000001; } else { $temp = $jumlah + 1; } $fw = fopen("counter/counter.txt","w"); $dt = ltrim($temp); $length = strlen($dt); $zero = "000000"; if ($length < 6) { $tb = substr($zero,0,(6-$length));
$a = substr_replace($dt,$tb,0,-strlen($tb)); } $jumlah_baru = fputs($fw,$a); fclose($fw); $b = "$a"; session_register("b"); } else { $a = $b; } $i = 0;
for ($i >= 0; $i < strlen($a); $i++) {
$x = substr($a,$i,1);
echo "<img src='images/counter/$x.jpg' height=18 align=absmiddle>"; } ?> </td> <td> </td> </tr> <tr> </tr> </table>
<table width="100%" align="center" border="0" cellpadding="0" cellspacing="0"> <tbody>
<tr>
<td style="padding: 30px 0px 10px; color: rgb(0, 51, 153);"> </td> </tr>
<tr>
<td style="padding: 0px 0px 10px;" align="center"><strong>Alamat:</strong></td> </tr>
<tr>
<td align="center">Jl.P.A Tendean no.14<br> Email: Bam_n2@yahoo.co.id<br>
Telp.: 081325685388 <br> <br></td>
</tr>
</tbody></table> </td>
<td style="border-right: 1px solid rgb(153, 153, 153);" bgcolor="#e6e6e6"> </td> </tr>
<tr>
<td><img name="index_r8_c1" src="index.php_files/index_r8_c1.gif" id="index_r8_c1" alt="" width="49" border="0" height="20"></td>
<td colspan="9"><img name="index_r8_c2" src="index.php_files/index_r8_c2.gif" id="index_r8_c2" alt="" width="663" border="0" height="20"></td>
<td><img name="index_r8_c10" src="index.php_files/index_r8_c10.gif" id="index_r8_c10" alt="" width="47" border="0" height="20"></td> </tr> <tr> <td></td> <td></td> <td width="148"></td> <td width="7"></td> <td></td> <td width="14"></td> <td width="105"></td> <td width="3"></td> <td></td>
<td></td> <td></td> </tr>
</tbody></table>
<table width="759" align="center" border="0" cellpadding="0" cellspacing="0"> <tbody><tr>
<td width="389" height="28"> </td>
<td style="padding: 5px 5px 0px 0px; color: rgb(102, 102, 102);" width="390"><div align="right">Developed : Bambang Nurdiyansah <a class="pw" href="http://www.arifdm.com/"
target="_blank"></a> </div></td> </tr> </tbody></table> </body> </html> <? } else { ?>
<table width="759" align="center" border="0" cellpadding="0" cellspacing="0"> <!--DWLayoutTable-->
<tbody><tr>
<td width="49"><img src="index.php_files/spacer.gif" alt="" width="100%" border="0" height="1"></td> <td width="85"><img src="index.php_files/spacer.gif" alt="" width="100%" border="0" height="1"></td> <td colspan="2"><img src="index.php_files/spacer.gif" alt="" width="100%" border="0" height="8"></td> <td colspan="2"><img src="index.php_files/spacer.gif" alt="" width="100%" border="0" height="8"></td> <td colspan="3"><!--DWLayoutEmptyCell--> </td>
<td colspan="2"><img src="index.php_files/spacer.gif" alt="" width="100%" border="0" height="8"><img src="index.php_files/spacer.gif" alt="" width="83" border="0" height="1"></td>
</tr> <tr>
<td><img name="index_r1_c1" src="index.php_files/index_r1_c1.gif" id="index_r1_c1" alt="" width="49" border="0" height="40"></td>
<td><a href="index.php"><img src="index.php_files/index_r1_c2.gif" id="index_r1_c2" alt="" width="85" border="0" height="40"></a></td>
<td colspan="2"><a href="index.php?main=profil"><img name="index_r1_c3"
src="index.php_files/index_r1_c3.gif" id="index_r1_c3" alt="" width="155" border="0" height="40"> </a> </td> <td width="128"><a href="index.php?main=fasilitas"><img name="index_r1_c5"
src="index.php_files/index_r1_c5.gif" id="index_r1_c5" alt="" width="128" border="0" height="40"></a></td> <td colspan="3"><a href="index.php?main=presst_siswa"><img name="index_r1_c6"
src="index.php_files/index_r1_c6.gif" id="index_r1_c6" alt="" width="118" border="0" height="40"></a></td> <td width="97"><a href="index.php?main=info_guru"><img name="index_r1_c8"
src="index.php_files/index_r1_c8.gif" id="index_r1_c8" alt="" width="94" border="0" height="40"></a></td> <td width="89"> <a href=mailto:bam_n2@yahoo.co.id target="_parent"><img name="index_r1_c9"
src="index.php_files/index_r1_c9.gif" id="index_r1_c9" alt="" width="83" border="0" height="40"></a></td> <td width="47"><img name="index_r1_c10" src="index.php_files/index_r1_c10_main.gif" id="index_r1_c10" alt="" width="47" border="0" height="40"></td>
</tr> <tr>
<td style="border-left: 1px solid rgb(119, 119, 119);" bgcolor="#e8e8e7" height="143"> </td> <td colspan="9" valign="top" bgcolor="#e6e6e6"><img src="images/gb4.jpg" border="0"/>
</td>
<td style="border-right: 1px solid rgb(153, 153, 153);" bgcolor="#e6e6e6"> </td> </tr>
<tr>