|
|
|
ถ้าlogin เข้าสู่ระบบต้องการให้แสดงข้อมูลของคนที่เข้าสู่ระบบอีกหน้าต้องแก้ไขตรงไหนคะ |
|
|
|
|
|
|
|
ตอนนี้ลองเอาIDของคนนี้มาโชว์แต่ถ้าต้องการให้เช็คตั้งแต่เข้าสู่ระบบแล้วแสดงหน้าตารางแล้วโชว์ข้อมูลของคนๆนั้นต้องแก้ตรงไหนหรอคะ
CODEเข้าสู่ระบบ
Code (PHP)
<?php
include("connect.php");
$ID=@$_REQUEST['ID'];
$Password=@$_REQUEST['Password'];
$sql="select count (ids) as rnt from Accmain where ID='$ID' and Password='$Password'";
$query=odbc_exec($link,$sql);
$num=odbc_result($query,1);
$sql1="select count (id) as rnt from Accdetail where ID='$ID' ";
$query1=odbc_exec($link,$sql1);
$num1=odbc_result($query1,1);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html class="no-js" lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="Sufee Admin - HTML5 Admin Template">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="apple-touch-icon" href="apple-icon.png">
<link rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" href="assets/css/normalize.css">
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/css/font-awesome.min.css">
<link rel="stylesheet" href="assets/css/themify-icons.css">
<link rel="stylesheet" href="assets/css/flag-icon.min.css">
<link rel="stylesheet" href="assets/css/cs-skin-elastic.css">
<!-- <link rel="stylesheet" href="assets/css/bootstrap-select.less"> -->
<link rel="stylesheet" href="assets/scss/style.css">
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,600,700,800' rel='stylesheet' type='text/css'>
<!-- <script type="text/javascript" src="https://cdn.jsdelivr.net/html5shiv/3.7.3/html5shiv.min.js"></script> -->
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
</head>
<script type="text/javascript">
function chk_unit(){
if(document.form1.Username.value==""){
//alert('กรุณณากรอกชื่อที่ใช้เข้าสู่ระบบ');
document.form1.Username.focus();
swal({
type: 'error',
title: 'Oops...',
text: 'Forgot your Username!',
footer: '<a href>Why do I have this issue?</a>'
})
return false;
}
if(document.form1.Password.value==""){
//alert('กรุณณากรอกรหัสผ่าน');
document.form1.Password.focus();
swal({
type: 'error',
title: 'Oops...',
text: 'Forgot your Password!',
footer: '<a href>Why do I have this issue?</a>'
})
return false;
}
}
</script>
<body class="bg-dark">
<div class="sufee-login d-flex align-content-center flex-wrap">
<div class="container">
<div class="login-content">
<div class="login-logo">
<a href="index.php">
<img class="align-content" src="images/logo.png" src="images/key.png" alt="">
</a>
</div>
<div class="login-form">
<form method="post" enctype="multipart/form-data" name="form1" id="form1" action="">
<div class="form-group">
<label>Username</label>
<input type="text" class="form-control" name="Username" id="ID" placeholder="Username">
</div>
<div class="form-group">
<label>Password</label>
<input type="password" class="form-control" name="Password" placeholder="Password">
</div>
<button type="Submit" name="Submit" class="btn btn-success btn-flat m-b-30 m-t-30" onclick="return chk_unit();">Sign in</button>
<div class="social-login-content"></div>
</form>
</div>
</div>
</div>
</div>
<script src="assets/js/vendor/jquery-2.1.4.min.js"></script>
<script src="assets/js/popper.min.js"></script>
<script src="assets/js/plugins.js"></script>
<script src="assets/js/main.js"></script>
<?php
if(!empty($_POST['Username']) || ($_POST['Password'] ) ){
$ID = $_POST['Username'];
$Pass = $_POST['Password'];
$sql="select * from Accmain where ID='$ID' and Password='$Pass'";
$query=odbc_exec($link,$sql);
$result = odbc_fetch_array($query);
//echo "<meta http-equiv='refresh' content='0;URL=index.php'>";
if($ID == $result['ID']){
echo "<meta http-equiv='refresh' content='0;URL=tables-basic.php'>";
}else{
echo"<script type='text/javascript'>
alert('username หรือ password ผิด')</script>";
}
}
?>
</body>
</html>
----------------------------------------
CODEแสดงข้อมูล
Code (PHP)
<?php
//session_start();
include("connect.php");
?>
<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang=""> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang=""> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang=""> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang=""> <!--<![endif]-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<meta http-equiv="X-UA-Compatible" content="IE=edge" >
<meta name="description" content="Sufee Admin - HTML5 Admin Template">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="apple-touch-icon" href="apple-icon.png">
<link rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" href="assets/css/normalize.css">
<link rel="stylesheet" href="assets/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/css/font-awesome.min.css">
<link rel="stylesheet" href="assets/css/themify-icons.css">
<link rel="stylesheet" href="assets/css/flag-icon.min.css">
<link rel="stylesheet" href="assets/css/cs-skin-elastic.css">
<link rel="stylesheet" href="assets/css/lib/datatable/dataTables.bootstrap.min.css">
<!-- <link rel="stylesheet" href="assets/css/bootstrap-select.less"> -->
<link rel="stylesheet" href="assets/scss/style.css">
<link href='https://fonts.googleapis.com/css?family=Open+Sans:400,600,700,800' rel='stylesheet' type='text/css'>
<!-- <script type="text/javascript" src="https://cdn.jsdelivr.net/html5shiv/3.7.3/html5shiv.min.js"></script> -->
</head>
<body>
<?php include ("menu.php");?>
<!-- Left Panel -->
<!-- Right Panel -->
<div id="right-panel" class="right-panel">
<!-- Header-->
<header id="header" class="header">
<div class="header-menu">
<div class="col-sm-7">
<a id="menuToggle" class="menutoggle pull-left"><i class="fa fa fa-tasks"></i></a>
<div class="header-left">
<button class="search-trigger"><i class="fa fa-search"></i></button>
<div class="form-inline">
<form class="search-form">
<input class="form-control mr-sm-2" type="text" placeholder="Search ..." aria-label="Search">
<button class="search-close" type="submit"><i class="fa fa-close"></i></button>
</form>
</div>
<div class="dropdown for-notification">
<button class="btn btn-secondary dropdown-toggle" type="button" id="notification" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fa fa-bell"></i>
<span class="count bg-danger">5</span>
</button>
<div class="dropdown-menu" aria-labelledby="notification">
<p class="red">You have 3 Notification</p>
<a class="dropdown-item media bg-flat-color-1" href="#">
<i class="fa fa-check"></i>
<p>Server #1 overloaded.</p>
</a>
<a class="dropdown-item media bg-flat-color-4" href="#">
<i class="fa fa-info"></i>
<p>Server #2 overloaded.</p>
</a>
<a class="dropdown-item media bg-flat-color-5" href="#">
<i class="fa fa-warning"></i>
<p>Server #3 overloaded.</p>
</a>
</div>
</div>
<div class="dropdown for-message">
<button class="btn btn-secondary dropdown-toggle" type="button"
id="message"
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="ti-email"></i>
<span class="count bg-primary">9</span>
</button>
<div class="dropdown-menu" aria-labelledby="message">
<p class="red">You have 4 Mails</p>
<a class="dropdown-item media bg-flat-color-1" href="#">
<span class="photo media-left"><img alt="avatar" src="images/avatar/1.jpg"></span>
<span class="message media-body">
<span class="name float-left">Jonathan Smith</span>
<span class="time float-right">Just now</span>
<p>Hello, this is an example msg</p>
</span>
</a>
<a class="dropdown-item media bg-flat-color-4" href="#">
<span class="photo media-left"><img alt="avatar" src="images/avatar/2.jpg"></span>
<span class="message media-body">
<span class="name float-left">Jack Sanders</span>
<span class="time float-right">5 minutes ago</span>
<p>Lorem ipsum dolor sit amet, consectetur</p>
</span>
</a>
<a class="dropdown-item media bg-flat-color-5" href="#">
<span class="photo media-left"><img alt="avatar" src="images/avatar/3.jpg"></span>
<span class="message media-body">
<span class="name float-left">Cheryl Wheeler</span>
<span class="time float-right">10 minutes ago</span>
<p>Hello, this is an example msg</p>
</span>
</a>
<a class="dropdown-item media bg-flat-color-3" href="#">
<span class="photo media-left"><img alt="avatar" src="images/avatar/4.jpg"></span>
<span class="message media-body">
<span class="name float-left">Rachel Santos</span>
<span class="time float-right">15 minutes ago</span>
<p>Lorem ipsum dolor sit amet, consectetur</p>
</span>
</a>
</div>
</div>
</div>
</div>
<div class="col-sm-5">
<div class="user-area dropdown float-right">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<img class="user-avatar rounded-circle" src="images/admin.jpg" alt="User Avatar">
</a>
<div class="user-menu dropdown-menu">
<a class="nav-link" href="#"><i class="fa fa- user"></i>My Profile</a>
<a class="nav-link" href="#"><i class="fa fa- user"></i>Notifications <span class="count">13</span></a>
<a class="nav-link" href="#"><i class="fa fa -cog"></i>Settings</a>
<a class="nav-link" href="#"><i class="fa fa-power -off"></i>Logout</a>
</div>
</div>
<div class="language-select dropdown" id="language-select">
<a class="dropdown-toggle" href="#" data-toggle="dropdown" id="language" aria-haspopup="true" aria-expanded="true">
<i class="flag-icon flag-icon-us"></i>
</a>
<div class="dropdown-menu" aria-labelledby="language" >
<div class="dropdown-item">
<span class="flag-icon flag-icon-fr"></span>
</div>
<div class="dropdown-item">
<i class="flag-icon flag-icon-es"></i>
</div>
<div class="dropdown-item">
<i class="flag-icon flag-icon-us"></i>
</div>
<div class="dropdown-item">
<i class="flag-icon flag-icon-it"></i>
</div>
</div>
</div>
</div>
</div>
</header><!-- /header -->
<!-- Header-->
<div class="breadcrumbs">
<div class="col-sm-4">
<div class="page-header float-left">
<div class="page-title">
<h1>Dashboard</h1>
</div>
</div>
</div>
<div class="col-sm-8">
<div class="page-header float-right">
<div class="page-title">
<ol class="breadcrumb text-right">
<li><a href="#">Dashboard</a></li>
<li><a href="#">Table</a></li>
<li class="active">Basic table</li>
</ol>
</div>
</div>
</div>
</div>
<div class="content mt-3">
<div class="animated fadeIn">
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-header">
<strong class="card-title">Account</strong>
</div>
<!-- <div class="card-body">
<table class="table">
<thead class="thead-dark">
<tr>
<th scope="col" >หมายเลขบัญชี</th>
<th scope="col" >ธนาคาร</th>
<th scope="col">สาขา</th>
<th scope="col" >ชื่อ </th>
<th scope="col">ชื่อบัญชี</th>
<th scope="col">TSUP</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="2">xxxxxxxxx</td>
<td>xxxxxxxxxx</td>
<td>xxxxxxxxxxxxxxxxxxxxxx</td>
<td>xxxxxxxxxx xxxxxxxxxx</td>
<td>xxxxxxxxxxx xxxxxxxxxx</td>
<td>xxxxxxx</td>
</tr>
</tbody>
</table>
</div>-->
</div>
</div>
<?php
$sqlkpc1="select * from Accmain where ID ='KPC2BMAC'order by ID desc";
$querykpc1=odbc_exec($link,$sqlkpc1);
while($row1=odbc_fetch_array($querykpc1)){
$Id_Account = $row1['Id_Account'];
$TSUP = $row1['TSUP'];
$BRANCH =$row1['BRANCH'];
$Suppliername =$row1['Suppliername'];
$Bank =$row1['Bank'];
?>
<table width="87%" align="center" >
<tr>
<td width="13%"><span class="style8">หมายเลขบัญชี</span></td>
<td width="2%"><span class="style5">:</span></td>
<td width="17%"><span class="style3"> <?=$Id_Account?></span></td>
<td width="5%"><span class="style8">ชื่อ</span></td>
<td width="1%"><span class="style5">:</span></td>
<td width="35%"><span class="style3"><?=$Suppliername?></span></td>
<td width="8%"><span class="style8">ชื่อบัญชี</span></td>
<td width="1%"><span class="style5">:</span></td>
<td width="18%"><span class="style3"><?=$Nameaccount?></span></td>
</tr>
<tr>
<td><span class="style8">ธนาคาร</span></td>
<td><span class="style5">:</span></td>
<td><span class="style3"><?=$Bank?></span></td>
<td><span class="style8">สาขา</span></td>
<td><span class="style5">:</span></td>
<td><span class="style3"><?=$BRANCH?></span></td>
<td><span class="style8">TSUP</span></td>
<td><span class="style5">:</span></td><td><span class="style3"><?=$TSUP?></span></td>
</tr>
</table>
<?php
}
?>
</div>
</div><!-- .animated -->
</div><!-- .content -->
<div class="content mt-3">
<div class="animated fadeIn">
<div class="row">
<div class="col-md-12">
<div class="card">
<div class="card-header">
<strong class="card-title">Data Table</strong>
</div>
<div class="card-body">
<table id="bootstrap-data-table" class="table table-striped table-bordered">
<thead>
<tr>
<th class="style11">วันที่ Due</th>
<th class="style11">จำนวนเงิน</th>
<th class="style11">Invoice</th>
<th class="style11">วันที่ปรับปรุง</th>
</tr>
</thead>
<tbody>
<?php
$sqlkpc="select * from Accdetail where ID ='KPC2BMAC'order by Date_due desc";
$querykpc=odbc_exec($link,$sqlkpc);
while($rowkpc=odbc_fetch_array($querykpc)){
$ID = $rowkpc['ID'];
$Date_due = $rowkpc['Date_due'];
$Invoice =$rowkpc['Invoice'];
$Updateday =$rowkpc['Update_day'];
$Valuess =$rowkpc['Valuess'];
?>
<tr>
<td><a href="tables-basic.php"><?php echo $Date_due; ?></td>
<td><?php echo $Valuess; ?> </td>
<td><?php echo $Invoice; ?></a></td>
<td><?php echo $Updateday; ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div><!-- .animated -->
</div><!-- .content -->
</div><!-- /#right-panel -->
<!-- Right Panel -->
<script src="assets/js/vendor/jquery-2.1.4.min.js"></script>
<script src="assets/js/popper.min.js"></script>
<script src="assets/js/plugins.js"></script>
<script src="assets/js/main.js"></script>
<script src="assets/js/lib/data-table/datatables.min.js"></script>
<script src="assets/js/lib/data-table/dataTables.bootstrap.min.js"></script>
<script src="assets/js/lib/data-table/dataTables.buttons.min.js"></script>
<script src="assets/js/lib/data-table/buttons.bootstrap.min.js"></script>
<script src="assets/js/lib/data-table/jszip.min.js"></script>
<script src="assets/js/lib/data-table/pdfmake.min.js"></script>
<script src="assets/js/lib/data-table/vfs_fonts.js"></script>
<script src="assets/js/lib/data-table/buttons.html5.min.js"></script>
<script src="assets/js/lib/data-table/buttons.print.min.js"></script>
<script src="assets/js/lib/data-table/buttons.colVis.min.js"></script>
<script src="assets/js/lib/data-table/datatables-init.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#bootstrap-data-table-export').DataTable();
} );
</script>
</body>
</html>
Tag : PHP, Ms SQL Server 2016, CSS, Google Chrome, XAMPP, Windows
|
|
|
|
|
|
Date :
2018-07-24 14:11:54 |
By :
mewhappy |
View :
709 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|