• Tidak ada hasil yang ditemukan

Perancangan Sistem Pakar Untuk Mendiagnosa Kerusakan Handphone Dengan Metode Certainty Factor (Cf) Berbasis Web

N/A
N/A
Protected

Academic year: 2019

Membagikan "Perancangan Sistem Pakar Untuk Mendiagnosa Kerusakan Handphone Dengan Metode Certainty Factor (Cf) Berbasis Web"

Copied!
91
0
0

Teks penuh

(1)

LISTING PROGRAM

1. Index.php (Halaman Index)

<!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>Sistem Pakar Certainty Factor</title>

<link rel="stylesheet" type="text/css" href="style.css" /> </head>

<body>

<div id="header">

<div class="wrap"><strong>Sistem Pakar untuk Mendiagnosa Kerusakan

Handphone dengan Metode <em>Certainty

Factor</em></strong><em></em></div></div> <div id="headerpic">

<img src="pics/nokia 6600-2.jpg" title="Nokia 6600" class="headerpic" /> <img src="pics/Nokia-6600-Reviews.jpg" title="Nokia 6600" class="headerpic" /> <img src="pics/nokia6610.jpg" title="Nokia 6610" class="headerpic" />

<img src="pics/nokia6610_pic2.jpg" title="Nokia 6610" class="headerpic" /> <img src="pics/nokia6630.jpg" title="Nokia 6630" class="headerpic" /> <img src="pics/nokia6630-2.jpg" title="Nokia 6630" class="headerpic" /> <img src="pics/Nokia_6670.jpg" title="Nokia 6670" class="headerpic" /> <img src="pics/nokia_6670_L_01.jpg" title="Nokia 6670" class="headerpic" /> <img src="pics/n6680_main1.jpg" title="Nokia 6680" class="headerpic" /> <img src="pics/nokia6680.jpg" title="Nokia 6680" class="headerpic" /> </div>

<div id='menu'> <?php

ob_start();//Hook output buffer include('config.php');

ob_end_clean();//Clear output buffer

#in case user has come for first time and cookies are not set then if (!isset($_COOKIE['username']))

{

echo "<form action='check_login.php' method='post' name='formlogin'> <table width='307' height='58' border='0'>

<tr>

<td width='69'>Username</td> <td width='10'>:</td>

<td width='153'><input type='text' name='loginusername' id='username' /></td>

(2)

<tr>

<td>Password</td> <td>:</td>

<td><input type='password' name='loginpass' id='loginpass' /></td> <td><input type='submit' name='login' id='login' value='Login' /></td> </tr>

</form> <tr>

<td colspan='4'>"; if ($_GET['err'] == "1") {

echo " <p style=color:red; > Harap isi username dan password anda. </p>"; }

else if ($_GET['err'] == "2") {

echo " <p style=color:red; > Username atau password salah. </p>"; }

else if ($_GET['err'] == "3") {

echo " <p style=color:red; > Harap login kembali. </p>"; }

else if ($_GET['notice'] == "1") {

echo " <p style=color:red; > Anda telah berhasil log out. </p>"; }

echo "</td> </tr> </table>"; }

//if cookies are set then use them else{

echo "<table width='307' height='58' border='0'> <tr>

<td align='justify'><b>Welcome " . $_COOKIE["username"] . "</b> </td> </tr></table>";

} ?>

<!-- menu list -->

<label for="list_menu"></label>

<table width="139" border="0" align="left"> <tr align='left'>

<td><?php

if (isset($_COOKIE['username'])) {

echo "<form action='logout.php' method='post'> <input type='submit' value='Log Out' /></form>";

} ?></td> </tr>

(3)

<td><?php

if (isset($_COOKIE['type'])) {

if ($_COOKIE['type'] == 'Admin' || $_COOKIE['type'] == 'Pakar') {

echo "<form action='list_hp.php' method='post'> <input type='submit' value='List HP' /></form></td> </tr>

<tr align='left'>

<td><form action='list_gejala.php' method='post'> <input type='submit' value='List Gejala' /></form></td> </tr>

<tr align='left'> <td>";

}

if ($_COOKIE['type'] == 'Admin') {

echo "<form action='list_member.php' method='post'> <input type='submit' value='List Member' /></form>";

} } ?> </td> </tr>

<tr align='left'>

<td><form action='about.php' method='post'> <input type='submit' value='About' /></form></td> </tr>

<tr> <td></td> </tr> </table> </div>

<div id="content">

<p>Untuk mulai mendiagnosa kerusakan handphone anda, silahkan pilih tipe handphone anda terlebih dahulu:</p>

<form method="GET" action="process.php"> <select name="type_hp" >

<?php

$tbl_name="hp";

$sql = "SELECT DISTINCT Type_hp FROM $tbl_name ORDER BY Type_hp"; $result=mysql_query($sql);

while($rows=mysql_fetch_array($result)){ ?>

<option value="<?php echo $rows['Type_hp'];?>"> <?php echo $rows['Type_hp']; ?></option>

<?php }

(4)

echo "<input type='submit' value='Lanjutkan' />"; echo "</form>"; if ($_GET['err'] == "4")

{

echo " <p style=color:red; > Type HP salah. </p>"; }

?> </div>

<div class ="wrap1"> </div>

<div class ="wrap1"> </div>

<div id="footer"> <div class ="wrap">

<p>&copy; 2015 - Nico Junari</p> </div></div>

</body> </html>

2. Process.php (Halaman Proses)

<!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" /> <link rel="stylesheet" type="text/css" href="style.css" />

<title>Processing</title> </head>

<body> <?php

ob_start();//Hook output buffer include('config.php');

ob_end_clean();//Clear output buffer $bgclr = "#00FF66";

//check if field is empty,if yes,return to index if ($_GET['type_hp'] == null )

{

header('location:index.php?err=4'); exit();

}

$type_hp=$_GET['type_hp'];

// To protect against MySQL injection $type_hp = stripslashes($type_hp);

$type_hp = mysql_real_escape_string($type_hp); $tbl="hp";

$typeh = str_replace(' ','',$type_hp); $tblaturan="aturan".$typeh;

$tbl2="gejala";

(5)

$result=mysql_query($sql); $rows=mysql_fetch_array($result); if ($rows == null )

{

header('location:index.php?err=4'); exit();

} else { ?>

<div id="header">

<div class="wrap"><strong>Sistem Pakar untuk Mendiagnosa Kerusakan

Handphone dengan Metode <em>Certainty

Factor</em></strong><em></em></div></div> <div id="headerpic">

<img src="pics/nokia 6600-2.jpg" title="Nokia 6600" class="headerpic" /> <img src="pics/Nokia-6600-Reviews.jpg" title="Nokia 6600" class="headerpic" /> <img src="pics/nokia6610.jpg" title="Nokia 6610" class="headerpic" />

<img src="pics/nokia6610_pic2.jpg" title="Nokia 6610" class="headerpic" /> <img src="pics/nokia6630.jpg" title="Nokia 6630" class="headerpic" /> <img src="pics/nokia6630-2.jpg" title="Nokia 6630" class="headerpic" /> <img src="pics/Nokia_6670.jpg" title="Nokia 6670" class="headerpic" /> <img src="pics/nokia_6670_L_01.jpg" title="Nokia 6670" class="headerpic" /> <img src="pics/n6680_main1.jpg" title="Nokia 6680" class="headerpic" /> <img src="pics/nokia6680.jpg" title="Nokia 6680" class="headerpic" /> </div>

<div id='menu'> <?php

ob_start();//Hook output buffer include('config.php');

ob_end_clean();//Clear output buffer

#in case user has come for first time and cookies are not set then if (!isset($_COOKIE['username']))

{

echo "<form action='check_login.php' method='post' name='formlogin'> <table width='307' height='58' border='0'>

<tr>

<td width='69'>Username</td> <td width='10'>:</td>

<td width='153'><input type='text' name='loginusername' id='username' /></td>

<td width='345'></td> </tr>

<tr>

<td>Password</td> <td>:</td>

(6)

</form> <tr>

<td colspan='4'>"; echo "</td>

</tr> </table>"; }

//if cookies are set then use them else{

echo "<table width='307' height='58' border='0'> <tr align='left'>

<td ><b>Welcome " . $_COOKIE["username"] . "</b> </td> </tr></table>"; }

?>

<!-- menu list -->

<label for="list_menu"></label>

<table width="139" border="0" align="left"> <tr align='left'>

<td><?php

if (isset($_COOKIE['username'])) {

echo "<form action='logout.php' method='post'> <input type='submit' value='Log Out' /></form>";

} ?></td> </tr>

<tr align='left'> <td><?php

if (isset($_COOKIE['type'])) {

if ($_COOKIE['type'] == 'Admin' || $_COOKIE['type'] == 'Pakar') {

echo "<form action='list_hp.php' method='post'> <input type='submit' value='List HP' /></form></td> </tr>

<tr align='left'>

<td><form action='list_gejala.php' method='post'> <input type='submit' value='List Gejala' /></form></td> </tr>

<tr align='left'> <td>";

}

if ($_COOKIE['type'] == 'Admin') {

echo "<form action='list_member.php' method='post'> <input type='submit' value='List Member' /></form>";

(7)

</tr>

<tr align='left'>

<td ><form action='about.php' method='post'> <input type='submit' value='About' /></form></td> </tr>

<tr> <td></td> </tr> </table> </div>

<div id="content">

<form method="post" action="result_pr.php">

<table width="580" border="1" align="center" cellpadding="3" cellspacing="1" > <tr>

<td width="460" align="center" bgcolor="#33CC99"><strong>Nama Gejala</strong></td>

<td width="20" align="center" bgcolor="#33CC99"><strong>Ya</strong></td> <td width="80" align="center" bgcolor="#33CC99"><strong>Tidak Tahu</strong></td>

<td width="20" align="center" bgcolor="#33CC99"><strong>Tidak</strong></td> </tr>

<?php

$sql="SELECT * FROM $tblaturan"; $result=mysql_query($sql);

while($rows=mysql_fetch_array($result)){ $ids_gejala[] = $rows['ID_gejala'];

}

$ids_gejala = array_unique($ids_gejala); sort($ids_gejala);

$length_gejala = count($ids_gejala); for ($x =0; $x<$length_gejala;$x++) {

$y = $ids_gejala[$x];

$sql="SELECT * FROM $tbl2 where ID_gejala = '$y'"; $result=mysql_query($sql);

$rows=mysql_fetch_array($result); ?>

<tr>

<td bgcolor= <?php echo $bgclr,">"; echo $rows['Nama_gejala']; ?> </td> <td align="center" bgcolor= <?php echo $bgclr,">"; ?><label>

<input type="radio" name="rad[<?php echo $rows['ID_gejala']; ?>]" value="1" /> </label> </td>

<td align="center" bgcolor= <?php echo $bgclr,">"; ?> <label>

<input type="radio" name="rad[<?php echo $rows['ID_gejala']; ?>]" value="0" /> </label></td>

<td align="center" bgcolor= <?php echo $bgclr,">"; ?> <label>

(8)

</label></td> </tr>

<?php if ($bgclr == "#00FF66") {

$bgclr = "#00FFFF"; }

else {

$bgclr = "#00FF66"; }

}

// Exit looping and close connection mysql_close();

?> <tr>

<td align="center" width="460" bgcolor= #33CC99> <?php

if ($_GET['err'] == "1") {

echo " <p style=color:red; > Data tidak lengkap, harap dicek kembali. </p>"; }

?> </td>

<input type="hidden" name="type_hp" value="<?php echo $type_hp; ?>"/> <input type="hidden" name="length_gejala" value="<?php echo $length_gejala; ?>"/>

<td align="center" width="20" bgcolor= #33CC99></td>

<td align="center" width="80" bgcolor= #33CC99><input type='submit' value='Next >>'></form></td>

<td align="center" width="20" bgcolor= #33CC99></td> </tr>

</table> </div>

<div class ="wrap1"> </div>

<div id="footer"> <div class ="wrap">

<p><br />&copy; 2015 - Nico Junari</p> </div></div>

<?php } ?> </body> </html>

3. Result.php (Halaman Result)

(9)

<html xmlns="http://www.w3.org/1999/xhtml"> <head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="stylesheet" type="text/css" href="style.css" />

<title>Result</title> </head>

<body> <?php

ob_start();//Hook output buffer include('config.php');

ob_end_clean();//Clear output buffer $bgclr = "#00FF66";

//check if field is empty,if yes,return to index if ($_GET['cf_end'] == null )

{

header('location:index.php?err=4'); exit();

}

$cf_enda=$_GET['cf_end']; $cf_enda= explode (" ",$cf_enda); $cf_end = $cf_enda[0]; $typeh = $cf_enda[1];

$cf_end = unserialize(base64_decode($cf_end)); ?>

<div id="header">

<div class="wrap"><strong>Sistem Pakar untuk Mendiagnosa Kerusakan

Handphone dengan Metode <em>Certainty

Factor</em></strong><em></em></div></div> <div id="headerpic">

<img src="pics/nokia 6600-2.jpg" title="Nokia 6600" class="headerpic" /> <img src="pics/Nokia-6600-Reviews.jpg" title="Nokia 6600" class="headerpic" /> <img src="pics/nokia6610.jpg" title="Nokia 6610" class="headerpic" />

<img src="pics/nokia6610_pic2.jpg" title="Nokia 6610" class="headerpic" /> <img src="pics/nokia6630.jpg" title="Nokia 6630" class="headerpic" /> <img src="pics/nokia6630-2.jpg" title="Nokia 6630" class="headerpic" /> <img src="pics/Nokia_6670.jpg" title="Nokia 6670" class="headerpic" /> <img src="pics/nokia_6670_L_01.jpg" title="Nokia 6670" class="headerpic" /> <img src="pics/n6680_main1.jpg" title="Nokia 6680" class="headerpic" /> <img src="pics/nokia6680.jpg" title="Nokia 6680" class="headerpic" /> </div>

<div id='menu'> <?php

ob_start();//Hook output buffer include('config.php');

ob_end_clean();//Clear output buffer

#in case user has come for first time and cookies are not set then if (!isset($_COOKIE['username']))

{

echo "<form action='check_login.php' method='post' name='formlogin'> <table width='307' height='58' border='0'>

(10)

<td width='69'>Username</td> <td width='10'>:</td>

<td width='153'><input type='text' name='loginusername' id='username' /></td>

<td width='345'></td> </tr>

<tr>

<td>Password</td> <td>:</td>

<td><input type='password' name='loginpass' id='loginpass' /></td> <td><input type='submit' name='login' id='login' value='Login' /></td> </tr>

</form> <tr>

<td colspan='4'>"; echo "</td>

</tr> </table>"; }

//if cookies are set then use them else{

echo "<table width='307' height='58' border='0'> <tr align='left'>

<td ><b>Welcome " . $_COOKIE["username"] . "</b> </td> </tr></table>"; }

?>

<!-- menu list -->

<label for="list_menu"></label>

<table width="139" border="0" align="left"> <tr align='left'>

<td><?php

if (isset($_COOKIE['username'])) {

echo "<form action='logout.php' method='post'> <input type='submit' value='Log Out' /></form>";

} ?></td> </tr>

<tr align='left'> <td><?php

if (isset($_COOKIE['type'])) {

if ($_COOKIE['type'] == 'Admin' || $_COOKIE['type'] == 'Pakar') {

echo "<form action='list_hp.php' method='post'> <input type='submit' value='List HP' /></form></td> </tr>

<tr align='left'>

(11)

</tr>

<tr align='left'> <td>";

}

if ($_COOKIE['type'] == 'Admin') {

echo "<form action='list_member.php' method='post'> <input type='submit' value='List Member' /></form>";

} } ?> </td> </tr>

<tr align='left'>

<td ><form action='about.php' method='post'> <input type='submit' value='About' /></form></td> </tr>

<tr> <td></td> </tr> </table> </div>

<div id="content">

<table width="700" border="1" align="center" cellpadding="3" cellspacing="1" > <tr>

<td width="280" align="center" bgcolor="#33CC99"><strong>Nama Masalah</strong></td>

<td width="20" align="center" bgcolor="#33CC99"><strong>Nilai CF</strong></td>

<td width="100" align="center" bgcolor="#33CC99"><strong>Definisi CF</strong></td>

<td width="300" align="center"

bgcolor="#33CC99"><strong>Solusi</strong></td> </tr>

<?php

$tbl = masalah.$typeh; $length_cf = count($cf_end); arsort($cf_end);

$varindex = array_keys($cf_end); for ($x =0; $x<$length_cf;$x++) {

$indexmasalah = $varindex[$x];

$sql="SELECT * FROM $tbl where ID_masalah = '$indexmasalah'"; $result=mysql_query($sql);

$rows=mysql_fetch_array($result) ?>

<tr>

(12)

<td align="center" bgcolor= <?php echo $bgclr,">"; if ($cf_end[$indexmasalah] == -0)

echo 0; else

echo $cf_end[$indexmasalah]; ?> </td>

<td align="center" bgcolor= <?php echo $bgclr,">"; if ($cf_end[$indexmasalah] == 1)

echo "Pasti";

else if ($cf_end[$indexmasalah] >= 0.8) echo "Hampir Pasti";

else if ($cf_end[$indexmasalah] >= 0.6) echo "Sepertinya";

else if ($cf_end[$indexmasalah] >= 0.2) echo "Mungkin";

else if ($cf_end[$indexmasalah] >= 0) echo "Mungkin ya dan mungkin saja tidak"; else if ($cf_end[$indexmasalah] >= -0.2) echo "Mungkin bukan";

else if ($cf_end[$indexmasalah] >= -0.6) echo "Sepertinya bukan";

else if ($cf_end[$indexmasalah] >= -0.8) echo "Bukan";

else if ($cf_end[$indexmasalah] == -1) echo "Pasti Bukan";

else

echo "Tidak diketahui"; ?> </td>

<td align="center" bgcolor= <?php echo $bgclr,">"; if ($cf_end[$indexmasalah] >= 0)

echo $rows['Solusi']; ?> </td>

</tr> <?php

if ($bgclr == "#00FF66") {

$bgclr = "#00FFFF"; }

else {

$bgclr = "#00FF66"; }

}

// Exit looping and close connection mysql_close();

?> <tr>

<td align="center" width="280" bgcolor= #33CC99></td> <td align="center" width="20" bgcolor= #33CC99></td>

(13)

<td align="center" width="300" bgcolor= #33CC99></td> </tr>

</table> </div>

<div class ="wrap1"> </div>

<div id="footer"> <div class ="wrap">

<p><br />&copy; 2015 - Nico Junari</p> </div></div>

</body> </html>

4. Result_pr.php (Halaman Result Proses)

<!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>Untitled Document</title>

</head> <body> <p> <?php

ob_start();//Hook output buffer include('config.php');

ob_end_clean();//Clear output buffer $type_hp = $_POST['type_hp'];

$length_gejala = $_POST['length_gejala']; $rad = $_POST['rad'];

//check if field is empty,if yes,return

if ($rad == null || $length_gejala != count($rad)) {

header('location:process.php?err=1&type_hp='.$type_hp); exit();

} else {

$typeh = str_replace(' ','',$type_hp); $tblaturan="aturan".$typeh;

$tblmasalah="masalah".$typeh; $sql="SELECT * FROM $tblaturan"; $result=mysql_query($sql);

while($rows=mysql_fetch_array($result)){ $x = $rows['ID_gejala'];

$cf_pakar[] = $rad[$x];

(14)

$id_masalah =array_unique($id_masalah); sort($id_masalah);

$length_masalah = count($id_masalah); for ($y =0; $y<$length_masalah;$y++) {

$z = $id_masalah[$y];

$sql="SELECT * FROM $tblaturan WHERE ID_masalah = '$z'"; $result=mysql_query($sql);

while($rows=mysql_fetch_array($result)){ $x = $rows['ID_rule']-1;

if ($cf_end[$z] === null) {

$cf_end[$z] = $cf_pakar[$x]; }

else {

$cf_end[$z] = min($cf_pakar[$x],$cf_end[$z]);

} } }

$sql="SELECT * FROM $tblmasalah"; $result=mysql_query($sql);

while($rows=mysql_fetch_array($result)){ $x = $rows['ID_masalah'];

$cf_end[$x] = $rows['CF_pakar'] * $cf_end[$x]; }

$cf_end = base64_encode(serialize($cf_end)); $cf_end = $cf_end.' '.$typeh; header('location:result.php?cf_end='.$cf_end);

exit(); }

?> </body> </html>

5. Style.css

/*CSS RESET*/

html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li,

fieldset, form, label, legend,

table, caption, tbody, tfoot, thead, tr, th, td { margin: 0;

padding: 0; border: 0; outline: 0;

(15)

font-size: 100%; vertical-align: baseline; }

body {

line-height: 1; color: black; background: white; }

ol, ul {

list-style: none; }

/* tables still need 'cellspacing="0"' in the markup */ table {

border-collapse: separate; border-spacing: 1; }

caption, th { text-align: left; font-weight: normal; }

blockquote:before, blockquote:after, q:before, q:after {

content: ""; }

blockquote, q { quotes: "" ""; }

strong {

font-weight:bold;color:#000; }

em {

font-style:oblique; }

p {

margin:15px 0; }

.aligncenter, div.aligncenter { display: block;

margin-left: auto; margin-right: auto; }

.alignleft { float: left; }

(16)

float: right; }

h1 {font-size:180%;} h2 {font-size:150%;} h3 {font-size:125%;} h4 {font-size:100%;} h5 {font-size:90%;} h6 {font-size:80%;}

a:link {color:#0289ce;} a:hover {color:#f64274;}

/*End RESET - Begin Full Width CSS*/

body {

text-align: center;

}

img {

margin: 2px; padding: 5px; }

table {

margin: 5px; padding: 5px;

border-collapse:separate; border-spacing: 2px; }

#content td { padding: 5px; }

.wrap {

padding:25px; }

#header, #headerpic, #footer, #content { margin:0 auto;

padding:15px 0; min-width:100%; }

(17)

float:left; width:400px; height::300px; }

#content {

text-align: left;

}

#header {

font-size:36px; }

.contentbig {

font-size:20px; }

.headerpic {

min-width:80px; min-height:100px; max-height:100px; max-width:80px; }

.wrap1 {

padding:50px; }

#footer {

/* position:fixed; bottom:0; */ text-align:center; }

6. About.php (Halaman About)

<!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" /> <link rel="stylesheet" type="text/css" href="style.css" />

<title>About</title> </head>

<body>

(18)

<div class="wrap"><strong>Sistem Pakar untuk Mendiagnosa Kerusakan

Handphone dengan Metode <em>Certainty

Factor</em></strong><em></em></div></div> <div id="headerpic">

<img src="pics/nokia 6600-2.jpg" title="Nokia 6600" class="headerpic" /> <img src="pics/Nokia-6600-Reviews.jpg" title="Nokia 6600" class="headerpic" /> <img src="pics/nokia6610.jpg" title="Nokia 6610" class="headerpic" />

<img src="pics/nokia6610_pic2.jpg" title="Nokia 6610" class="headerpic" /> <img src="pics/nokia6630.jpg" title="Nokia 6630" class="headerpic" /> <img src="pics/nokia6630-2.jpg" title="Nokia 6630" class="headerpic" /> <img src="pics/Nokia_6670.jpg" title="Nokia 6670" class="headerpic" /> <img src="pics/nokia_6670_L_01.jpg" title="Nokia 6670" class="headerpic" /> <img src="pics/n6680_main1.jpg" title="Nokia 6680" class="headerpic" /> <img src="pics/nokia6680.jpg" title="Nokia 6680" class="headerpic" /> </div>

<div id='menu'> <?php

ob_start();//Hook output buffer include('config.php');

ob_end_clean();//Clear output buffer

#in case user has come for first time and cookies are not set then if (!isset($_COOKIE['username']))

{

echo "<form action='check_login.php' method='post' name='formlogin'> <table width='307' height='58' border='0'>

<tr>

<td width='69'>Username</td> <td width='10'>:</td>

<td width='153'><input type='text' name='loginusername' id='username' /></td>

<td width='345'></td> </tr>

<tr>

<td>Password</td> <td>:</td>

<td><input type='password' name='loginpass' id='loginpass' /></td> <td><input type='submit' name='login' id='login' value='Login' /></td> </tr>

</form> <tr>

<td colspan='4'></td> </tr>

</table>"; }

//if cookies are set then use them else{

(19)

<td align='justify'><b>Welcome " . $_COOKIE["username"] . "</b> </td> </tr></table>";

} ?>

<!-- menu list -->

<label for="list_menu"></label>

<table width="139" border="0" align="left"> <tr align='left'>

<td><?php

if (isset($_COOKIE['username'])) {

echo "<form action='logout.php' method='post'> <input type='submit' value='Log Out' /></form>";

} ?></td> </tr>

<tr align='left'> <td><?php

if (isset($_COOKIE['type'])) {

if ($_COOKIE['type'] == 'Admin' || $_COOKIE['type'] == 'Pakar') {

echo "<form action='list_hp.php' method='post'> <input type='submit' value='List HP' /></form></td> </tr>

<tr align='left'>

<td><form action='list_gejala.php' method='post'> <input type='submit' value='List Gejala' /></form></td> </tr>

<tr align='left'> <td>";

}

if ($_COOKIE['type'] == 'Admin') {

echo "<form action='list_member.php' method='post'> <input type='submit' value='List Member' /></form>";

} } ?> </td> </tr>

<tr align='left'>

<td><form action='index.php' method='post'> <input type='submit' value='Index' /></form></td> </tr>

<tr>

<td>&nbsp;</td> </tr>

(20)

<div id="content">

<p>Sistem ini dibuat oleh :</p>

<p class="contentbig"> <strong>Nico Junari <br /> 071401058

<br />

Ilmu Komputer S1 </strong></p> </div>

<div class ="wrap1"> </div>

<div id="footer"> <div class ="wrap">

<p>&copy; 2015 - Nico Junari</p> </div></div>

</body> </html>

7. Add_aturan.php (Halaman Add Aturan)

<!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" /> <link rel="stylesheet" type="text/css" href="style.css" />

<title>Add Aturan</title> </head>

<body> <?php

#in case user has come for first time and cookies are not set then if (!isset($_COOKIE['username']))

{

header('location:index.php?err=3'); exit();

} ?>

<div id="header">

<div class="wrap"><strong>Sistem Pakar untuk Mendiagnosa Kerusakan

Handphone dengan Metode <em>Certainty

Factor</em></strong><em></em></div></div> <div id="headerpic">

<img src="pics/nokia 6600-2.jpg" title="Nokia 6600" class="headerpic" /> <img src="pics/Nokia-6600-Reviews.jpg" title="Nokia 6600" class="headerpic" /> <img src="pics/nokia6610.jpg" title="Nokia 6610" class="headerpic" />

(21)

<img src="pics/nokia6680.jpg" title="Nokia 6680" class="headerpic" /> </div>

<div id='menu'> <?php

ob_start();//Hook output buffer include('config.php');

ob_end_clean();//Clear output buffer //check if field is empty,if yes,return if ($_POST['type_hp'] == null) {

header('location:list_aturan.php?notice=4'); exit();

}

$typehp = $_POST['type_hp']; $type_hp = stripslashes($typehp); $typeh= str_replace(' ','',$type_hp); $tbl_name="gejala";

$tbl_name1="masalah".$typeh; //use cookies

echo "<table width='307' height='58' border='0'> <tr>

<td align='justify'><b>Welcome " . $_COOKIE["username"] . "</b> </td> </tr></table>";

?>

<!-- menu list -->

<label for="list_menu"></label>

<table width="139" border="0" align="left"> <tr align='left'>

<td><?php

if (isset($_COOKIE['username'])) {

echo "<form action='logout.php' method='post'> <input type='submit' value='Log Out' /></form>"; } ?></td>

</tr>

<tr align='left'> <td><?php

if (isset($_COOKIE['type'])) {

if ($_COOKIE['type'] == 'Admin' || $_COOKIE['type'] == 'Pakar') {

echo "<form action='list_hp.php' method='post'> <input type='submit' value='List HP' /></form></td> </tr>

<tr align='left'>

<td><form action='index.php' method='post'> <input type='submit' value='Index' /></form></td> </tr>

(22)

<td>"; }

if ($_COOKIE['type'] == 'Admin') {

echo "<form action='list_member.php' method='post'> <input type='submit' value='List Member' /></form>";

} } ?> </td> </tr>

<tr align='left'>

<td><form action='about.php' method='post'> <input type='submit' value='About' /></form></td> </tr>

</table> </div>

<div id="content">

<form method="post" action="add_aturan_pr.php"> <table width="349" height="151" border="0"> <tr>

<td width="89">No Aturan</td> <td width="9">:</td>

<td width="237"><input name="newidrule" type="text" size="30"></textarea></td>

</tr> <tr>

<td width="89">Nama Masalah</td> <td width="9">:</td>

<td width="237"><select name="select_masalah" > <?php

$sql="SELECT * FROM $tbl_name1"; $result=mysql_query($sql);

while($rows=mysql_fetch_array($result)){ ?>

<option value="<?php echo $rows['ID_masalah'];?>"> <?php echo $rows['Nama_masalah']; ?></option>

<?php }

?></select> </td> </tr> <tr>

<td width="89">Nama Gejala</td> <td width="9">:</td>

<td width="237"><select name="select_gejala" > <?php

(23)

while($rows=mysql_fetch_array($result)){ ?>

<option value="<?php echo $rows['ID_gejala'];?>"> <?php echo $rows['Nama_gejala']; ?></option>

<?php }

?></select> </td> </tr> <tr>

<td>&nbsp;</td>

<td>&nbsp;</td><input type="hidden" name="type_hp" value="<?php echo $type_hp; ?>"/>

<td><input type='submit' value='Add' /></td> </tr>

</table> </form> </div>

<div class ="wrap1"> </div>

<div id="footer"> <div class ="wrap">

<p>&copy; 2015 - Nico Junari</p> </div></div>

</body> </html>

8. Add_aturan_pr.php (Halaman Add Aturan Proses)

<!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>Untitled Document</title>

</head> <body> <p> <?php

ob_start();//Hook output buffer include('config.php');

ob_end_clean();//Clear output buffer //check if field is empty,if yes,return

if ($_POST['newidrule'] == null || $_POST['select_masalah'] == null || $_POST['select_gejala'] == null || $_POST['type_hp'] == null)

{

header('location:list_hp.php?notice=7'); exit();

(24)

$typehp = $_POST['type_hp']; $newidrule=$_POST['newidrule'];

$select_masalah=$_POST['select_masalah']; $select_gejala=$_POST['select_gejala']; // To protect against MySQL injection $type_hp = stripslashes($typehp); $typehp= str_replace(' ','',$type_hp); $type_hp = str_replace(' ','+',$type_hp); $tbl_name = 'aturan'.$typehp;

$newidrule = stripslashes($newidrule);

$newidrule = mysql_real_escape_string($newidrule); //check if input is numbers

if ( !is_numeric($newidrule)) {

header('location:list_aturan.php?notice=4&type_hp='.$type_hp); exit();

}

//check if ID number is used

$sql="SELECT * FROM $tbl_name where ID_rule = $newidrule"; $result=mysql_query($sql);

$rows=mysql_fetch_array($result); if ($rows == null )

{

$sql="insert into $tbl_name(ID_rule,ID_masalah,ID_gejala)

values('$newidrule','$select_masalah','$select_gejala')"; mysql_query($sql);

header('location:list_aturan.php?notice=2&type_hp='.$type_hp); }

else {

header('location:list_aturan.php?notice=4&type_hp='.$type_hp); }

?> </body> </html>

9. Add_gejala.php (Halaman Add Gejala)

<!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" /> <link rel="stylesheet" type="text/css" href="style.css" />

<title>Add Gejala</title> </head>

<body> <?php

(25)

if (!isset($_COOKIE['username'])) {

header('location:index.php?err=3'); exit();

} ?>

<div id="header">

<div class="wrap"><strong>Sistem Pakar untuk Mendiagnosa Kerusakan

Handphone dengan Metode <em>Certainty

Factor</em></strong><em></em></div></div> <div id="headerpic">

<img src="pics/nokia 6600-2.jpg" title="Nokia 6600" class="headerpic" /> <img src="pics/Nokia-6600-Reviews.jpg" title="Nokia 6600" class="headerpic" /> <img src="pics/nokia6610.jpg" title="Nokia 6610" class="headerpic" />

<img src="pics/nokia6610_pic2.jpg" title="Nokia 6610" class="headerpic" /> <img src="pics/nokia6630.jpg" title="Nokia 6630" class="headerpic" /> <img src="pics/nokia6630-2.jpg" title="Nokia 6630" class="headerpic" /> <img src="pics/Nokia_6670.jpg" title="Nokia 6670" class="headerpic" /> <img src="pics/nokia_6670_L_01.jpg" title="Nokia 6670" class="headerpic" /> <img src="pics/n6680_main1.jpg" title="Nokia 6680" class="headerpic" /> <img src="pics/nokia6680.jpg" title="Nokia 6680" class="headerpic" /> </div>

<div id='menu'> <?php

ob_start();//Hook output buffer include('config.php');

ob_end_clean();//Clear output buffer //use cookies

echo "<table width='307' height='58' border='0'> <tr>

<td align='justify'><b>Welcome " . $_COOKIE["username"] . "</b> </td> </tr></table>";

?>

<!-- menu list -->

<label for="list_menu"></label>

<table width="139" border="0" align="left"> <tr align='left'>

<td><?php

if (isset($_COOKIE['username'])) {

echo "<form action='logout.php' method='post'> <input type='submit' value='Log Out' /></form>";

} ?></td> </tr>

<tr align='left'> <td><?php

if (isset($_COOKIE['type'])) {

(26)

{

echo "<form action='list_hp.php' method='post'> <input type='submit' value='List HP' /></form></td> </tr>

<tr align='left'>

<td><form action='list_gejala.php' method='post'> <input type='submit' value='List Gejala' /></form></td> </tr>

<tr align='left'> <td>";

}

if ($_COOKIE['type'] == 'Admin') {

echo "<form action='list_member.php' method='post'> <input type='submit' value='List Member' /></form>";

} } ?> </td> </tr>

<tr align='left'>

<td><form action='about.php' method='post'> <input type='submit' value='About' /></form></td> </tr>

<tr align='left'>

<td><form action='index.php' method='post'> <input type='submit' value='Index' /></form></td> </tr>

</table> </div>

<div id="content">

<form method="post" action="add_gejala_pr.php"> <table width="349" height="151" border="0">

<tr>

<td width="89">No Gejala</td> <td width="9">:</td>

<td width="237"><input name="newidgejala" type="text" size="30"/></td> </tr>

<tr>

<td width="89">Nama Gejala</td> <td width="9">:</td>

<td width="237"><textarea name="newnamagejala" id="newnamagejala" cols="45" rows="5"></textarea></td>

</tr> <tr> <td></td> <td></td>

(27)

</table> </form> </div>

<div class ="wrap1"> </div>

<div id="footer"> <div class ="wrap">

<p>&copy; 2015 - Nico Junari</p> </div></div>

</body> </html>

10. Add_gejala_pr.php (Halaman Add Gejala Proses)

<!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>Untitled Document</title>

</head> <body> <p> <?php

ob_start();//Hook output buffer include('config.php');

ob_end_clean();//Clear output buffer $tbl_name='gejala';

//check if field is empty,if yes,return

if ($_POST['newnamagejala'] == null || $_POST['newidgejala'] == null) {

header('location:list_gejala.php?notice=4'); exit();

}

$newnamagejala=$_POST['newnamagejala']; $newidgejala=$_POST['newidgejala']; // To protect against MySQL injection

$newnamagejala = stripslashes($newnamagejala); $newidgejala = stripslashes($newidgejala);

$newnamagejala = mysql_real_escape_string($newnamagejala); $newidgejala = mysql_real_escape_string($newidgejala); //check if input is numbers

if ( !is_numeric($newidgejala)) {

header('location:list_gejala.php?notice=4'); exit();

}

//check if ID number is used

(28)

$result=mysql_query($sql); $rows=mysql_fetch_array($result); if ($rows == null )

{

$sql="insert into $tbl_name(ID_gejala,Nama_gejala)

values('$newidgejala','$newnamagejala')"; mysql_query($sql);

header('location:list_gejala.php?notice=2'); }

else {

header('location:list_gejala.php?notice=4'); }

?> </body> </html>

11. Add_HP.php (Halaman Add HP)

<!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" /> <link rel="stylesheet" type="text/css" href="style.css" />

<title>Add HP</title> </head>

<body> <?php

#in case user has come for first time and cookies are not set then if (!isset($_COOKIE['username']))

{

header('location:index.php?err=3'); exit();

} ?>

<div id="header">

<div class="wrap"><strong>Sistem Pakar untuk Mendiagnosa Kerusakan

Handphone dengan Metode <em>Certainty

Factor</em></strong><em></em></div></div> <div id="headerpic">

<img src="pics/nokia 6600-2.jpg" title="Nokia 6600" class="headerpic" /> <img src="pics/Nokia-6600-Reviews.jpg" title="Nokia 6600" class="headerpic" /> <img src="pics/nokia6610.jpg" title="Nokia 6610" class="headerpic" />

(29)

<img src="pics/n6680_main1.jpg" title="Nokia 6680" class="headerpic" /> <img src="pics/nokia6680.jpg" title="Nokia 6680" class="headerpic" /> </div>

<div id='menu'> <?php

ob_start();//Hook output buffer include('config.php');

ob_end_clean();//Clear output buffer //use cookies

echo "<table width='307' height='58' border='0'> <tr>

<td align='justify'><b>Welcome " . $_COOKIE["username"] . "</b> </td> </tr></table>";

?>

<!-- menu list -->

<label for="list_menu"></label>

<table width="139" border="0" align="left"> <tr align='left'>

<td><?php

if (isset($_COOKIE['username'])) {

echo "<form action='logout.php' method='post'> <input type='submit' value='Log Out' /></form>";

} ?></td> </tr>

<tr align='left'> <td><?php

if (isset($_COOKIE['type'])) {

if ($_COOKIE['type'] == 'Admin' || $_COOKIE['type'] == 'Pakar') {

echo "<form action='list_hp.php' method='post'> <input type='submit' value='List HP' /></form></td> </tr>

<tr align='left'>

<td><form action='list_gejala.php' method='post'> <input type='submit' value='List Gejala' /></form></td> </tr>

<tr align='left'> <td>";

}

if ($_COOKIE['type'] == 'Admin') {

echo "<form action='list_member.php' method='post'> <input type='submit' value='List Member' /></form>";

(30)

</tr>

<tr align='left'>

<td><form action='about.php' method='post'> <input type='submit' value='About' /></form></td> </tr>

<tr align='left'>

<td><form action='index.php' method='post'> <input type='submit' value='Index' /></form></td> </tr>

</table> </div>

<div id="content">

<form method="post" action="add_hp_pr.php"> <table width="541" height="151" border="0"> <tr>

<td width="79">Type HP</td> <td width="10">:</td>

<td width="438"><input name="newtypehp" type="text" size="30"/></td> </tr>

<tr> <td></td> <td></td>

<td><input type='submit' value='Add' /></td> </tr>

</table> </form> </div>

<div class ="wrap1"> </div>

<div id="footer"> <div class ="wrap">

<p>&copy; 2015 - Nico Junari</p> </div></div>

</body> </html>

12. Add_HP_pr.php (Halaman Add HP Proses)

<!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>Untitled Document</title>

</head> <body> <?php

(31)

ob_end_clean();//Clear output buffer

$tbl_name='hp';

//check if field is empty,if yes,return if ($_POST['newtypehp'] == null) {

header('location:list_hp.php?notice=4'); exit();

}

$newtypehp = $_POST['newtypehp']; // To protect against MySQL injection $newtypehp = stripslashes($newtypehp);

$newtypehp = mysql_real_escape_string($newtypehp);

$sql="SELECT * FROM $tbl_name where Type_hp = '$newtypehp'"; $result=mysql_query($sql);

$rows=mysql_fetch_array($result); if ($rows == null )

{

$sql="insert into $tbl_name (Type_hp) values('$newtypehp')"; mysql_query($sql);

$typeh = str_replace(' ','',$newtypehp); $tbl_name1 = 'aturan'.$typeh;

$tbl_name2 = 'masalah'.$typeh;

$sql="create table $tbl_name1(ID_rule int(4) not null primary key,ID_masalah int(4) not null,ID_gejala int(4) not null,CF_pakar float not null)";

mysql_query($sql);

$sql="create table $tbl_name2(ID_masalah int(4) not null primary key,Nama_masalah varchar(100) not null,Solusi varchar(300) not null)";

mysql_query($sql);

header('location:list_hp.php?notice=2'); exit();

} else {

header('location:list_hp.php?notice=4'); }

?> </body> </html>

13. Add_Masalah.php (Halaman Add Masalah)

<!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" /> <link rel="stylesheet" type="text/css" href="style.css" />

(32)

</head> <body> <?php

#in case user has come for first time and cookies are not set then if (!isset($_COOKIE['username']))

{

header('location:index.php?err=3'); exit();

} ?>

<div id="header">

<div class="wrap"><strong>Sistem Pakar untuk Mendiagnosa Kerusakan

Handphone dengan Metode <em>Certainty

Factor</em></strong><em></em></div></div> <div id="headerpic">

<img src="pics/nokia 6600-2.jpg" title="Nokia 6600" class="headerpic" /> <img src="pics/Nokia-6600-Reviews.jpg" title="Nokia 6600" class="headerpic" /> <img src="pics/nokia6610.jpg" title="Nokia 6610" class="headerpic" />

<img src="pics/nokia6610_pic2.jpg" title="Nokia 6610" class="headerpic" /> <img src="pics/nokia6630.jpg" title="Nokia 6630" class="headerpic" /> <img src="pics/nokia6630-2.jpg" title="Nokia 6630" class="headerpic" /> <img src="pics/Nokia_6670.jpg" title="Nokia 6670" class="headerpic" /> <img src="pics/nokia_6670_L_01.jpg" title="Nokia 6670" class="headerpic" /> <img src="pics/n6680_main1.jpg" title="Nokia 6680" class="headerpic" /> <img src="pics/nokia6680.jpg" title="Nokia 6680" class="headerpic" /> </div>

<div id='menu'> <?php

ob_start();//Hook output buffer include('config.php');

ob_end_clean();//Clear output buffer //check if field is empty,if yes,return if ($_POST['type_hp'] == null) {

header('location:list_aturan.php?notice=4'); exit();

}

$typehp = $_POST['type_hp']; $type_hp = stripslashes($typehp);

//use cookies

echo "<table width='307' height='58' border='0'> <tr>

<td align='justify'><b>Welcome " . $_COOKIE["username"] . "</b> </td> </tr></table>";

?>

<!-- menu list -->

<label for="list_menu"></label>

(33)

<tr align='left'> <td><?php

if (isset($_COOKIE['username'])) {

echo "<form action='logout.php' method='post'> <input type='submit' value='Log Out' /></form>";

} ?></td> </tr>

<tr align='left'> <td><?php

if (isset($_COOKIE['type'])) {

if ($_COOKIE['type'] == 'Admin' || $_COOKIE['type'] == 'Pakar') {

echo "<form action='list_hp.php' method='post'> <input type='submit' value='List HP' /></form></td> </tr>

<tr align='left'>

<td><form action='index.php' method='post'> <input type='submit' value='Index' /></form></td> </tr>

<tr align='left'> <td>";

}

if ($_COOKIE['type'] == 'Admin') {

echo "<form action='list_member.php' method='post'> <input type='submit' value='List Member' /></form>";

} } ?> </td> </tr>

<tr align='left'>

<td><form action='about.php' method='post'> <input type='submit' value='About' /></form></td> </tr>

</table> </div>

<div id="content">

<form method="post" action="add_masalah_pr.php"> <table width="349" height="151" border="0"> <tr>

<td width="89">No Masalah</td> <td width="9">:</td>

<td width="237"><input name="newidmasalah" type="text" size="30"></textarea></td>

(34)

<td width="89">Nama Masalah</td> <td width="9">:</td>

<td width="237"><textarea name="newnamamasalah" id="newnamamasalah" cols="45" rows="5"></textarea></td>

</tr> <tr>

<td width="89">Solusi</td> <td width="9">:</td>

<td width="237"><textarea name="newsolusi" id="newsolusi" cols="45" rows="5"></textarea></td>

</tr> <tr>

<td width="89">CF Pakar</td> <td width="9">:</td>

<td width="237">

<select name="select_cf">

<option value="1">Pasti [1]</option>

<option value="0.8">Hampir Pasti [0.8]</option> <option value="0.6">Sepertinya [0.6]</option> <option value="0.4">Mungkin [0.4]</option> <option value="0.2">Tidak Diketahui [0.2]</option>

<option selected="selected" value="0">Tidak Diketahui [0]</option> <option value="-0.2">Tidak Diketahui [-0.2]</option>

<option value="-0.4">Mungkin Bukan [-0.4]</option> <option value="-0.6">Sepertinya Bukan [-0.6]</option> <option value="-0.8">Bukan [-0.8]</option>

<option value="-1">Pasti Bukan [-1]</option> </select></td>

</tr>

<tr><input type="hidden" name="type_hp" value="<?php echo $type_hp; ?>"/> <td>&nbsp;</td>

<td>&nbsp;</td>

<td><input type='submit' value='Add' /></td> </tr>

</table> </form> </div>

<div class ="wrap1"> </div>

<div id="footer"> <div class ="wrap">

<p>&copy; 2015 - Nico Junari</p> </div></div>

</body> </html>

(35)

<!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>Untitled Document</title>

</head> <body> <p> <?php

ob_start();//Hook output buffer include('config.php');

ob_end_clean();//Clear output buffer //check if field is empty,if yes,return

if ($_POST['newnamamasalah'] == null || $_POST['newsolusi'] == null || $_POST['newidmasalah'] == null || $_POST['type_hp'] == null || $_POST['select_cf'] == null )

{

header('location:list_hp.php?notice=7'); exit();

}

$newnamamasalah=$_POST['newnamamasalah']; $newsolusi=$_POST['newsolusi'];

$newidmasalah=$_POST['newidmasalah']; $type_hp=$_POST['type_hp'];

$select_cf=$_POST['select_cf']; // To protect against MySQL injection

$newnamamasalah = stripslashes($newnamamasalah); $newsolusi = stripslashes($newsolusi);

$newidmasalah = stripslashes($newidmasalah); $type_hp = stripslashes($type_hp);

$newnamamasalah = mysql_real_escape_string($newnamamasalah); $newsolusi = mysql_real_escape_string($newsolusi);

$newidmasalah = mysql_real_escape_string($newidmasalah); $typehp= str_replace(' ','',$type_hp);

$tbl_name='masalah'.$typehp; //check if input is numbers if ( !is_numeric($newidmasalah)) {

header('location:list_masalah.php?notice=4'); exit();

}

//check if ID number is used

$sql="SELECT * FROM $tbl_name where ID_masalah = $newidmasalah"; $result=mysql_query($sql);

$rows=mysql_fetch_array($result); if ($rows == null )

(36)

$sql="insert into $tbl_name(ID_masalah,Nama_masalah,Solusi,CF_pakar) values('$newidmasalah','$newnamamasalah','$newsolusi','$select_cf')";

mysql_query($sql); echo $sql;

header('location:list_masalah.php?notice=2&type_hp='.$type_hp); }

else {

header('location:list_masalah.php?notice=4&type_hp='.$type_hp); }

?> </body> </html>

10. Add_Member.php (Halaman Add Member)

<!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" /> <link rel="stylesheet" type="text/css" href="style.css" />

<title>Add Member</title> </head>

<body> <?php

#in case user has come for first time and cookies are not set then if (!isset($_COOKIE['username']))

{

header('location:index.php?err=3'); exit();

} ?>

<div id="header">

<div class="wrap"><strong>Sistem Pakar untuk Mendiagnosa Kerusakan

Handphone dengan Metode <em>Certainty

Factor</em></strong><em></em></div></div> <div id="headerpic">

<img src="pics/nokia 6600-2.jpg" title="Nokia 6600" class="headerpic" /> <img src="pics/Nokia-6600-Reviews.jpg" title="Nokia 6600" class="headerpic" /> <img src="pics/nokia6610.jpg" title="Nokia 6610" class="headerpic" />

<img src="pics/nokia6610_pic2.jpg" title="Nokia 6610" class="headerpic" /> <img src="pics/nokia6630.jpg" title="Nokia 6630" class="headerpic" /> <img src="pics/nokia6630-2.jpg" title="Nokia 6630" class="headerpic" /> <img src="pics/Nokia_6670.jpg" title="Nokia 6670" class="headerpic" /> <img src="pics/nokia_6670_L_01.jpg" title="Nokia 6670" class="headerpic" /> <img src="pics/n6680_main1.jpg" title="Nokia 6680" class="headerpic" /> <img src="pics/nokia6680.jpg" title="Nokia 6680" class="headerpic" /> </div>

