Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!------------------------------------------------------PHP------------------------------------------------------->
- <?php include 'connectDB.php';
- $username='';
- $password='';
- if (isset($_POST['submit'])) {
- $username = $_POST['username'];
- $password = $_POST['password'];
- $result=mysqli_query($con,"SELECT * from lab5_user WHERE username='$username' AND password='$password'");
- if(mysqli_num_rows($result)>0)
- {
- echo '<script>';
- echo 'alert("Login Successful");';
- echo 'window.location.href = "mainPage.php";';
- echo '</script>';
- }
- else
- {
- echo '<script>';
- echo 'alert("Login Failed");';
- echo '</script>';
- }
- }
- ?>
- <!------------------------------------------------------CS------------------------------------------------------->
- <style>
- body{
- background-image: url(images/cover2.jpg) ;
- background-size: 100%;
- background-repeat: no-repeat;
- background-position: center;
- }
- .containerlogin{
- text-align: center;
- margin:0px;
- padding-top:100px;
- }
- input[type=text],input[type=password],button[type=submit],select {
- width: 20%%;
- padding: 12px 20px;
- margin: 8px 0;
- display: inline-block;
- border: 2px solid #000000;
- border-radius: 14px;
- box-sizing: border-box;
- text-align: center
- }
- h3{
- font-family: Arial, Helvetica, sans-serif;
- font-size: 80px;
- color: #f2f2f2;
- margin:20px;
- }
- .btnsubmit:hover {
- background-color: #ffffff; /* Green */
- color: black;
- }
- p{
- font-size:20px;
- font-weight: bold;
- color:white;
- }
- a{
- color: white;
- font-size:23px;
- font-weight: bold;
- }
- a:hover{
- color: black;
- }
- </style>
- <!------------------------------------------------------JAVASCRIPT------------------------------------------------------->
- <script>
- function setData(){
- var username= document.getElementById("username").value;
- document.cookie="username="+username;
- }
- </script>
- <!------------------------------------------------------HTML------------------------------------------------------->
- <body>
- <div class="containerlogin">
- <h3>Login Panel</h3>
- <form method="post">
- <input type=text id="username" name="username" placeholder="Username" required>
- <br>
- <input type=password id="password" name="password" placeholder="Password" required>
- <br>
- <button class=btnsubmit type="submit" name="submit" id=submit onclick="setData()">Submit</button>
- <br>
- <p>Dont have an account?</p><a href="registerPage.php">Create Now</a>
- </form>
- </div>
- </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement