Anda di halaman 1dari 11

DOKUMENTASI KOD SUMBER BAGI SISTEMTEMPLATE SOURCE CODE

PENGURUSAN GYM
Versi Tarikh Diluluskan Pemilik
1.0 14/3/2024 MOHAMAD HARIDZ BIN
MOHAMED HAIRUDDIN

1. Tujuan
Dokumentasi ini bertujuan sebagai keperluan untuk mengurus kod sumber, memastikan
kawalan versi, mengurus dokumen berkaitan dan mengawal risiko kehilangan kod
sumber.

2. Maklumat Asas
2.1 Sistem

• Sistem ini mengunakan software windows 11


• Sistem ini adalah untuk memudahkan pengguna Gym mengira
BMI mereka sendiri

• Tajuk sistem : Pengurusan Gym


• System code: G00192

• Configurasi system
-HTML
-CSS
-Javascript

• Software and hardware requirement


-Visual Studio Code
-XAMPP
2.2 Rujukan Projek TEMPLATE SOURCE CODE

Website : GYMBROS.COM

2.3 Hubungi

MOHAMAD HARIDZ BIN MOHAMED HAIRUDDIN


014-315 6439

3. Kod Sumber

Skrin pertama:

Keterangan : Ini adalah untuk pengguna login apabila mereka ada member.
Jika tidak ada member boleh menekan butang sign up
Kod Sumber:
TEMPLATE SOURCE CODE
Html :
<html>
<head>
<title> LOGIN Validationm </title>
<!-- Include CSS File Here -->
<link rel="stylesheet" href="logStyle.css"/>
<!-- Include JS File Here -->
<script src="login2.js"></script>
</head>
<body>
<body style="background-color:powderblue;">

<div style="background-color:#0F0F8C; height:55px">


<CENTER><H4 style="color:#E9F7EF">SISTEM PENGURUSAN
PUSAT GYM</h4 </CENTER>
</div>

<div class="container">
<div class="main">
<h2>Javascript Login Form Validation</h2>
<!--INI ADALAH UNTUK MEMBUAT FORM LOGIN-->
<form id="form_id" method="post" name="myform"> <br>
<label>User Name :</label>
<input type="text" name="username" id="username"/>
<label>Password :</label>
<input type="password" name="password" id="password">

<input type="button" value="LOGIN" id="submit" onclick="validate()"/>


