Why login PHP is working but not with both of my html codes - Hack The Tech - Latest News related to Computer and Technology

Hack The Tech - Latest News related to Computer and Technology

Get Daily Latest News related to Computer and Technology and hack the world.

Tuesday, June 8, 2021

Why login PHP is working but not with both of my html codes

Hi I have this PHP code for login which checks the database for the credentials.. so when I use my code it works but when I use the html code which I made with a software it doesn't work... I have been trying for days yet I can't find the issue. My functional PHP code:

    <?php
    if(isset($_POST['submit'])){
    session_start();
    $con = mysqli_connect('localhost','root','') or die (mysqli_error($con));
    mysqli_select_db($con,'transportation') or die (mysqli_error($con));
    $name = $_POST['username1'];
    $pass = $_POST['password1'];
    $usertable = "SELECT * from customer where cusername = '$name' AND cpassword = '$pass'";
    $userresult = mysqli_query($con,$usertable);
    $numrows = mysqli_num_rows($userresult);
    if($numrows==1) {
        header('Location: Home.html');}
        else { echo"fuck";};
    };
    ?>
The HTML Code which it is working with:

<!DOCTYPE html>
<html lang="en" dir="ltr">
   <head>
      <meta charset="utf-8">
      <title>Login Form Design | CodeLab</title>
      <link rel="stylesheet" href="Login.css">
   </head>
   <body>
   <form action="login.php" method="POST">
      <div class="wrapper">
         <form action="login.php" method="POST">
            <div class="field">
               <input type="text" name="username1" required>
               <label>Username</label>
            </div>
            <div class="field">
               <input type="password" name="password1" required>
               <label>Password</label>
            </div>
            <div class="content">
               <div class="checkbox">                 
                  <label for="tou">Type of User:</label>
                  <select name="usertype" id="usertype">
                     <option value="Seller">Seller</option>
                     <option value="Buyer">Buyer</option>
                     <option value="DeliveryService">Delivery Service</option>
                     <option value="Administrator">Administrator</option>
                  </select>
               </div>
            </div>
         
            <div class="field">
               <input type="submit" name="submit" value="Login">
            </div>
         </form>
            <div class="signup-link">
               Not Registered Yet? <a href="#">Register now!</a>
            </div>
            <br> <br>
            <a href="Contact us.html">Contact us!</a>
            &nbsp; 
            <a href="#">About us</a>
         </form>
      </div>
   </body>
</html>

The HTML code which is NOT working with:

<!DOCTYPE html>
<html style="font-size: 16px;">
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta charset="utf-8">
    <meta name="keywords" content="Log in into your account">
    <meta name="description" content="">
    <meta name="page_type" content="np-template-header-footer-from-plugin">
    <title>Account login</title>
    <link rel="stylesheet" href="nicepage.css" media="screen">
<link rel="stylesheet" href="Account-login.css" media="screen">
    <script class="u-script" type="text/javascript" src="jquery.js" defer=""></script>
    <script class="u-script" type="text/javascript" src="nicepage.js" defer=""></script>
    <meta name="generator" content="Nicepage 3.16.1, nicepage.com">
    <link id="u-theme-google-font" rel="stylesheet" href="https://fonts.googleapis.com/css?family=Montserrat:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i|Open+Sans:300,300i,400,400i,600,600i,700,700i,800,800i">
    <script type="application/ld+json">{
        "@context": "http://schema.org",
        "@type": "Organization",
        "name": "",
        "url": "index.html",
        "logo": "images/image2.png"
}</script>
    <meta property="og:title" content="Account login">
    <meta property="og:type" content="website">
    <meta name="theme-color" content="#4345e7">
    <link rel="canonical" href="index.html">
    <meta property="og:url" content="index.html">
  </head>
  <body class="u-body"><header class="u-align-center-xs u-black u-clearfix u-header u-header" id="sec-3cd6"><div class="u-clearfix u-sheet u-sheet-1">
        <a href="https://nicepage.com" class="u-image u-logo u-image-1" data-image-width="260" data-image-height="182">
          <img src="images/image2.png" class="u-logo-image u-logo-image-1" data-image-width="127.75">
        </a>
        <nav class="u-align-left u-menu u-menu-dropdown u-nav-spacing-25 u-offcanvas u-menu-1">
          <div class="menu-collapse">
            <a class="u-button-style u-nav-link" href="#" style="padding: 4px 0px; font-size: calc(1em + 8px);">
              <svg class="u-svg-link" preserveAspectRatio="xMidYMin slice" viewBox="0 0 302 302" style=""><use xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#svg-7b92"></use></svg>
              <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="svg-7b92" x="0px" y="0px" viewBox="0 0 302 302" style="enable-background:new 0 0 302 302;" xml:space="preserve" class="u-svg-content"><g><rect y="36" width="302" height="30"></rect><rect y="236" width="302" height="30"></rect><rect y="136" width="302" height="30"></rect>
</g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g><g></g></svg>
            </a>
          </div>
          <div class="u-custom-menu u-nav-container">
            <ul class="u-nav u-unstyled u-nav-1"><li class="u-nav-item"><a class="u-black u-button-style u-hover-grey-60 u-nav-link" href="Home.html" style="padding: 16px 76px;">Home</a>
