php Checklogin
<?php
include "koneksi.php";
$data=mysql_query("select * from login where user = '$_POST[user]' and pass='$_POST[pass]'");
$hasil=mysql_fetch_array($data);
if ($_POST[user]=="")
{header("Location:gagal.php");}
else
{if($_POST[pass]="$hasil[pass]")
{$user="hasil[user]"; $pass="hasil[pass]";
session_register("user");
session_register("pass");
header ("Location:utama.php");
}
else
{header("Location:gagal.php");}
}?>
DeleteMahasiswa.php
<?php
include "koneksi.php";
include "validasi.php";
$query= "delete from mahasiswa where nim = '".$_POST['nim']."'";
mysql_query($query) or die ("Query gagal!");
header ("Location: tampilmahasiswa.php");
?>
Frmdeletemahasiswa
<?php
include "validasi.php";
include "koneksi.php";
include "menu.php";
?>
<html>
<head>
<title> Delete Data Mahasiswa </title>
</head>
<body>
<?php
$c="1";
if (isset($_GET['nim']))
{
$c=(get_magic_quotes_gpc()) ? $_GET ['nim']:addslashes ($_GET['nim']);
}
$query=sprintf("select * from mahasiswa where nim = '%s'", $c);
$hasil = mysql_query($query) or die ("Query gagal!");
$x =1;
$data = mysql_fetch_array($hasil);
?>
<div align="center">
<form method="post" action="deletemahasiswa.php">
<table width="55%" border="0" cellpadding="4" bgcolor="#99CCFF">
<tr>
<td>NIM</td>
<td>:</td>
<td><input name="nim" type="text"
value="<?php echo $data['nim']; ?>"></td></tr>
<tr> <td> Nama </td>
<td> : </td>
<td><input name="nama" type="text"
value="<?php echo $data['nama']; ?>"></td></tr>
<tr> <td> Jenis Kelamin </td>
<td> : </td>
<td> <input name = "jk[]" type="radio" value="Pria"
<?php if ($data ['jk']=="Pria") {echo "checked";}?>>Pria
<input name="jk[]" type="radio" value="Wanita"
<?php if ($data ['jk']=="Wanita") {echo "checked";}?>>Wanita
</td></tr>
<tr><td> Tempat Lahir </td>
<td> : </td>
<td><input name="tptlahir" type="text"
value="<?php echo $data['tptlahir']; ?>"></td></tr>
<tr><td> Tanggal Lahir </td>
<td>:</td>
<td> <select name="tgl">
<option> <?php $tgl=substr ($data ['tgllahir'], 0,2);
echo $tgl; ?></option>
<?php $x=1;
for ($x=1; $x<=9; $x++)
{echo "<option>0$x</option>";}
for ($x=10; $x<=31; $x++)
{echo "<option>$x</option>";}
?>
</select>
<select name ="bln">
<option> <?php $bln=substr ($data ['tgllahir'], 3,-5);
echo $bln; ?></option>
<option> Januari </option>
<option> Februari </option>
<option> Maret </option>
<option> April </option>
<option> Mei</option>
<option> Juni </option>
<option> Juli </option>
<option> Agustus </option>
<option> September</option>
<option> Oktober </option>
<option> Nopember </option>
<option> Desember </option>
</select>
<select name="thn">
<option> <?php $thn=substr ($data ['tgllahir'], -4);
echo $thn; ?></option>
<?php $x=1;
for ($x=1980; $x<=1999; $x++)
{echo "<option>$x</option>";}
?>
<select></td></tr>
<tr>
<td> Kelas </td>
<td>:</td>
<td><select name ="kelas">
<option> <?php echo $data['kelas'] ?></option>
<?php $x=1;
for ($x=1; $x<=9; $x++)
{echo "<option> MI.11-0$x </option>";}
for ($x=10 ; $x<=30; $x++)
{echo "<option> MI.11-$x</option>";}
?>
<select></td></tr>
<tr>
<td> </td>
<td> </td>
<td> <input type="submit" value="Delete">
<input type="reset" value="Batal"></td></tr>
</table>
</form>
</div>
<p align="center">
<b> Kembali ke
<a href="tampilmahasiswa.php">Mahasiswa</a>
: : <a href="utama.php">Kembali ke utama </a></b>
</p>
</body>
</html>
frminsertmahasiswa
<?php
include "validasi.php";
include "koneksi.php";
include "menu.php";
?>
<html>
<head>
<title> Tambah Data Mahasiswa </title>
</head>
<body>
<div align="center">
<form method="post" action ="insertmahasiswa.php">
<table width="55%" border="0" cellpadding="4" bgcolor="#99CCFF">
<tr><td> NIM</td>
<td> : </td>
<td><input name="nim" type="text"></td></td></tr>
<tr> <td> Nama </td>
<td> : </td>
<td><input name="nama" type="text" size="50" maxlenghth="35">
</td> </tr>
<tr> <td> Jenis Kelamin </td>
<td> : </td>
<td> <input name = "jk[]" type="radio" value="Pria">Pria
<input name="jk[]" type="radio" value="Wanita">Wanita
</td></tr>
<tr><td> Tempat Lahir </td>
<td> : </td>
<td><input name="tptlahir" type="text" size="50" maxlength="25">
</td></tr>
<tr><td> Tanggal Lahir </td>
<td>:</td>
<td> <select name="tgl">
<?php $x=1;
for ($x=1; $x<=9; $x++)
{echo "<option>0$x</option>";}
for ($x=10; $x<=31; $x++)
{echo "<option>$x</option>";}
?>
</select>
<select name ="bln">
<option> Januari </option>
<option> Februari </option>
<option> Maret </option>
<option> April </option>
<option> Mei</option>
<option> Juni </option>
<option> Juli </option>
<option> Agustus </option>
<option> September</option>
<option> Oktober </option>
<option> Nopember </option>
<option> Desember </option>
</select>
<select name="thn">
<?php $x=1;
for ($x=1980; $x<=1999; $x++)
{echo "<option>$x</option>";}
?>
<select></td></tr>
<tr>
<td> Kelas </td>
<td>:</td>
<td><select name ="kelas">
<?php $x=1;
for ($x=1; $x<=9; $x++)
{echo "<option> MI.11-0$x </option>";}
for ($x=10 ; $x<=30; $x++)
{echo "<option> MI.11-$x</option>";}
?>
<select></td></tr>
<tr>
<td> </td>
<td> </td>
<td> <input type="submit" value="Insert">
<input type="reset" value="Batal"></td></tr>
</table>
</form>
</div>
<p align="center">
<b> Kembali ke
<a href="tampilmahasiswa.php">Mahasiswa</a>
: : <a href="utama.php">Kembali ke utama </a></b>
</p>
</body>
</html>
Index
<html>
<head>
<title> Sistem Informasi Nilai Online </title>
<body>
<?php include "menu.php" ?>
<p align="center"><img src="atb_logo.gif" width="265" height="265"></p>
<h1 align="center"><font color="#0000FF" face="verdana"> SISTEM INFORMASI NILAI </font></h1>
<p align="center"><font color="#0000FF" face="verdana"> Oleh </font></p>
<p align="center"><font color="#0000FF" face="verdana"><a href="profile.php">
Chandra </a></font></p>
</body>
</html>
Insertmahasiswa
<?php
include "koneksi.php";
include "validasi.php";
$tgllahir=$_POST['tgl']." ".$_POST['bln']." ".$_POST['thn'];
if(!empty($_POST['jk']))
{ foreach ($_POST[jk] as $value)
{ $jk=$value;}}
if(!empty($_POST['jurusan']))
{ foreach ($_POST[jurusan] as $value)
{ $jurusan=$value;}}
$query = "INSERT INTO mahasiswa VALUES ('" . $_POST['nim'] . "','" .
$_POST['nama'] . "','" . $jk . "','" . $_POST['tptlahir'] . "','" .
$tgllahir . "','" . $_POST['kelas'] . "','" . $jurusan . "')";
mysql_query($query) or die ("Query gagal!");
header ("location: tampilmahasiswa.php");
?>
Insertmatakuliah
<?php
include "koneksi.php";
if(!empty($_POST[jurusan]))
{foreach ($_POST[jurusan] as $value)
{$jurusan=$value;}}
$query= "insert into matakuliah values ('" . $_POST['kdmk'] . "','" .
$_POST['nmmk'] . "','" . $jurusan . "','" . $_POST ['sks'] . "')";
mysql_query($query) or die ("Query gagal!");
header ("Location: tampilmatakuliah.php");
?>
Login
<?php include "menu.php" ; ?>
<html>
<head><title>Login...</title></head>
<body>
<form action="checklogin.php" method="POST">
<table width="45%" border="0" align="center" bgcolor ="gray">
<tr><td colspan="3">
<div align ="center"><B> MASUKKAN USER DAN PASSWORD DI SINI ! </B></div></td>
</tr>
<tr>
<td> Username </td>
<td> : </td>
<td> <input name="user" type="text"></td>
</tr>
<tr>
<td> Password </td>
<td> : </td>
<td> <input name="pass" type="password"></td>
</tr>
<tr>
<td colspan="3"><div align="center">
<input type="submit" value="Log In">
</div></td>
</tr>
</table>
</form>
</body>
</html>
Menu
<div align="center">
<hr width="100%">
<font size = "2" face="Verdana" color=Black>
<a href="index.php"> Depan </a>
| <a href="login.php"> Login </a>
| <a href="logout.php"> Logout </a> <br>
| <a href="carimahasiswa.php"> Cari Mahasiswa </a>
| <a href="carimatakuliah.php"> Cari Mata Kuliah </a>
| <a href="carinilai.php"> Cari Nilai </a>
</font>
<hr width="100%">
</div>
utama
<?php
include "validasi.php";
include "index.php" ;
include "menulagi.php";
?>
Validasi
<?php
session_start();
$pengguna ="";
$akses = "true";
function validasi ($strusers, $strgroups, $username, $usergroup)
{ $isvalid = False;
if (!empty($username))
{ $arrusers=Explode (",", $strusers);
$arrgroups = Explode (",", $strgroups);
if (in_array ($username, $arrusers))
{ $isvalid=true;}
if (in_array ($usergroup, $arrgroups))
{ $isvalid=true;}
if (($strusers == "") && true)
{ $isvalid=true;}
}
return $isvalid;
}
$goto = "gagal.php";
if (!((isset($_SESSION['user'])) && (validasi ("", $pengguna, $_SESSION['user'],
$_SESSION ['pass']))))
{$char = "?";
$referensi = $_SERVER['PHP_SELF'];
if (strpos($goto, "?")) $char = "&";
if (isset ($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$referensi .="?" . $QUERY_STRING;
$goto = $goto . $char . "accesscheck=" . urlencode ($referensi);
header ("Location: ". $goto);
exit;
}
?>
Mahasiswa
<?php include "koneksi.php";
include "validasi.php";?>
<html>
<head>
<title>Tampil Data Mahasiswa</title>
</head>
<body>
<div align="center">
<?php include "menu.php"?>
<h3>LIST DATA MAHASISWA</h3>
<table width="90%" border="0" cellpadding="3" cellspacing="1">
<tr bgcolor="#0099FF">
<td>font size"2'" face="verdana"><div align="center"> NO </div></td>
<td>font size"2'" face="verdana"><div align="center"> NIM </div></td>
<td>font size"2'" face="verdana"><div align="center"> NAMA </div></td>
<td>font size"2'" face="verdana"><div align="center"> JENIS .K </div></td>
<td>font size"2'" face="verdana"><div align="center"> TPT LAHIR </div></td>
<td>font size"2'" face="verdana"><div align="center"> TGL LAHIR </div></td>
<td>font size"2'" face="verdana"><div align="center"> KELAS </div></td>
<td>font size"2'" face="verdana"><div align="center"> JURUSAN </div></td>
<td>font size"2'" face="verdana"><div align="center"> PROSES </div></td> </tr>
<?php
$query= "SELECT * FROM mahasiswa ORDERBY NIM";
$hasil= mysql_query($query) or die ("Query gagal!");
$x=1;
while($data = mysql_fetch_array ($hasil))
{
if ($x % 2 == 1)
{$bg = "#B7DBFF";}
else
{$bg= "FFCCFF";}
?>
<tr> bgcolor ="<?php echo $bg?>">
<td align="center"><font size"2" face ="verdana">
<?php echo $x ? ></font></td>
<td align="center"><font size"2" face ="verdana">
<?php echo $data['nim'] ? ></font></td>
<td align="center"><font size"2" face ="verdana">
<?php echo $data['nama'] ? ></font></td>
<td align="center"><font size"2" face ="verdana">
<?php echo $data['jk'] ? ></font></td>
<td align="center"><font size"2" face ="verdana">
<?php echo $data['tptlahir'] ? ></font></td>
<td align="center"><font size"2" face ="verdana">
<?php echo $data['tgllahir'] ? ></font></td>
<td align="center"><font size"2" face ="verdana">
<?php echo $data['kelas'] ? ></font></td>
<td align="center"><font size"2" face ="verdana">
<?php echo $data['jurusan'] ? ></font></td>
<td align="center"><font size"2" face ="verdana">
<a href="frmupdatemahasiswa.php?nim=<?php echo $data['nim'];?>">Update</a>
| <a href="frmdeletemahasiswa.php?nim=<?php echo $data['nim'];?>">Delete</a>
</font></td>
<?php
$x = $x + 1;
} ?>
</table>
</div>
<br>
<br>
<p align="center">
<font size="2" face="verdana" color=Black>
kembali ke
<a href="utama.php>Utama</a>
::<a href ="frminsertmahasiswa.php">Tambah Baru</a>
</font>
</p>
</body>
</html>
gagal
<?php
include "index.php";
echo '<div align="center" <b><font color="red" size="13">
Maaf Anda Belum Terdaftar </font></b></div>';
?>
TampilMahasiswa
<?php
include "koneksi.php";
include "menu.php"; ?>
<html>
<head>
<title> List Mahasiswa </title>
</head>
<body>
<div align="center">
<h3> LIST DATA MAHASISWA </h3>
<table width="90%" border cellpading="3" cellspacing="1"
bgcolor="white">
<tr bgcolor="#00AAFF">
<td><div align="center"> NO </div></td>
<td><div align="center"> NIM </div></td>
<td><div align="center"> NAMA </div></td>
<td><div align="center"> J. KELAMIN </div></td>
<td><div align="center"> TPT LAHIR </div></td>
<td><div align="center"> TGL LAHIR </div></td>
<td><div align="center"> KELAS </div></td>
<td><div align="center"> PROSES </div></td>
</TR>
<?PHP
$query = "select * from mahasiswa order by NIM";
$hasil = mysql_query($query) or die ("Query gagal!");
$x=1;
while($data = mysql_fetch_array($hasil))
{
if ($x % 2 == 1)
{$bgcolor="#B7DBFF";}
else
{$bgcolor = "#FFCCFF";}
?>
<tr bgcolor="<?php echo $bgcolor ?>">
<td><div align="center"><?php echo $x ?></td>
<td><div align="center"><?php echo $data ['nim'] ?></div></td>
<td><div align="center"><?php echo $data ['nama'] ?></div></td>
<td><div align="center"><?php echo $data ['jk'] ?></div></td>
<td><div align="center"><?php echo $data ['tptlahir'] ?></div></td>
<td><div align="center"><?php echo $data ['tgllahir'] ?></div></td>
<td><div align="center"><?php echo $data ['kelas'] ?></div></td>
<td><div align="center"><a href="frmupdatemahasiswa.php?nim=<?php echo $data['nim']; ?>">
Update</a>
|<a href="frmdeletemahasiswa.php?nim=<?php echo $data['nim']; ?>">
Delete</a></div></td>
</tr>
<?php
$x=$x+1;
} ?>
</table>
</div>
<br><br>
<p align="center">
<a href="frminsertmahasiswa.php"> Tambah Baru </a>
:: <a href="utama.php"> Kembali ke Utama </a>
</p>
</body>
</html>
tampilmatakuliah
<?php
include "koneksi.php";
include "menu.php"; ?>
<html>
<head>
<title> List Matakuliah </title>
</head>
<body>
<div align="center">
<h3> LIST DATA MATAKULIAH </h3>
<table width="90%" border cellpading="3" cellspacing="1"
bgcolor="white">
<tr bgcolor="#00AAFF">
<td><div align="center"> NO </div></td>
<td><div align="center"> KD_MK </div></td>
<td><div align="center"> NAMA_MK </div></td>
<td><div align="center"> JURUSAN </div></td>
<td><div align="center"> SKS </div></td>
<td><div align="center"> PROSES </div></td>
</TR>
<?PHP
$query = "select * from matakuliah order by kdmk";
$hasil = mysql_query($query) or die ("Query gagal!");
$x=1;
while($data = mysql_fetch_array($hasil))
{
if ($x % 2 == 1)
{$bgcolor="#B7DBFF";}
else
{$bgcolor = "#FFCCFF";}
?>
<tr bgcolor="<?php echo $bgcolor ?>">
<td><div align="center"><?php echo $x ?></div></td>
<td><div align="center"><?php echo $data ['kdmk'] ?></div></td>
<td><div align="center"><?php echo $data ['nmmk'] ?></div></td>
<td><div align="center"><?php echo $data ['jurusan'] ?></div></td>
<td><div align="center"><?php echo $data ['sks'] ?></div></td>
<td><div align="center"><a href="frmupdatematakuliah.php?kdmk=<?php echo $data['kdmk']; ?>">
Update</a>
|<a href="frmdeletematakuliah.php?kdmk=<?php echo $data['kdmk']; ?>">
Delete</a></div></td>
</tr>
<?php
$x=$x+1;
} ?>
</table>
</div>
<br><br>
<p align="center">
<a href="frminsertmatakuliah.php"> Tambah Baru </a>
:: <a href="utama.php"> Kembali ke Utama </a>
</p>
</body>
</html>
<?php
include "koneksi.php";
$data=mysql_query("select * from login where user = '$_POST[user]' and pass='$_POST[pass]'");
$hasil=mysql_fetch_array($data);
if ($_POST[user]=="")
{header("Location:gagal.php");}
else
{if($_POST[pass]="$hasil[pass]")
{$user="hasil[user]"; $pass="hasil[pass]";
session_register("user");
session_register("pass");
header ("Location:utama.php");
}
else
{header("Location:gagal.php");}
}?>
DeleteMahasiswa.php
<?php
include "koneksi.php";
include "validasi.php";
$query= "delete from mahasiswa where nim = '".$_POST['nim']."'";
mysql_query($query) or die ("Query gagal!");
header ("Location: tampilmahasiswa.php");
?>
Frmdeletemahasiswa
<?php
include "validasi.php";
include "koneksi.php";
include "menu.php";
?>
<html>
<head>
<title> Delete Data Mahasiswa </title>
</head>
<body>
<?php
$c="1";
if (isset($_GET['nim']))
{
$c=(get_magic_quotes_gpc()) ? $_GET ['nim']:addslashes ($_GET['nim']);
}
$query=sprintf("select * from mahasiswa where nim = '%s'", $c);
$hasil = mysql_query($query) or die ("Query gagal!");
$x =1;
$data = mysql_fetch_array($hasil);
?>
<div align="center">
<form method="post" action="deletemahasiswa.php">
<table width="55%" border="0" cellpadding="4" bgcolor="#99CCFF">
<tr>
<td>NIM</td>
<td>:</td>
<td><input name="nim" type="text"
value="<?php echo $data['nim']; ?>"></td></tr>
<tr> <td> Nama </td>
<td> : </td>
<td><input name="nama" type="text"
value="<?php echo $data['nama']; ?>"></td></tr>
<tr> <td> Jenis Kelamin </td>
<td> : </td>
<td> <input name = "jk[]" type="radio" value="Pria"
<?php if ($data ['jk']=="Pria") {echo "checked";}?>>Pria
<input name="jk[]" type="radio" value="Wanita"
<?php if ($data ['jk']=="Wanita") {echo "checked";}?>>Wanita
</td></tr>
<tr><td> Tempat Lahir </td>
<td> : </td>
<td><input name="tptlahir" type="text"
value="<?php echo $data['tptlahir']; ?>"></td></tr>
<tr><td> Tanggal Lahir </td>
<td>:</td>
<td> <select name="tgl">
<option> <?php $tgl=substr ($data ['tgllahir'], 0,2);
echo $tgl; ?></option>
<?php $x=1;
for ($x=1; $x<=9; $x++)
{echo "<option>0$x</option>";}
for ($x=10; $x<=31; $x++)
{echo "<option>$x</option>";}
?>
</select>
<select name ="bln">
<option> <?php $bln=substr ($data ['tgllahir'], 3,-5);
echo $bln; ?></option>
<option> Januari </option>
<option> Februari </option>
<option> Maret </option>
<option> April </option>
<option> Mei</option>
<option> Juni </option>
<option> Juli </option>
<option> Agustus </option>
<option> September</option>
<option> Oktober </option>
<option> Nopember </option>
<option> Desember </option>
</select>
<select name="thn">
<option> <?php $thn=substr ($data ['tgllahir'], -4);
echo $thn; ?></option>
<?php $x=1;
for ($x=1980; $x<=1999; $x++)
{echo "<option>$x</option>";}
?>
<select></td></tr>
<tr>
<td> Kelas </td>
<td>:</td>
<td><select name ="kelas">
<option> <?php echo $data['kelas'] ?></option>
<?php $x=1;
for ($x=1; $x<=9; $x++)
{echo "<option> MI.11-0$x </option>";}
for ($x=10 ; $x<=30; $x++)
{echo "<option> MI.11-$x</option>";}
?>
<select></td></tr>
<tr>
<td> </td>
<td> </td>
<td> <input type="submit" value="Delete">
<input type="reset" value="Batal"></td></tr>
</table>
</form>
</div>
<p align="center">
<b> Kembali ke
<a href="tampilmahasiswa.php">Mahasiswa</a>
: : <a href="utama.php">Kembali ke utama </a></b>
</p>
</body>
</html>
frminsertmahasiswa
<?php
include "validasi.php";
include "koneksi.php";
include "menu.php";
?>
<html>
<head>
<title> Tambah Data Mahasiswa </title>
</head>
<body>
<div align="center">
<form method="post" action ="insertmahasiswa.php">
<table width="55%" border="0" cellpadding="4" bgcolor="#99CCFF">
<tr><td> NIM</td>
<td> : </td>
<td><input name="nim" type="text"></td></td></tr>
<tr> <td> Nama </td>
<td> : </td>
<td><input name="nama" type="text" size="50" maxlenghth="35">
</td> </tr>
<tr> <td> Jenis Kelamin </td>
<td> : </td>
<td> <input name = "jk[]" type="radio" value="Pria">Pria
<input name="jk[]" type="radio" value="Wanita">Wanita
</td></tr>
<tr><td> Tempat Lahir </td>
<td> : </td>
<td><input name="tptlahir" type="text" size="50" maxlength="25">
</td></tr>
<tr><td> Tanggal Lahir </td>
<td>:</td>
<td> <select name="tgl">
<?php $x=1;
for ($x=1; $x<=9; $x++)
{echo "<option>0$x</option>";}
for ($x=10; $x<=31; $x++)
{echo "<option>$x</option>";}
?>
</select>
<select name ="bln">
<option> Januari </option>
<option> Februari </option>
<option> Maret </option>
<option> April </option>
<option> Mei</option>
<option> Juni </option>
<option> Juli </option>
<option> Agustus </option>
<option> September</option>
<option> Oktober </option>
<option> Nopember </option>
<option> Desember </option>
</select>
<select name="thn">
<?php $x=1;
for ($x=1980; $x<=1999; $x++)
{echo "<option>$x</option>";}
?>
<select></td></tr>
<tr>
<td> Kelas </td>
<td>:</td>
<td><select name ="kelas">
<?php $x=1;
for ($x=1; $x<=9; $x++)
{echo "<option> MI.11-0$x </option>";}
for ($x=10 ; $x<=30; $x++)
{echo "<option> MI.11-$x</option>";}
?>
<select></td></tr>
<tr>
<td> </td>
<td> </td>
<td> <input type="submit" value="Insert">
<input type="reset" value="Batal"></td></tr>
</table>
</form>
</div>
<p align="center">
<b> Kembali ke
<a href="tampilmahasiswa.php">Mahasiswa</a>
: : <a href="utama.php">Kembali ke utama </a></b>
</p>
</body>
</html>
Index
<html>
<head>
<title> Sistem Informasi Nilai Online </title>
<body>
<?php include "menu.php" ?>
<p align="center"><img src="atb_logo.gif" width="265" height="265"></p>
<h1 align="center"><font color="#0000FF" face="verdana"> SISTEM INFORMASI NILAI </font></h1>
<p align="center"><font color="#0000FF" face="verdana"> Oleh </font></p>
<p align="center"><font color="#0000FF" face="verdana"><a href="profile.php">
Chandra </a></font></p>
</body>
</html>
Insertmahasiswa
<?php
include "koneksi.php";
include "validasi.php";
$tgllahir=$_POST['tgl']." ".$_POST['bln']." ".$_POST['thn'];
if(!empty($_POST['jk']))
{ foreach ($_POST[jk] as $value)
{ $jk=$value;}}
if(!empty($_POST['jurusan']))
{ foreach ($_POST[jurusan] as $value)
{ $jurusan=$value;}}
$query = "INSERT INTO mahasiswa VALUES ('" . $_POST['nim'] . "','" .
$_POST['nama'] . "','" . $jk . "','" . $_POST['tptlahir'] . "','" .
$tgllahir . "','" . $_POST['kelas'] . "','" . $jurusan . "')";
mysql_query($query) or die ("Query gagal!");
header ("location: tampilmahasiswa.php");
?>
Insertmatakuliah
<?php
include "koneksi.php";
if(!empty($_POST[jurusan]))
{foreach ($_POST[jurusan] as $value)
{$jurusan=$value;}}
$query= "insert into matakuliah values ('" . $_POST['kdmk'] . "','" .
$_POST['nmmk'] . "','" . $jurusan . "','" . $_POST ['sks'] . "')";
mysql_query($query) or die ("Query gagal!");
header ("Location: tampilmatakuliah.php");
?>
Login
<?php include "menu.php" ; ?>
<html>
<head><title>Login...</title></head>
<body>
<form action="checklogin.php" method="POST">
<table width="45%" border="0" align="center" bgcolor ="gray">
<tr><td colspan="3">
<div align ="center"><B> MASUKKAN USER DAN PASSWORD DI SINI ! </B></div></td>
</tr>
<tr>
<td> Username </td>
<td> : </td>
<td> <input name="user" type="text"></td>
</tr>
<tr>
<td> Password </td>
<td> : </td>
<td> <input name="pass" type="password"></td>
</tr>
<tr>
<td colspan="3"><div align="center">
<input type="submit" value="Log In">
</div></td>
</tr>
</table>
</form>
</body>
</html>
Menu
<div align="center">
<hr width="100%">
<font size = "2" face="Verdana" color=Black>
<a href="index.php"> Depan </a>
| <a href="login.php"> Login </a>
| <a href="logout.php"> Logout </a> <br>
| <a href="carimahasiswa.php"> Cari Mahasiswa </a>
| <a href="carimatakuliah.php"> Cari Mata Kuliah </a>
| <a href="carinilai.php"> Cari Nilai </a>
</font>
<hr width="100%">
</div>
utama
<?php
include "validasi.php";
include "index.php" ;
include "menulagi.php";
?>
Validasi
<?php
session_start();
$pengguna ="";
$akses = "true";
function validasi ($strusers, $strgroups, $username, $usergroup)
{ $isvalid = False;
if (!empty($username))
{ $arrusers=Explode (",", $strusers);
$arrgroups = Explode (",", $strgroups);
if (in_array ($username, $arrusers))
{ $isvalid=true;}
if (in_array ($usergroup, $arrgroups))
{ $isvalid=true;}
if (($strusers == "") && true)
{ $isvalid=true;}
}
return $isvalid;
}
$goto = "gagal.php";
if (!((isset($_SESSION['user'])) && (validasi ("", $pengguna, $_SESSION['user'],
$_SESSION ['pass']))))
{$char = "?";
$referensi = $_SERVER['PHP_SELF'];
if (strpos($goto, "?")) $char = "&";
if (isset ($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$referensi .="?" . $QUERY_STRING;
$goto = $goto . $char . "accesscheck=" . urlencode ($referensi);
header ("Location: ". $goto);
exit;
}
?>
Mahasiswa
<?php include "koneksi.php";
include "validasi.php";?>
<html>
<head>
<title>Tampil Data Mahasiswa</title>
</head>
<body>
<div align="center">
<?php include "menu.php"?>
<h3>LIST DATA MAHASISWA</h3>
<table width="90%" border="0" cellpadding="3" cellspacing="1">
<tr bgcolor="#0099FF">
<td>font size"2'" face="verdana"><div align="center"> NO </div></td>
<td>font size"2'" face="verdana"><div align="center"> NIM </div></td>
<td>font size"2'" face="verdana"><div align="center"> NAMA </div></td>
<td>font size"2'" face="verdana"><div align="center"> JENIS .K </div></td>
<td>font size"2'" face="verdana"><div align="center"> TPT LAHIR </div></td>
<td>font size"2'" face="verdana"><div align="center"> TGL LAHIR </div></td>
<td>font size"2'" face="verdana"><div align="center"> KELAS </div></td>
<td>font size"2'" face="verdana"><div align="center"> JURUSAN </div></td>
<td>font size"2'" face="verdana"><div align="center"> PROSES </div></td> </tr>
<?php
$query= "SELECT * FROM mahasiswa ORDERBY NIM";
$hasil= mysql_query($query) or die ("Query gagal!");
$x=1;
while($data = mysql_fetch_array ($hasil))
{
if ($x % 2 == 1)
{$bg = "#B7DBFF";}
else
{$bg= "FFCCFF";}
?>
<tr> bgcolor ="<?php echo $bg?>">
<td align="center"><font size"2" face ="verdana">
<?php echo $x ? ></font></td>
<td align="center"><font size"2" face ="verdana">
<?php echo $data['nim'] ? ></font></td>
<td align="center"><font size"2" face ="verdana">
<?php echo $data['nama'] ? ></font></td>
<td align="center"><font size"2" face ="verdana">
<?php echo $data['jk'] ? ></font></td>
<td align="center"><font size"2" face ="verdana">
<?php echo $data['tptlahir'] ? ></font></td>
<td align="center"><font size"2" face ="verdana">
<?php echo $data['tgllahir'] ? ></font></td>
<td align="center"><font size"2" face ="verdana">
<?php echo $data['kelas'] ? ></font></td>
<td align="center"><font size"2" face ="verdana">
<?php echo $data['jurusan'] ? ></font></td>
<td align="center"><font size"2" face ="verdana">
<a href="frmupdatemahasiswa.php?nim=<?php echo $data['nim'];?>">Update</a>
| <a href="frmdeletemahasiswa.php?nim=<?php echo $data['nim'];?>">Delete</a>
</font></td>
<?php
$x = $x + 1;
} ?>
</table>
</div>
<br>
<br>
<p align="center">
<font size="2" face="verdana" color=Black>
kembali ke
<a href="utama.php>Utama</a>
::<a href ="frminsertmahasiswa.php">Tambah Baru</a>
</font>
</p>
</body>
</html>
gagal
<?php
include "index.php";
echo '<div align="center" <b><font color="red" size="13">
Maaf Anda Belum Terdaftar </font></b></div>';
?>
TampilMahasiswa
<?php
include "koneksi.php";
include "menu.php"; ?>
<html>
<head>
<title> List Mahasiswa </title>
</head>
<body>
<div align="center">
<h3> LIST DATA MAHASISWA </h3>
<table width="90%" border cellpading="3" cellspacing="1"
bgcolor="white">
<tr bgcolor="#00AAFF">
<td><div align="center"> NO </div></td>
<td><div align="center"> NIM </div></td>
<td><div align="center"> NAMA </div></td>
<td><div align="center"> J. KELAMIN </div></td>
<td><div align="center"> TPT LAHIR </div></td>
<td><div align="center"> TGL LAHIR </div></td>
<td><div align="center"> KELAS </div></td>
<td><div align="center"> PROSES </div></td>
</TR>
<?PHP
$query = "select * from mahasiswa order by NIM";
$hasil = mysql_query($query) or die ("Query gagal!");
$x=1;
while($data = mysql_fetch_array($hasil))
{
if ($x % 2 == 1)
{$bgcolor="#B7DBFF";}
else
{$bgcolor = "#FFCCFF";}
?>
<tr bgcolor="<?php echo $bgcolor ?>">
<td><div align="center"><?php echo $x ?></td>
<td><div align="center"><?php echo $data ['nim'] ?></div></td>
<td><div align="center"><?php echo $data ['nama'] ?></div></td>
<td><div align="center"><?php echo $data ['jk'] ?></div></td>
<td><div align="center"><?php echo $data ['tptlahir'] ?></div></td>
<td><div align="center"><?php echo $data ['tgllahir'] ?></div></td>
<td><div align="center"><?php echo $data ['kelas'] ?></div></td>
<td><div align="center"><a href="frmupdatemahasiswa.php?nim=<?php echo $data['nim']; ?>">
Update</a>
|<a href="frmdeletemahasiswa.php?nim=<?php echo $data['nim']; ?>">
Delete</a></div></td>
</tr>
<?php
$x=$x+1;
} ?>
</table>
</div>
<br><br>
<p align="center">
<a href="frminsertmahasiswa.php"> Tambah Baru </a>
:: <a href="utama.php"> Kembali ke Utama </a>
</p>
</body>
</html>
tampilmatakuliah
<?php
include "koneksi.php";
include "menu.php"; ?>
<html>
<head>
<title> List Matakuliah </title>
</head>
<body>
<div align="center">
<h3> LIST DATA MATAKULIAH </h3>
<table width="90%" border cellpading="3" cellspacing="1"
bgcolor="white">
<tr bgcolor="#00AAFF">
<td><div align="center"> NO </div></td>
<td><div align="center"> KD_MK </div></td>
<td><div align="center"> NAMA_MK </div></td>
<td><div align="center"> JURUSAN </div></td>
<td><div align="center"> SKS </div></td>
<td><div align="center"> PROSES </div></td>
</TR>
<?PHP
$query = "select * from matakuliah order by kdmk";
$hasil = mysql_query($query) or die ("Query gagal!");
$x=1;
while($data = mysql_fetch_array($hasil))
{
if ($x % 2 == 1)
{$bgcolor="#B7DBFF";}
else
{$bgcolor = "#FFCCFF";}
?>
<tr bgcolor="<?php echo $bgcolor ?>">
<td><div align="center"><?php echo $x ?></div></td>
<td><div align="center"><?php echo $data ['kdmk'] ?></div></td>
<td><div align="center"><?php echo $data ['nmmk'] ?></div></td>
<td><div align="center"><?php echo $data ['jurusan'] ?></div></td>
<td><div align="center"><?php echo $data ['sks'] ?></div></td>
<td><div align="center"><a href="frmupdatematakuliah.php?kdmk=<?php echo $data['kdmk']; ?>">
Update</a>
|<a href="frmdeletematakuliah.php?kdmk=<?php echo $data['kdmk']; ?>">
Delete</a></div></td>
</tr>
<?php
$x=$x+1;
} ?>
</table>
</div>
<br><br>
<p align="center">
<a href="frminsertmatakuliah.php"> Tambah Baru </a>
:: <a href="utama.php"> Kembali ke Utama </a>
</p>
</body>
</html>
Tidak ada komentar:
Posting Komentar