<BR> <p> Not a member? Please Sign Up to join.
<input type="button" value="SIGN UP" id="submit"
onclick="window.location.href='FORM2_print.html'"/>
</form>
<span><b class="note">Note : </b> <I> For this demo use following username and password.
</I>
<br/><b class="valid"> ( User Name : Formget <br/> Password : formget#123 )</b></span>
</div>
</div>

</body>
</html>

CSS :
/* Below line is used for online Google font */
@import url(http://fonts.googleapis.com/css?family=Raleway);
h2{
background-color: #FEFFED;
padding: 30px 35px;
margin: -10px -50px;
text-align:center;
border-radius: 10px 10px 0 0;
}
hr{
margin: 10px -50px;
border: 0;
border-top: 1px solid #ccc;
margin-bottom: 40px;
}
div.container{
width: 900px;
height: 610px;
margin:35px auto;
font-family: 'Raleway', sans-serif;
}
div.main{
background-color: #EBF5FB ;
width: 300px;
TEMPLATE SOURCE CODE
padding: 10px 50px 25px;
border: 2px solid gray;
border-radius: 10px;
font-family: raleway;
float:left;
margin-top:50px;
}
input[type=text],input[type=password]{
width: 100%;
height: 40px;
padding: 5px;
margin-bottom: 25px;
margin-top: 5px;
border: 2px solid #ccc;
color: #4f4f4f;
font-size: 16px;
border-radius: 5px;
}
label{
color: #464646;
text-shadow: 0 1px 0 #fff;
font-size: 14px;
font-weight: bold;
}
center{
font-size:32px;
}
.note{
color:red;
}
.valid{
color:green;
}
.back{
text-decoration: none;
border: 1px solid rgb(0, 143, 255);
background-color: rgb(0, 214, 255);
padding: 3px 20px;
border-radius: 2px;
color: black;
}
input[type=button]{
font-size: 16px;
background: linear-gradient(#ffbc00 5%, #ffdd7f 100%);
border: 1px solid #e5a900;
color: #4E4D4B;
font-weight: bold;
cursor: pointer;
width: 100%;
border-radius: 5px;
padding: 10px 0;
outline:none;
}
input[type=button]:hover{
background: linear-gradient(#ffdd7f 5%, #ffbc00 100%);
}

Javascript :
var attempt = 3; // Variable to count number of attempts.
// Below function Executes on click of login button.
function validate(){
var username = document.getElementById("username").value;
var password = document.getElementById("password").value;
if ( username == "Formget" && password == "formget#123"){
alert ("Login successfully");
TEMPLATE SOURCE CODE
window.location = "BMI_kira.html"; // Redirecting to other page.
return false;
}
else{
attempt --;// Decrementing by one.
alert("You have left "+attempt+" attempt;");
// Disabling fields after 3 attempts.
if( attempt == 0){
document.getElementById("username").disabled = true;
document.getElementById("password").disabled = true;
document.getElementById("submit").disabled = true;
return false;
}
}
}

Skrin kedua:

Keterangan : Paparan ini adalah untuk pengguna gym yang ingin menjadi
TEMPLATE SOURCE CODE
member dan paparan kedua adalah apabila pengguna sudah menekan
butang submit

Kod Sumber:
<!DOCTYPE html>
<html>
<head>
<title>Web Form</title>
<!--link rel='stylesheet' type='text/css' href=''/>
<link href='http://fonts.googleapis.com/css?family=Lobster' rel='stylesheet'
type='text/css'-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"> </script>
<!--script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script-->
<!--script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script--
>
<script >
function display() {
DispWin = window.open('','NewWin','toolbar=yes,status=yes,width=700,height=500')
var items=document.getElementsByName('langz');
var selectItems="";
for(var i=0; i<items.length; i++){
if(items[i].type=='checkbox' && items[i].checked==true)
selectItems+= " ~ " + items[i].value;
}
/* INI ADALAH CARA UNTUK MEMBUAT PAPARAN SELEPAS MENEKAN BUTANG SUBMIT */
message = "<b>THANK YOU!</b><BR> Now you can enjoy membership benefits. Here are
your details upon registration:- <pre>" ;
message += "<ul><li>Fisrst NAME: <b>" + document.answer.firstName.value + "</b>";
message += "<li> Last Name : <b>" + document.answer.lastName.value + "</b>";
message += "<li> E-mail : <b>" + document.answer.email.value + "</b>";
message += "<li> Gender : <b>" + document.answer.gen.value + "</b>";
message += "<li> Address : <b>" + document.answer.addr.value + "</b>";
message += "<li> Nationality : <b>" + document.answer.nation.value + "</b>";
message += "<li> Birthday : <b>" + document.answer.bday.value + "</b>";
message += "<li> Contact no. : <b>" + document.answer.telno.value + "</b>";
message += "<li> Language :" + (selectItems) + "</ul>" + "<br>" +
'<br> <input type="button" value="Print" onclick="window.print()" />' ;
DispWin.document.write(message);
}
</script> </head>
<body>
<body style="background-color:powderblue;"> <center>
<div style="background-color:#0F0F8C ;height:45px">
<CENTER><h1 style="color:white">PUSAT GYM</h1> </CENTER>
</div>

<div id="header"><h1><u>Register now & join us for free!</u></h1></div>


<br><div id="wrapper">
<form name="answer" action=" " method="post" id="answers" autofocus>
<b>First name :</b> <input type="text" name="firstName" id="fname"
placeholder="first name"><br/>
<br><b>Last name :</b> <input type="text" name="lastName" placeholder="last
name" id="lname"> <br/>
<br><b>E-mail :</b> &nbsp; &nbsp; &nbsp;
<input type="email" name="email" placeholder="e-mail address" id="mail">
<br/><br/>
<b>Gender :</b><br>
<input type="radio" name="gen" value="male">Male
<input type="radio" name="gen" value="female">Female<br/>
<br><b>Address :</b><br/>
<textarea name="addr" rows="3" placeholder="your home address..">
</textarea>
<br><br> <b>Nationality :</b> <br>
TEMPLATE SOURCE CODE
<select name="nation" id="nations" >
<option value="default" checked>Choose Citizenship</option>
<option value="Citizen">Citizen </option>
<option value="Permanent Resident">Permanent Resident </option>
<option value="Non_Citizen">Non-Citizen </option></select><br>
<br><b> Birthday : </b><br>
<input type="date" name="bday" format="dd-mm-yyyy"> <br/>
<br><b> Telephone No : </b><br>
<input type="password" name="telno" id="telno" maxlength="10"
placeholder="XXX-XXXXXXXX" >
<br/>
<div id="inputx" name="choices" class="choice" >
<br><b>Language :</b><br>
<input class="choice" type="checkbox" name="langz" value="B.MELAYU" >
B.Melayu
<input class="choice" type="checkbox" name="langz" value="ENGLISH" >
English
<input class="choice" type="checkbox" name="langz" value="MANDARIN" >
Mandarin
<input class="choice" type="checkbox" name="langz" value="ARABIC" >
Arabic
<input class="choice" type="checkbox" name="langz" value="TAMIL" > Tamil
</div>
<br><p>
<input type="submit" id="submit" value="SUBMIT" onclick="display()" style="font-
weight:bold; font-size:17px; width:auto; background-color:#5DADE2">
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
<input type="reset" id="submit" value="HOME"
onclick="window.location.href='Login2.html'" style="font-weight:bold; font-size:17px;
width:auto; background-color:#5DADE2" />
</form>
</div>
</body></html>

Skrin ketiga:

Keterangan : Paparan ini adalah selepas pengguna berjaya log masuk dan
ini adalah untuk pengguna mengira BMI

Kod Sumber:
<!DOCTYPE html>
<html>
TEMPLATE SOURCE CODE
<head>
<title> </title>
</head>
<body>
<body style="background-color:powderblue;">
<div style="background-color:#0F0F8C ;height:45px">
<CENTER><h1 style="color:white">PUSAT GYM</h1> </CENTER>
</div>
<div header style="background-color:#EBDEF0;" ><center>

<marquee>
<p id="demo"></p>
</marquee>

</div>

<CENTER><H3><U> COUNT YOUR BMI SCORE ! </U></H3></CENTER>

<center><br>
Enter your weight in kilograms and your height in centimeters in the form below and press
the "See Result" button (Please read disclaimer below before using this form)
<P> <br>
<FORM NAME="BMI" method=POST>
<TABLE border=1>
<TR>
<TD><DIV ALIGN=CENTER> Your Weight (kg)</DIV></TD>
<TD><DIV ALIGN=CENTER> Your Height (cm)</DIV></TD>

</TR>
<TR>
<TD><INPUT TYPE=TEXT NAME=weight SIZE=15 onFocus="this.form.weight.value=''"
maxlength=3></TD>
<TD><INPUT TYPE=TEXT NAME=height SIZE=15 onFocus="this.form.height.value=''"
maxlength=3></TD>
</TR>
</TABLE>

<P>
<INPUT TYPE="button" VALUE="See Result" onClick="computeform(this.form)" style="font-
weight:bold; font-size:17px; width:auto; background-color:salmon" >
<INPUT TYPE="reset" VALUE="Reset" onClick="ClearForm(this.form)" style="font-weight:bold;
font-size:17px; width:auto; background-color:salmon" >

<!--/FORM-->

<TABLE border=1>
<TR>
<TD><DIV ALIGN=CENTER> Your BMI </DIV></TD>
<TD ><DIV ALIGN=CENTER> Comments </DIV></TD>
</TR>
<TR>

<TD rowspan="2"><textarea rows="3" NAME=bmi SIZE=8 readonly> </textarea></TD>


<TD rowspan="2" ><textarea rows="3" NAME=my_comment size=55 readonly> </textarea></TD>

</TABLE>
</FORM>

<P><HR>
<B>Disclaimer</B>: This form is based on the calculation of
<A HREF="http://phaster.com/unpretentious/bmi.html"><I>"Body Mass Index"</I></A>
and is only meant to be a demonstration of how Javascript(tm) could be used
on a Web Page.
TEMPLATE SOURCE CODE
<br>Information it contains may not be accurate and is not designed or intended to serve as
medical advice. I am not liable for any physical or psychological damages suffered as a
result of using this script.

<!--p>This free script provided by


<a href="http://javascriptkit.com">JavaScript
Kit</a></p-->
<hr>

<SCRIPT LANGUAGE="JAVASCRIPT">
<!-- hide this script tag's contents from old browsers

//Body Mass calculator- by John Scott (johnscott03@yahoo.com)


//Visit JavaScript Kit (http://javascriptkit.com) for script
//Credit must stay intact for use

var d = new Date();


document.getElementById("demo").innerHTML = d;

function ClearForm(form){

form.weight.value = "";
form.height.value = "";
form.bmi.value = "";
form.my_comment.value = "";

function bmi(weight, height) {

bmindx=weight/eval(height*height);
return bmindx;
}

function checkform(form) {

if (form.weight.value==null||form.weight.value.length==0 || form.height.value==null||
form.height.value.length==0){
alert("\nPlease complete the form first");
return false;
}

else if (parseFloat(form.height.value) <= 0||


parseFloat(form.height.value) >=500||
parseFloat(form.weight.value) <= 0||
parseFloat(form.weight.value) >=500){
alert("\nReally know what you're doing? \nPlease enter values again. \
nWeight in kilos and \nheight in cm");
ClearForm(form);
return false;
}
return true;

function computeform(form) {

if (checkform(form)) {

yourbmi=Math.round(bmi(form.weight.value, form.height.value/100));
form.bmi.value=yourbmi;

if (yourbmi >40) {
form.my_comment.value="You are grossly obese, consult your physician!";
}
TEMPLATE SOURCE CODE

else if (yourbmi >30 && yourbmi <=40) {


form.my_comment.value="Umm... You are obese, want some liposuction?";
}

else if (yourbmi >27 && yourbmi <=30) {


form.my_comment.value="You are very fat, do something before it's too late";
}

else if (yourbmi >22 && yourbmi <=27) {


form.my_comment.value="You are fat, need dieting and exercise";
}

else if (yourbmi >=21 && yourbmi <=22) {


form.my_comment.value="I envy you. Keep it up!!";
}

else if (yourbmi >=18 && yourbmi <21) {


form.my_comment.value="You are thin, eat more.";
}

else if (yourbmi >=16 && yourbmi <18) {


form.my_comment.value="You are starving. Go Find some food!";
}

else if (yourbmi <16) {


form.my_comment.value="You're grossly undernourished, need hospitalization ";
}

}
return;
}
// -- done hiding from old browsers -->
</SCRIPT>
</body>
</html>
TEMPLATE SOURCE CODE

Anda mungkin juga menyukai