- Messages
- 665
- Reaction score
- 1
- Points
- 28
Re: Mga Tanong tungkol sa PHP, CSS, jquery, HTML at MySQL pasok D2
may question ako mga masters
BTW eto nga pala code ng Login Page ko.
main_login.php
then after maglog in , ay mapupunta sya sa admincheck.php
para icheck kung valid ba ung natype ko,
eto nga pala yung code ng admincheck.php
then mapupunta na sya sa controlpanel.php
at eto yung code nya
controlpanel.php
ayn napunta na po dyan,
now the problem is, kahit di ako maglogin napupunta ako sa page na yan, yung tanong ko lang kung pano ko maproprotektahan yang page na yan from unauthorized Access, help po mga masters
may question ako mga masters
BTW eto nga pala code ng Login Page ko.
main_login.php
Code:
<!DOCTYPE HTML>
<html>
<head>
<title>Teachers Performance Evaluation</title>
<meta charset="UTF-8" />
<meta name="Designer" content="PremiumPixels.com">
<meta name="Author" content="$hekh@r d-Ziner, CSSJUNTION.com">
<link rel="stylesheet" type="text/css" href="css/reset.css">
<link rel="stylesheet" type="text/css" href="css/structure.css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
body {
background-image: url(root_directory/styles/StripBG.jpg);
background-repeat: repeat-x;
}
</style>
</head>
<head>
<br>
<br>
<br>
<CENTER><STRONG><h6><font size="6" color="#CCCCCC">TEACHERS PERFORMANCE EVALUATION - ADMIN CONTROL PANEL</font></h6></STRONG></CENTER>
<body>
<form class="box login" method="post" action="admincheck.php">
<fieldset class="boxBody">
<label>Username</label>
<input name="myusername" id="myusername" type="text" tabindex="1" placeholder="Input the Required Details" required>
<label><a href="#" class="rLink" tabindex="5"></a>Password</label>
<input name="mypassword" id="mypassword" type="text" tabindex="2" required>
</fieldset>
<footer>
<label><input type="checkbox" tabindex="3">Keep me logged in</label>
<input type="submit" class="btnLogin" value="Login" tabindex="4">
</footer>
</form>
<footer id="main">Asian Institute of Computer Studies - Teachers Performance Evaluation System ™Copyright 2012 <img src="root_directory/styles/AICSlogogif.gif" width="123" height="108" alt="AICSLOGO"></footer>
</body>
</html>
then after maglog in , ay mapupunta sya sa admincheck.php
para icheck kung valid ba ung natype ko,
eto nga pala yung code ng admincheck.php
Code:
<?php
$host="localhost"; // Host name
$username="root"; // Mysql username
$password=""; // Mysql password
$db_name="information"; // Database name
$tbl_name="admin"; // Table name
// Connect to server and select databse.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
// username and password sent from form
$myusername=$_POST['myusername'];
$mypassword=$_POST['mypassword'];
// To protect MySQL injection (more detail about MySQL injection)
$myusername = stripslashes($myusername);
$mypassword = stripslashes($mypassword);
$myusername = mysql_real_escape_string($myusername);
$mypassword = mysql_real_escape_string($mypassword);
$sql="SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'";
$result=mysql_query($sql);
// Mysql_num_row is counting table row
$count=mysql_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row
if($count==1){
// Register $myusername, $mypassword and redirect to file "login_success.php"
session_register("myusername");
session_register("mypassword");
header("location:controlpanel.php");
}
else {
header("location:main_login_failed.php");
}
?>
then mapupunta na sya sa controlpanel.php
at eto yung code nya
controlpanel.php
Code:
<!DOCTYPE HTML>
<html>
<head>
<title>Teachers Performance Evaluation</title>
<meta charset="UTF-8" />
<meta name="Designer" content="PremiumPixels.com">
<meta name="Author" content="$hekh@r d-Ziner, CSSJUNTION.com">
<link rel="stylesheet" type="text/css" href="css/reset.css">
<link rel="stylesheet" type="text/css" href="css/structure.css">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css">
body {
background-image: url(root_directory/styles/StripBG.jpg);
background-repeat: repeat-x;
}
</style>
</head>
<head>
<br>
<br>
<br>
<CENTER><STRONG><h6><font size="6" color="#CCCCCC">TEACHERS PERFORMANCE EVALUATION - ADMIN CONTROL PANEL</font></h6></STRONG></CENTER>
<body>
<br>
<br>
<br>
<style type="text/css">
table.sample {
border-width: 4px;
border-spacing: 5px;
border-style: inset;
border-color: green;
border-collapse: separate;
background-color: rgb(255, 255, 240);
}
table.sample th {
border-width: 2px;
padding: 5px;
border-style: outset;
border-color: gray;
background-color: rgb(250, 240, 230);
-moz-border-radius: ;
}
table.sample td {
border-width: 2px;
padding: 5px;
border-style: outset;
border-color: gray;
background-color: rgb(250, 240, 230);
-moz-border-radius: ;
}
</style>
<center><table border="1" class="sample">
<tr>
<th><a href='db_table_id_ma.php'>ADD A STUDENT</a></th>
<th><a href='db_table_section_ma.php'>UPDATE RECORDS</a></th>
<th><a href='db_table_teacher_ma.php'>DELETE RECORDS</a></th>
<th><a href='logout.php'>LOGOUT</a></th>
</tr></center>
<footer id="main">Asian Institute of Computer Studies - Teachers Performance Evaluation System ™Copyright 2012 <img src="root_directory/styles/AICSlogogif.gif" width="123" height="108" alt="AICSLOGO"></footer>
</body>
</html>
now the problem is, kahit di ako maglogin napupunta ako sa page na yan, yung tanong ko lang kung pano ko maproprotektahan yang page na yan from unauthorized Access, help po mga masters