(37)

<?php

ob_start();//Hook output buffer include('config.php');

ob_end_clean();//Clear output buffer //use cookies

echo "<table width='307' height='58' border='0'> <tr>

<td align='justify'><b>Welcome " . $_COOKIE["username"] . "</b> </td> </tr></table>";

?>

<!-- menu list -->

<label for="list_menu"></label>

<table width="139" border="0" align="left"> <tr align='left'>

<td><?php

if (isset($_COOKIE['username'])) {

echo "<form action='logout.php' method='post'> <input type='submit' value='Log Out' /></form>";

} ?></td> </tr>

<tr align='left'> <td><?php

if (isset($_COOKIE['type'])) {

if ($_COOKIE['type'] == 'Admin' || $_COOKIE['type'] == 'Pakar') {

echo "<form action='list_hp.php' method='post'> <input type='submit' value='List HP' /></form></td> </tr>

<tr align='left'>

<td><form action='list_gejala.php' method='post'> <input type='submit' value='List Gejala' /></form></td> </tr>

<tr align='left'> <td>";

}

if ($_COOKIE['type'] == 'Admin') {

echo "<form action='list_member.php' method='post'> <input type='submit' value='List Member' /></form>";

} } ?> </td> </tr>

<tr align='left'>

(38)

</tr> <tr> <td></td> </tr> </table> </div>

