$answers = json_decode(Answer::select('answer')->get()[0], true);
return view('home')->with(['name' => $name, 'answers' => $answers]);
return view('home', ['name' => $name, 'answers' => $answers]);
<div></div>
div {
position: relative;
width: 200px;
height: 150px;
background: #fff;
border: 1px solid #ccc;
}
div::after {
content: '';
position: absolute;
top: 100%;
left: 20px;
width: 10px;
height: 10px;
border-width: 1px 1px 0 0;
border-style: solid;
border-color: #ccc;
transform-origin: center;
transform: translateY(-50%) rotate(135deg);
background: #fff;
margin-top: 1px;
}
<?
require_once('tamplates/top.php');
if($_POST){
$p_email = $_POST['email'];
$p_password = $_POST['password'];
$errors = array();
if(!$p_email){
$errors[] = "Поле email не заполнено";
}
if(!$p_password){
$errors[] = "Поле password не заполнено";
}
if(!empty($errors)){
print_r($errors);
}
$query = "SELECT*FROM users WHERE email='$p_email' AND password='$p_password'";
$adr = mysqli_query($db_con, $query);
if(!$adr){
exit($query);
}
$user = mysqli_fetch_array($adr);
if(empty($user)){
$errors[] = "error log-in";
}
if(!empty($errors)){
exit('error');
} else {
$_SESSION['user_id']=$user['id'];
?>
<script type="text/javascript">
document.location.href="panel.php/lk?id=<?echo $user['id']?>";
</script>
<?
}
}
?>
<form method="post" action="login.php">
<div class="form-group">
<label for="email">Email address</label>
<input type="email" class="form-control" name="email" id="email1" placeholder="Email">
</div>
<div class="form-group">
<label for="password">Password</label>
<input type="password" class="form-control" name="password" id="password" placeholder="Password">
</div>
<button type="submit" class="btn btn-default">Submit</button>
</form>
<? require_once('tamplates/bottom.php') ?>
//SELECT count(*) FROM users WHERE user_id = 1 AND is_admin = 1
if ($isAdmin == 0) header('Location: http://site.ru/');
//SELECT * FROM users WHERE user_id = 1
if ($user['is_admin'] == 0) header('Location: http://site.ru/');
header('Location: http://site.ru/');
exit("Доступ закрыт");
throw new Exception("Доступ закрыт");