Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title> test cookies</title>
- <meta charset="UTF-8">
- <link rel="stylesheet" type="text/css" href="styl.css">
- </head>
- <body>
- <div>
- <?php
- include_once 'baza.php';
- include('form.php');
- if(isset($_POST['login']) or isset($_POST['password'])){
- if( empty($_POST['login']) or empty($_POST['password'])){
- echo "błąd danych";
- }
- else
- {
- $con = Connect();
- $pass = $_POST['password'];
- $login = $_POST['login'];
- $sql = "select id, nick, pass from User where nick = '$login' and pass = '$pass'";
- $result = mysqli_query($con, $sql);
- if(!$result){
- echo mysqli_error($con)."<br>";
- }else{
- $i = 0;
- while($row = mysqli_fetch_assoc($result)){
- if($i < 1){
- session_start();
- echo $row['id']." ";
- echo $row['nick']."<br>";
- $_SESSION['id'] = $row['id'];
- $_SESSION['user'] = $row['nick'];
- $_SESSION['pass'] = $row['pass'];
- echo "<a href=\"show.php\"> Przejdz dalej </a>";
- $i++;
- }
- }
- }
- // include('connect.php');
- // $log = $_POST['login'];
- // $pass = $_POST['password'];
- // mysqli_close($conn);
- }
- }
- ?>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement