View file siwap.ru/index.php

File size: 5.3Kb
<?php
require_once $_SERVER['DOCUMENT_ROOT'].'/system/App.php';
$title = $_SERVER['HTTP_HOST'].' - Соц сеть нового поколения';
$titleHeader = $_SERVER['HTTP_HOST'];

require_once ROOT.'/system/header.php';

$user->access('guest');
?>
<div class="col-sm"></div>
<div class="col-12">
	<script>
		$(document).ready(function() {
			
			$("#carousel").on("slide.bs.carousel", function(e) {
				var $e = $(e.relatedTarget);
				var idx = $e.index();
			    var itemsPerSlide = 3;
			    var totalItems = $(".carousel-item").length;
			
			    if (idx >= totalItems - (itemsPerSlide - 1)) {
			      var it = itemsPerSlide - (totalItems - idx);
			      for (var i = 0; i < it; i++) {
			        // append slides to end
			        if (e.direction == "left") {
			          $(".carousel-item")
			            .eq(i)
			            .appendTo(".carousel-inner");
			        } else {
			          $(".carousel-item")
			            .eq(0)
			            .appendTo($(this).find(".carousel-inner"));
			        }
			      }
			    }
			});
		$('#okButton').on('click', function(e) {
			e.preventDefault();
			var formData = $('#auth-form').serialize();
			var alerts = $('#alerts');
			
			$.ajax({
			url: '/AJAX/login/authorization.php',
			type: 'POST',
			data: formData,
			dataType: 'json',
			success: function(json) {
				
				if(json['error'] == 1) {
					$(alerts).html('<div class="alert alert-danger">'+json['comment']+'</div>');
				} else if(json['success'] == 1) {
					$(alerts).html('<div class="alert alert-success">'+json['comment']+'</div>');
				}
				setTimeout(function () {
					$(alerts).html('');
					if(json['success'] == 1) {
						location.href = json['url'];
					}
				}, 1500);
			},
			error: function(xhr, ajaxOptions, thrownError) {
				alert(thrownError + "\r\n" + xhr.statusText + "\r\n " + xhr.responseText);
			}
			});
		});
		});
	</script>
<div class="img-header">
	<div class="container-fluid">
			<div class="row">
			<div class="col-md"></div>
			<div class="col-12 col-md-4 col-lg-3">
				<div class="card-body black-block pb-5">
				<span class="text-uppercase d-block mb-3"><?=$_SERVER['HTTP_HOST']?> - это соц сеть нового поколения</span> 
				<div id="alerts"></div>
				
				<form id="auth-form">
					<div class="form-group text-left">
			       	 <label class="form-check-label text-light">Логин или телефон</label>
			    	    <input type="text" class="form-control input-theme" name="login">
			        </div>
			        <div class="form-group text-left">
			            <label class="form-check-label text-light">Пароль</label>
			            <input type="password" class="form-control input-theme" name="password" placeholder="">
			        </div>
			        <div class="form-group">
			            <input type="submit" class="btn btn-md btn-theme btn-block" id="okButton" value="Войти">
			        </div>
				</form>
				<a href="/registration" class="btn btn-sm btn-theme btn-block">Регистрация</a>
				<a href="/forgot" class="btn btn-sm btn-theme btn-block">Забыли пароль?</a>
				</div>
			</div>
		</div>
	</div>
</div>

<div class="section">
	<div class="section-header text-uppercase"><span class="section-header-text">О нас</span></div>
	<div class="card-body section-body">
		<div class="section-text">
			<span class="text-uppercase mb-3 d-block"><?=$_SERVER['HTTP_HOST']?> - это соц сеть нового поколения</span> 
			
			<span> Какой-то текст, где тебе втирают дичь </span>
		</div>
	</div>
</div>

<div class="section">
	<div class="section-header text-uppercase"><span class="section-header-text">Знакомства</span></div>
	<div class="card-body section-body" id="profiles">
		<div id="carousel" class="carousel slide" data-ride="carousel">
			<div class="carousel-inner row w-100 mx-auto">
				<?php  foreach($users->get(0, 6) as $key => $list): ?>
				<div class="carousel-item <?=($key == 0 ? 'active' : null)?> col-md-4">
					<div class="card">
							<div class="profile-user">
								<div class="profile-user-fon" style="background-image: url(<?=$list['fon_avatar']?>);">
									<span class="badge badge-pill badge-theme " style="position: absolute; left: 8px; top: 5px;"><?=$list['name']?> <?=$list['last_name']?></span>
									
									<div class="profile-user-avatar" style="top: 55px; width: 160px; height: 160px; background-image: url(<?=$list['avatar']?>);"></div>
								</div>
								<div class="card-footer">
									<a href="/registration" class="btn btn-theme btn-sm btn-block">Написать</a>
								</div>
							</div>
						</div>
				</div>
				<?php endforeach; ?>
			</div>
			<a class="carousel-control-prev" href="#carousel" role="button" data-slide="prev">
				<span class="carousel-control-prev-icon" aria-hidden="true"></span>
				<span class="sr-only">Предыдущий</span>
			</a>
			<a class="carousel-control-next" href="#carousel" role="button" data-slide="next">
				<span class="carousel-control-next-icon" aria-hidden="true"></span>
				<span class="sr-only">Следующий</span>
			</a>
		</div>
	</div>
</div>

</div>
<div class="col-sm"></div>
<?php
require ROOT.'/system/inc/footer.php';
?>