<div id="content">

<form method="post" action="add_member_pr.php"> <table width="342" height="151" border="0"> <tr>

<td width="91">No Member</td> <td width="11">:</td>

<td width="153">

<input type="text" name="newidmember" id="newidmember" /></td> </tr>

<tr>

<td width="91">Username</td> <td width="11">:</td>

<td width="153">

<input type="text" name="newusername" id="newusername" /></td> </tr>

<tr>

<td>Password</td> <td>:</td>

<td>

<input type="password" name="newpass" id="newpass" /></td> </tr>

<tr>

<td>Type</td> <td>:</td> <td>

<select name="newtype" id="newtype"> <option value="Admin">Admin</option>

<option selected="selected" value="Pakar">Pakar</option> </select></td>

</tr> <tr> <td></td> <td></td>

<td><input type='submit' value='Add' /></td> </tr>

</table> </form> </div>

<div class ="wrap1"> </div>

<div id="footer"> <div class ="wrap">

(39)

</div></div> </body> </html>

11. Add_Member_pr.php (Halaman Add Member Proses)

<!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>Untitled Document</title>

</head> <body> <p> <?php

ob_start();//Hook output buffer include('config.php');

ob_end_clean();//Clear output buffer $tbl_name='member';

//check if field is empty,if yes,return

