Answer the question
In order to leave comments, you need to log in
I get error 500 when executing header("Location: /im"), what should I do?
<?php
include 'rb/db.php';
if (isset($_SESSION['login'])) {
header("Location : /im");
exit();
}
$data = $_POST;
$login = $data['login'];
$pass = $data['password'];
if (isset($data['btn-log-in'])) {
$res = mysqli_query($link, "SELECT `login` FROM `users` WHERE `login` = '$login'");
$count = mysqli_num_rows($res);
$pas = mysqli_query($link, "SELECT * FROM `users` WHERE `login` = '$login'");
$pashash = mysqli_fetch_array($pas);
$id = $pashash['id'];
if( $count > 0 ) {
if ($pashash['password'] == $pass) {
$_SESSION['login']=$login;
$_SESSION['id']=$id;
}else{
$error = '<p class="red">неправельный пароль</p>';
}
} else {
$error = '<p class="red">неправельный логин</p>';
}
}
?>
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>login</title>
<style type="text/css">
body {
background-color: #ffffff;
width: 100%;
margin:0px;
background-image: url('img/bg3.jpg');
background-repeat: no-repeat;
-moz-background-size: 100%; /* Firefox 3.6+ */
-webkit-background-size: 100%; /* Safari 3.1+ и Chrome 4.0+ */
-o-background-size: 100%; /* Opera 9.6+ */
background-size: 100%; /* Современные браузеры */
}
.menu_a {
width: 100%;
height: 40px;
background: black;
}
.red {
color: white;
font-weight: bold;
}
.menu_TEXT-a {
padding-top: 6px;
padding-left: 50px;
margin: 0px;
text-align: left;
color: azure;
}
.container{
text-align: center;
float: right;
}
.form {
margin-top: 5px;
margin-right: 100px;
}
.inp {
width: 200px;
height: 35px;
padding-left: 5px;
padding-right: 5px;
outline: none;
border-radius: 5px;
border: none;
}
.left {
}
.info {
width: 69%;
height: 530px;
border: none;
border-radius: 5px;
float: left;
padding: 10px;
margin-left: 30px;
background-image: url('img/opacity.png');
margin-top: 10px;
padding-left: 20px;
margin-right: 20px;
opacity:90%;
}
h3 {
color: white;
font-weight: bold;
}
p {
color: white;
font-weight: bold;
}
span {
color: white;
font-weight: bold;
}
.rad {
}
.mes {
cursor: pointer;
width: 90px;
height: 30px;
border-radius: 5px;
outline: none;
text-align: center;
}
.day {
cursor: pointer;
width: 55px;
height: 30px;
border-radius: 5px;
outline: none;
text-align: center;
}
.year {
cursor: pointer;
width: 60px;
height: 30px;
border-radius: 5px;
outline: none;
text-align: center;
}
option {
color:black;
background:white;
}
button {
border-radius: 5px;
width: 180px;
height: 40px;
outline: none;
color: white;
background-color: #000000;
font-weight: bold;
}
button:hover {
background-color: #0d0d0d;
cursor: pointer;
}
.info-title {
font-weight: bold;
font-size: 20px;
}
</style>
</head>
<body>
<!--
Меню сверху
-->
<nav class="menu_a">
<h1 class="menu_TEXT-a">AMICI</h1>
</nav>
<div class="info">
<p class="info-title">Обновление бета - 0.0.1</p>
<p>В обновление бета - 0.0.1, добавлено :</p>
<p>1) Авторизация</p>
<p>2) Регистрация</p>
<p>3) Отправка сообщений в общий чат</p><br>
<p>В следующием обновление (бета - 0.0.2) будет :</p>
<p>1) Отправка лс</p>
<p>2) Просмотр своего профиля</p>
<p>3) Просмотр профиля других пользователей</p>
</div>
<div class="container">
<!--
Инфа
-->
<div class="form left">
<h3>Войдите в Amici</h3>
<?php echo $error;?>
<form action="/" method="POST">
<input class="inp" type="text" name="login" placeholder="Введите ваш логин" autocomplete="off" required="1" minlength="6" maxlength="20" value="<?php echo $_POST['login'];?>"><br><br>
<input class="inp" type="password" name="password" placeholder="Введите ваш пароль" autocomplete="off" required="1" minlength="6" maxlength="18"><br><br>
<button name="btn-log-in">Войти</button>
</form>
</div>
<div class="form">
<h3>Зарегистрируйтесь в Amici</h3>
<form action="reg.php" method="POST">
<input class="inp" type="text" name="login" placeholder="Введите ваше логин" autocomplete="off" required="1" minlength="5" maxlength="2016" title="мин. длина = 5, макс. длина = 20"><br><br>
<input class="inp" type="password" name="password" placeholder="Введите ваш пароль" autocomplete="off" required="1" minlength="6" maxlength="18" title="мин. длина = 6, макс. длина = 18"><br><br>
<button name="btn-r-in">Далее</button>
</form>
</div>
</div>
</body>
</html>
Answer the question
In order to leave comments, you need to log in
Open php_errors on the server and look.
You can guess in telepath mode for a long time.
PS This is a reference govnokod.
Read about MVC at least.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question