Создана страница Login
This commit is contained in:
		
							parent
							
								
									3851b9f5a2
								
							
						
					
					
						commit
						9725f3c0aa
					
				|  | @ -0,0 +1,49 @@ | |||
| <!DOCTYPE html> | ||||
| <html lang="ru"> | ||||
| 	<head> | ||||
| 		<meta charset="utf-8"> | ||||
| 		<meta name="viewport" content="width=device-width"> | ||||
| 		<title>Dhaverd</title> | ||||
| 		<link href="src/styles/style.css?v=01000040" rel="stylesheet" media="screen" /> | ||||
| 		<link rel="stylesheet" href="src/styles/styleMobile.css?v=01000040" media="handheld,only screen and (max-device-width:480px)" /> | ||||
| 		<link rel="icon" href="src/img/favicon.ico">			 | ||||
| 	</head> | ||||
| 	<body id="main"> | ||||
| 		<header id="header" class="default index-logo"> | ||||
| 			<div class="logo-img"> | ||||
| 				<a  href="index.html"><img class="header-img" src="src/img/dhaverd2.png"></a> | ||||
| 			</div> | ||||
| 		</header> | ||||
| 		<main> | ||||
| 			<section class="side-bar"> | ||||
| 				<p class="mainp"><a class="side-href" href="index.html">Главная</a></p> | ||||
| 				<p class="gitea"><a class="side-href" href="http:\\176.114.129.4:3000">Gitea</a></p> | ||||
| 				<p class="servers"><a class="side-href" href="servers.html">Сервера</a></p> | ||||
| 				<p class="mychat"><a class="side-href" href="mychat.html">MyChat</a></p> | ||||
| 				<p class="workout-area"><a class="side-href" href="workout.html">Программа тренировок</a></p> | ||||
| 			</section> | ||||
| 			<section class="main-content login-main-content" id="main-content"> | ||||
| 				<h1 class="page-title">Вход</h1> | ||||
| 				<section class="login-main"> | ||||
| 					<section class="login-left"></section> | ||||
| 					<section class="login-form"> | ||||
| 						<form id="form"> | ||||
| 							<input id="login" class="login-input" type="text" name="login"> | ||||
| 							<input id="password" class="login-input" type="password" name="password"> | ||||
| 							<label class="password-label"><input id="password-checkbox" type="checkbox" value="">Показать пароль</label> | ||||
| 							<input class="login-input login-button" type="submit" name="send" value="Вход"> | ||||
| 						</form> | ||||
| 					</section> | ||||
| 					<section class="login-right"></section> | ||||
| 				</section> | ||||
| 			</section> | ||||
| 		</main> | ||||
| 		<footer> | ||||
| 			<section> | ||||
| 				<p id="footer">® Dhaverd 2022</p> | ||||
| 			</section> | ||||
| 		</footer> | ||||
| 		<script src="src/scripts/jquery.min.js?v=0000001"></script> | ||||
| 		<script src="src/scripts/login.js?v=0000001"></script>	 | ||||
| 	</body>	 | ||||
| </html> | ||||
|  | @ -0,0 +1,21 @@ | |||
| <?php | ||||
| 
 | ||||
| if (isset($_POST['text'])){	 | ||||
| 	$login = $_POST['login']; | ||||
| 	$password = $_POST['password']; | ||||
| 	$con=mysqli_connect("localhost:3306", "root", "506763", "workout"); | ||||
| 	if (!$con) | ||||
| 		die('DB connection error'); | ||||
| 	$query='SELECT * FROM users WHERE (user = ?) AND (password = ?);'; | ||||
| 	$stmt = mysqli_prepare($con,$query); | ||||
| 	mysqli_stmt_bind_param($stmt,'s', $login, $password); | ||||
| 	mysqli_stmt_execute($stmt); | ||||
| 	mysqli_stmt_close($stmt); | ||||
| 	$stmt->store_result(); | ||||
| 	if ($stmt->num_rows() = 1) { | ||||
| 		mysql_close($con);		 | ||||
| 		echo 'done'; | ||||
| 	} | ||||
| } else { | ||||
| 		echo 'error'; | ||||
| } | ||||
|  | @ -0,0 +1,19 @@ | |||
| $("#form").on("submit", function(){ | ||||
| 	$.ajax({ | ||||
| 		url: '/src/login.php', | ||||
| 		method: 'post', | ||||
| 		dataType: 'html', | ||||
| 		data: $(this).serialize(), | ||||
| 		success: function(data){ | ||||
| 			$('#message').html(data); | ||||
| 		} | ||||
| 	}); | ||||
| }); | ||||
| 
 | ||||
| $('body').on('click', '#password-checkbox', function(){ | ||||
| 	if ($(this).is(':checked')){ | ||||
| 		$('#password').attr('type', 'text'); | ||||
| 	} else { | ||||
| 		$('#password').attr('type', 'password'); | ||||
| 	} | ||||
| }); | ||||
|  | @ -312,4 +312,67 @@ h2 { | |||
| .workout-main-content { | ||||
| 	height: 820px; | ||||
| 	padding-bottom: 10px; | ||||
| } | ||||
| 
 | ||||
| .login-main-content { | ||||
| 	height: 300px; | ||||
| 	padding-bottom: 10px; | ||||
| } | ||||
| 
 | ||||
| .login-form { | ||||
| 	width: 50%; | ||||
| 	text-align: center; | ||||
| 	grid-area: login-form; | ||||
| } | ||||
| 
 | ||||
| .login-input { | ||||
| 	width: 100%; | ||||
| 	border: none; | ||||
| 	border-radius: 5px; | ||||
| 	height: 30px; | ||||
| } | ||||
| 
 | ||||
| .login-button { | ||||
| 	background-color: #609A21; | ||||
| 	border: none; | ||||
| 	border-radius: 5px; | ||||
| 	width: 90%; | ||||
| 	color: #E0E0E0;	 | ||||
| 	font-family: segoe print; | ||||
| 	font-size: 16px; | ||||
| 	margin-top: 5px; | ||||
| } | ||||
| 
 | ||||
| .login-main { | ||||
| 	padding-left: 10px; | ||||
| 	width: 97%; | ||||
| 	display: grid; | ||||
| 	grid-template-columns: 35% 60% 5%; | ||||
| 	grid-template-areas: "login-left login-form login-right"; | ||||
| } | ||||
| 
 | ||||
| .login-left { | ||||
| 	grid-area: login-left; | ||||
| } | ||||
| 
 | ||||
| .login-right { | ||||
| 	grid-area: login-right; | ||||
| } | ||||
| 
 | ||||
| #login { | ||||
| 	margin-bottom: 10px;	 | ||||
| 	font-family: Arial; | ||||
| 	font-size: 16px; | ||||
| } | ||||
| 
 | ||||
| #password { | ||||
| 	margin-bottom: 10px;	 | ||||
| 	font-family: Arial; | ||||
| 	font-size: 16px; | ||||
| } | ||||
| 
 | ||||
| .password-label { | ||||
| 	font-family: segoe print; | ||||
| 	font-size: 14px; | ||||
| 	color: #E0E0E0; | ||||
| } | ||||
		Loading…
	
		Reference in New Issue