if ($_POST['newusername'] == null || $_POST['newpass'] == null || $_POST['newidmember'] == null || $_POST['newtype'] == null)

{

header('location:list_member.php?notice=4'); exit();

}

// Define $myusername and $mypassword $myusername=$_POST['newusername']; $mypassword=$_POST['newpass']; $id_member=$_POST['newidmember']; $mytype=$_POST['newtype'];

// To protect against MySQL injection $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $id_member = stripslashes($id_member); $mytype = stripslashes($mytype);

$mytype = mysql_real_escape_string($mytype);

$myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $id_member = mysql_real_escape_string($id_member); // encrypt password

$mypassword=md5($mypassword); //check if input is numbers

if ( !is_numeric($id_member)) {

header('location:list_member.php?notice=4'); exit();

Referensi

Dokumen terkait

Tv One (sebelumnya bernama Lativi) adalah sebuah stasiun televisi swasta Indonesia. Berawal dari penggunaan nama Lativi, stasiun televisi ini didirikan pada tanggal 30

Pendidikan budaya dan karakter bangsa secara terintegrasi di dalam proses pembelajaran adalah pengenalan nilai-nilai, fasilitasi diperolehnya kesadaran akan

dalam menggunakan alat cetak tersebut, diantaranya: pinggang dan punggung yang sakit karena terlalu sering membungkuk, panas yang yang langsung memapar produsen kue

Berdasarkan hasil penelusuran peneliti melalui dokumen LAKIP Tahun 2015 dari beberapa Bappeda di wilayah provinsi Jawa Timur, yaitu Bappeda Kabupaten Banyuwangi,

Peserta mengerti karakteristik dan dapat mendesain filter analog low- pass jenis Butterworth, Chebyshev, Elliptic, dan Bessel.. Response

Kota Surakarta memiliki pasar tradisional yang cukup banyak, ada 28 pasar tradisional yaitu pasar Legi, pasar Nongko, pasar Bangunharjo, pasar Nusukan, pasar

11.4 Peserta dapat mengambil salinan Adendum Dokumen Sayembara yang disediakan oleh Pejabat Pengadaan pada Sekretariat Daerah Kabupaten Barito Selatan Dalam Adendum Dokumen

Yang bertanda tangan di bawah ini menyatakan bahwa Tugas Akhir berjudul “Implementasi Penyetoran PPh Final Atas Barang Lelang Eksekusi Pada Kantor Pelayanan