Content
https://www.microsoft.com/pl-pl/sql-server/sql-server-downloads
INDEX.PHP
<?php
session_start();
if(isset($_POST['loguj'])){
$login = $_POST['login'];
$haslo = $_POST['pass'];
$serverName = "10.10.1.10,55555";
$uid = "sa";
$pwd = "Start1234$";
$databaseName = "FIRMA";
$databaseName = "WMS";
$connectionInfo = array( "UID"=>$uid,
"PWD"=>$pwd,
"Database"=>$databaseName);
/* Podłączenie do bazy danych MSSQL */
$conn = sqlsrv_connect( $serverName, $connectionInfo);
$tsql = "SELECT TOP (1000) [strLogin]
,[strPassword]
,[strRole]
,[idUżytkownika]
FROM [WMS].[dbo].[Hive] WHERE [strLogin] = '$login' AND [strPassword] = '$haslo';";
/* Execute the query. */
$params = array();
$options = array( "Scrollable" => SQLSRV_CURSOR_KEYSET );
$policz = sqlsrv_query( $conn, $tsql , $params, $options );
$stmt = sqlsrv_query( $conn, $tsql);
$ile = sqlsrv_num_rows( $policz );
$row = sqlsrv_fetch_array($stmt, 2);
$role = $row['strRole'];
$id = $row['idUżytkownika'];
if($role === 'admin'){
$_SESSION['admin'] = true;
}
if ($ile > 0){
$_SESSION['logged_in'] = true;
$_SESSION['login'] = $login;
$_SESSION['logged_id'] = $id;
unset($_SESSION['login_fail']);
header('Location: main.php');
}else {
$_SESSION['login_fail'] = true;
}
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<link rel="icon" href="/img/logo_icon.ico">
<?php require_once 'crudbase/includes/head.php'; ?>
<title>WMS | Zaloguj się</title>
<link rel="canonical" href="https://getbootstrap.com/docs/4.0/examples/sign-in/">
<!-- Bootstrap core CSS -->
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- Custom styles for this template -->
<link href="signin.css" rel="stylesheet">
</head>
<body class="text-center">
<form class="form-signin" method="post" action="index.php">
<img class="mb-6" src="img/logo.png" alt="" width="75" height="91">
<h1 class="h3 mb-3 font-weight-heavy ">Zaloguj się</h1>
<?php
if(isset($_SESSION['login_fail'])){
echo '<div class="alert alert-danger" role="alert">
Podano błędny login lub hasło!
</div>';
unset($_SESSION['login_fail']);
}
?>
<br>
<label for="inputEmail" class="sr-only"><b>Użytkownik</label>
<br>
<input type="text" id="inputEmail" name="login" class="form-control" placeholder="Login" required autofocus>
<br>
<label for="inputPassword" class="sr-only"><b>Hasło</label>
<br>
<input type="password" name="pass" id="inputPassword" class="form-control" placeholder="Password" required>
<br>
<div class="checkbox mb-3">
<label>
<br>
<input type="checkbox" value="remember-me"> Zapamiętaj mnie
</label>
</div>
<br>
<button class="btn btn-lg btn-primary btn-block" name="loguj" type="submit">Zaloguj się</button> </form>
<br><br><br> <br><br><br>
<a href="http://it-on.pl/" class="btn btn-lg btn-secondary btn-block" role="button">WMS IT-ON.PL</a>
<script>
// JQuery confirmation
$('.confirmation').on('click', function () {
return confirm('Are you sure you want do delete this user?');
});
</script>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>
</html>
MAIN.PHP
<?php
session_start();
if(!isset($_SESSION['logged_in'])){
header('Location: index.php');
}
unset($_SESSION['klucz_dok']);
?>
<!doctype html>
<html lang="en">
<head>
<?php require_once 'crudbase/includes/head.php'; ?>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link rel="canonical" href="https://getbootstrap.com/docs/5.0/examples/cheatsheet/">
<!-- Bootstrap core CSS -->
<style>
.btn-circle {
width: 30px;
height: 30px;
text-align: center;
padding: 6px 0;
font-size: 12px;
line-height: 1.428571429;
border-radius: 15px;
}
</style>
<style>
.bd-placeholder-img {
font-size: 1.125rem;
text-anchor: middle;
-webkit-user-select: none;
-moz-user-select: none;
user-select: none;
}
@media (min-width: 768px) {
.bd-placeholder-img-lg {
font-size: 3.5rem;
}
}
</style>
<!-- Custom styles for this template -->
<link href="cheatsheet.css" rel="stylesheet">
</head>
<body>
<?php require_once 'crudbase/includes/header.php'; ?>
<div class="container-fluid">
<?php
if(isset($_SESSION['admin_fail'])) {
echo '<div class="alert alert-danger" role="alert">
Barak uprwanień, zaloguj się jako admin!
</div>';
unset($_SESSION['admin_fail']);
}
?>
<div class="row">
<div class="com-sm-12 "><img class="mx-auto d-block img-fluid" src="img/logo2.jpg" alt=""></div>
</div>
<header class="bd-header bg-dark py-3 d-flex align-items-stretch border-bottom border-dark">
<div class="container-fluid d-flex align-items-center">
<h1 class="d-flex align-items-center fs-4 text-white mb-0">
<img src="img/logo-it-on.png" width="38" height="42" class="me-3" alt="INFO">
WMS APK<br>MAIN MENU<br>
</h1>
</div>
<div>
<a href="http://wms.it-on.pl:8888/info.php" class="ms-auto link-light" hreflang="ar">Aplikacja Mobilna v.1.2<br></a>
</div>
</header>
<div class="bd-example">
<a href="http://wms.it-on.pl:8888/moje.php">
<svg class="bd-placeholder-img img-thumbnail" width="165" height="165" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Przeglądanie zamóweń" preserveAspectRatio="xMidYMid slice" focusable="false"><title>Moje zamówienia</title><rect width="100%" height="100%" fill="#2471a3"/><text x="50%" y="50%" fill="#dee2e6" dy=".5em">Moje zamówienia</text></svg>
</a>
<a href="http://wms.it-on.pl:8888/kompletacja.php">
<svg class="bd-placeholder-img img-thumbnail" width="165" height="165" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Wózki" preserveAspectRatio="xMidYMid slice" focusable="false"><title>Kompletacja</title><rect width="100%" height="100%" fill="#FF5733"/><text x="50%" y="50%" fill="#dee2e6" dy=".5em">Kompletacja</text></svg>
</a>
<a href="http://wms.it-on.pl:8888/sprawdzanie.php">
<svg class="bd-placeholder-img img-thumbnail" width="165" height="165" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Kartony" preserveAspectRatio="xMidYMid slice" focusable="false"><title>Sprawdzanie</title><rect width="100%" height="100%" fill="#C70039"/><text x="50%" y="50%" fill="#dee2e6" dy=".3em">Sprawdzanie</text></svg>
</a>
<a href="http://wms.it-on.pl:8888/wysylki.php">
<svg class="bd-placeholder-img img-thumbnail" width="165" height="165" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Wysyłki zamówień" preserveAspectRatio="xMidYMid slice" focusable="false"><title>Wysyłki Paczek</title><rect width="100%" height="100%" fill="#12750e"/><text x="50%" y="50%" fill="#dee2e6" dy=".3em">Wysyłki</text></svg>
</a>
<a href="http://wms.it-on.pl:8888/inwentaryzacja.php">
<svg class="bd-placeholder-img img-thumbnail" width="165" height="165" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Inwentaryzacja" preserveAspectRatio="xMidYMid slice" focusable="false"><title>Inwentaryzacja</title><rect width="100%" height="100%" fill="#303645"/><text x="50%" y="50%" fill="#dee2e6" dy=".3em">Inwentaryzacja</text></svg>
</a>
<a href="http://wms.it-on.pl:8888/panel.php">
<svg class="bd-placeholder-img img-thumbnail" width="165" height="165" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="Panel" preserveAspectRatio="xMidYMid slice" focusable="false"><title>Panel</title><rect width="100%" height="100%" fill="#990066"/><text x="50%" y="50%" fill="#dee2e6" dy=".3em">Panel</text></svg>
</a>
</div>
<br></br>
<a href="http://wms.it-on.pl:8888/logout.php"> <button type="button" class="btn btn-success">Wyloguj</button> </a>
<section id="content">
<div class="container">
<h1 class="align-left">Lista do kompletacji:</h1>
<div class="table-responsive">
<table class="table">
<thead>
<tr>
<th scope="col"></th>
<th scope="col">Numer dokumentu</th>
<th scope="col">Liczba pozycji</th>
<th scope="col">Suma ilości</th>
</tr>
</thead>
<?php
$serverName = "10.10.1.10,55555";
$uid = "sa";
$pwd = "Start1234$";
$databaseName = "FIRMA";
$connectionInfo = array( "UID"=>$uid,
"PWD"=>$pwd,
"Database"=>$databaseName);
/* Podłączenie do bazy danych MSSQL */
$conn = sqlsrv_connect( $serverName, $connectionInfo);
$tsql = "SELECT top(1000)
[KLUCZ_DOK],
[SUMA_IL],
[UWAGI]
,(SELECT count(*) FROM [FIRMA].[dbo].[POZ_DOK] where [POZ_DOK].[KLUCZ_DOK] = [NAGL_DOK].[KLUCZ_DOK] ) AS LICZBA_POZYCJI
,(SELECT count(*) FROM [FIRMA].[dbo].[NAGL_DOK] where [FIRMA].[dbo].[NAGL_DOK].[KLUCZ_DOK] like 'ZO/%'
and [FIRMA].[dbo].[NAGL_DOK].[STATUS_ZAM]=23 or [FIRMA].[dbo].[NAGL_DOK].[STATUS_ZAM]=22 ) AS LICZBA_ZAMOWIEN_RAZEM
FROM [FIRMA].[dbo].[NAGL_DOK]
where [FIRMA].[dbo].[NAGL_DOK].[KLUCZ_DOK] like 'ZO/%'
and [FIRMA].[dbo].[NAGL_DOK].[STATUS_ZAM]=23 or [FIRMA].[dbo].[NAGL_DOK].[STATUS_ZAM]=22
order by row_dtime desc;";
/* Execute the query. */
$params = array();
$options = array( "Scrollable" => SQLSRV_CURSOR_KEYSET );
$policz = sqlsrv_query( $conn, $tsql , $params, $options );
$ile = sqlsrv_num_rows( $policz );
$stmt = sqlsrv_query( $conn, $tsql);
for ($i = 1; $i <= $ile; $i++)
{
$row = sqlsrv_fetch_array($stmt, 2);
$a1 = $row['KLUCZ_DOK'];
$a2 = $row['STATUS_ZAM'];
$a3 = round($row['SUMA_IL'],2);
$a4 = $row['SUMA_BRU'];
$a5 = $row['UWAGI'];
$a6 = $row['LICZBA_POZYCJI'];
$a7 = $row['LICZBA_ZAMOWIEN_RAZEM'];
echo '
<tr class="accordion-toggle">
<td>
<button data-toggle="collapse" class="btn btn-primary btn-circle btn accordion-toggle" data-target="#drop'.$i.'">
<img src="img/arrow-down-sign-to-navigate.png" style="width:15px;">
</button>
</td>
<td><b>'.$a1.'</b></td>
<td class="text-info" class="pl-3"><b>'.$a6.' szt.</b></td>
<td class="text-primary" class="pl-3"><b>'.$a3.' szt.</b></td>
<td>
<form action="cart.php" method="POST">
<input id="klucz_dok" name="klucz_dok" type="hidden" value='.$a1.'>
<input id="liczba_poz" name="liczba_poz" type="hidden" value='.$a6.'>
<input id="liczba_prod" name="liczba_prod" type="hidden" value="'.$a3.'">
<button type="submit" name="cart" class="btn btn-success btn-circle btn-sm">+</button>
</form>
</form>
</td>
</tr>
<tr>
<td colspan="12" class="hiddenRow p-0">
<div class="accordian-body collapse " id="drop'.$i.'">
<p class="pl-3"><b> | Uwagi: | '.$a5.' | </b></p>
</div>
</td>
</tr>';
}
sqlsrv_free_stmt( $stmt);
sqlsrv_close( $conn);
?>
</div>
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</body>
</html>