</li><li class="u-nav-item"><a class="u-black u-button-style u-hover-grey-60 u-nav-link" href="Account-login.html" style="padding: 16px 76px;">Account login</a>
</li><li class="u-nav-item"><a class="u-black u-button-style u-hover-grey-60 u-nav-link" href="Home.html#carousel_87fe" data-page-id="478423564" style="padding: 16px 76px;">Contact us</a>
</li><li class="u-nav-item"><a class="u-black u-button-style u-hover-grey-60 u-nav-link" href="Home.html#carousel_1196" data-page-id="478423564" style="padding: 16px 76px;">About us</a>
</li></ul>
          </div>
          <div class="u-custom-menu u-nav-container-collapse">
            <div class="u-align-center u-black u-container-style u-inner-container-layout u-opacity u-opacity-95 u-sidenav">
              <div class="u-sidenav-overflow">
                <div class="u-menu-close"></div>
                <ul class="u-align-center u-nav u-popupmenu-items u-unstyled u-nav-2"><li class="u-nav-item"><a class="u-button-style u-nav-link" href="Home.html" style="padding: 16px 76px;">Home</a>
</li><li class="u-nav-item"><a class="u-button-style u-nav-link" href="Account-login.html" style="padding: 16px 76px;">Account login</a>
</li><li class="u-nav-item"><a class="u-button-style u-nav-link" href="Home.html#carousel_87fe" data-page-id="478423564" style="padding: 16px 76px;">Contact us</a>
</li><li class="u-nav-item"><a class="u-button-style u-nav-link" href="Home.html#carousel_1196" data-page-id="478423564" style="padding: 16px 76px;">About us</a>
</li></ul>
              </div>
            </div>
            <div class="u-black u-menu-overlay u-opacity u-opacity-70"></div>
          </div>
        </nav>
      </div></header>
    <section class="u-clearfix u-section-1" src="" id="carousel_a1e5">
      <div class="u-clearfix u-sheet u-sheet-1">
        <h1 class="u-text u-text-1">Log in into your account</h1>
        <div class="u-clearfix u-layout-wrap u-layout-wrap-1">
          <div class="u-layout">
            <div class="u-layout-col">
              <div class="u-container-style u-layout-cell u-size-30 u-layout-cell-1">
                <div class="u-container-layout u-valign-bottom u-container-layout-1">
                  <img class="u-expanded-width u-image u-image-contain u-image-1" src="images/da6bd93bb11eeb7eed2d51d25dea710dbc453b92bfdd9539273a1326053b1df8355241eca65615c003642fc75637df69cc89060d497d562da480b1_1280.png" data-image-width="1280" data-image-height="1015">
                </div>
              </div>
              <div class="u-align-left u-container-style u-layout-cell u-size-30 u-white u-layout-cell-2">
                <div class="u-container-layout u-container-layout-2">
                  <div class="u-form u-form-1">
                    <form action="#" method="POST" class="u-clearfix u-form-spacing-27 u-form-vertical u-inner-form" style="padding: 0px;" source="custom" name="form">
                      <div class="u-form-group u-form-name u-form-group-1">
                        <label for="name-30a4" class="u-form-control-hidden u-label" wfd-invisible="true">Name</label>
                        <input type="text" placeholder="Username" id="name-30a4" name="username1" class="u-border-2 u-border-grey-5 u-grey-5 u-input u-input-rectangle u-radius-50 u-input-1" required="">
                      </div>
                      <div class="u-form-email u-form-group u-form-group-2">
                        <label for="email-cd2c" class="u-form-control-hidden u-label" wfd-invisible="true"></label>
                        <input type="text" id="email-cd2c" name="password1" class="u-border-2 u-border-grey-5 u-grey-5 u-input u-input-rectangle u-radius-50 u-input-2" required="" placeholder="Password">
                      </div>
                      <div class="u-align-left u-form-group u-form-submit u-form-group-3">
                        <a href="#" class="u-active-grey-75 u-border-1 u-border-active-grey-75 u-border-hover-black u-border-palette-2-base u-btn u-btn-round u-btn-submit u-button-style u-hover-black u-palette-2-light-1 u-radius-50 u-btn-1">Log in<br>
                        </a>
                        <input type="submit" value="submit" name="submit" class="u-form-control-hidden" wfd-invisible="true">
                      </div>
                      <div class="u-form-send-message u-form-send-success" wfd-invisible="true"> Thank you! Your message has been sent. </div>
                      <div class="u-form-send-error u-form-send-message" wfd-invisible="true"> Unable to send your message. Please fix errors then try again. </div>
                      <input type="hidden" value="" name="recaptchaResponse" wfd-invisible="true">
                    </form>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </section>    
    <footer class="u-align-center u-clearfix u-footer u-grey-80 u-footer" id="sec-f456"><div class="u-clearfix u-sheet u-valign-middle u-sheet-1">
        <p class="u-small-text u-text u-text-variant u-text-1">Sample text. Click to select the text box. Click again or double click to start editing the text.</p>
      </div></footer>
    <section class="u-backlink u-clearfix u-grey-80">
      <a class="u-link" href="https://nicepage.com/website-templates" target="_blank">
        <span>Website Templates</span>
      </a>
      <p class="u-text">
        <span>created with</span>
      </p>
      <a class="u-link" href="https://nicepage.com/" target="_blank">
        <span>Website Builder Software</span>
      </a>
    </section>
  </body>
</html>

So yeah this website is saying that my post is mostly code so I write some more things here.. I don't know what it could affect it I tried different techniques by adding the PHP into the same file and also in a different file. I tried deleting some classes or references and links but nothing seemed to work.. I also tried to delete the log in button and make my own so the issue might be coming for the text inputs.



source https://stackoverflow.com/questions/67876680/why-login-php-is-working-but-not-with-both-of-my-html-codes

No comments:

Post a Comment