Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php include("includes/header.php"); ?>
- <?php
- $CONNECT = mysqli_connect('localhost', 'litcoine_Trollbump', '4994797712alex', 'litcoine_project');
- if (!$CONNECT) {
- die('Ошибка соединения: ' . mysql_error());
- }
- //echo("Успешно соединились");
- if($_COOKIE['enter'] != "")
- {
- header("Location: intropage.php");
- }
- //echo("1");
- if (isset($_POST['login']))
- {
- //echo("2");
- if(!empty($_POST['username']) && !empty($_POST['password']))
- {
- $username=$_POST['username'];
- $password=md5(md5(md5(md5(md5($_POST['password'])))));
- $result_set = $CONNECT->query("SELECT * FROM users WHERE login='$username' AND password='$password'");
- $row = $result_set->fetch_assoc();
- if($row)
- {
- $dbusername=$row['login'];
- $dbpassword=$row['password'];
- $type = $row['type'];
- if($username == $dbusername && $password == $dbpassword)
- {
- if(setcookie('enter', $username, time() + 3600, "/", "litcoiners.xyz"))
- {
- //echo("cookie set");
- }
- if(setcookie('type', $type, time() + 3600, "/", "litcoiners.xyz"))
- {
- //echo("cookie set");
- }
- /* Redirect browser */
- header("Location: intropage.php");
- }
- }
- else
- {
- $message = "Invalid username or password!";
- }
- }
- else
- {
- $message = "All fields are required!";
- }
- }
- ?>
- <div class="container mlogin">
- <div id="login">
- <h1>LOGIN</h1>
- <form name="loginform" id="loginform" action="" method="POST">
- <p>
- <label for="user_login">Username<br />
- <input type="text" name="username" id="username" class="input" value="" size="20" /></label>
- </p>
- <p>
- <label for="user_pass">Password<br />
- <input type="password" name="password" id="password" class="input" value="" size="20" /></label>
- </p>
- <p class="submit">
- <input type="submit" name="login" class="button" value="Log In" />
- </p>
- <p class="regtext">No account yet? <a href="register.php" >Register Here</a>!</p>
- </form>
- </div>
- </div>
- <?php include("includes/footer.php"); ?>
- <?php if (!empty($message)) {echo "<p class=\"error\">" . "MESSAGE: ". $message . "</p>";} ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement