Question

In: Computer Science

using PDO, MYSQL, and Html, how can i create a simple registration and login form for...

using PDO, MYSQL, and Html, how can i create a simple registration and login form for cPanel?

Solutions

Expert Solution

using PDO, MYSQL, and Html, how can i create a simple registration and login form for cPanel?

Ans: It's very simple, you can utilize PDO for interfacing front end and back end (i.e. MySQL database with HTML page).

You need to have a basic knowledge about PHP, Oracle DBMS, and some html basics, that will be enough for making a registration form and a login form.

Now, it's easy to create a registration form, you simply need to create a form using HTML, and with the help of PHP you need to interface with MySQL so that the registered user's data can be stored in the database.

Now, for login purpose, you need to access the registration database to authenticate if the login credentials provided by the user is already stored in the database or not, if yes then it will successfully log in to the page and if not, then we shoud create a pop up or any normal message saying "Invalid Login Id or password".

Example : Login.php:

<?php
use Phppot\Member;

if (! empty($_POST["login-btn"])) {
    require_once __DIR__ . '/Model/Member.php';
    $member = new Member();
    $loginResult = $member->loginMember();
}
?>
<HTML>
<HEAD>
<TITLE>Login</TITLE>
<link href="assets/css/phppot-style.css" type="text/css"
        rel="stylesheet" />
<link href="assets/css/user-registration.css" type="text/css"
        rel="stylesheet" />
<script src="vendor/jquery/jquery-3.3.1.js" type="text/javascript"></script>
</HEAD>
<BODY>
        <div class="phppot-container">
                <div class="sign-up-container">
                        <div class="login-signup">
                                <a href="user-registration.php">Sign up</a>
                        </div>
                        <div class="signup-align">
                                <form name="login" action="" method="post"
                                        onsubmit="return loginValidation()">
                                        <div class="signup-heading">Login</div>
                                <?php if(!empty($loginResult)){?>
                                <div class="error-msg"><?php echo $loginResult;?></div>
                                <?php }?>
                                <div class="row">
                                                <div class="inline-block">
                                                        <div class="form-label">
                                                                Username<span class="required error" id="username-info"></span>
                                                        </div>
                                                        <input class="input-box-330" type="text" name="username"
                                                                id="username">
                                                </div>
                                        </div>
                                        <div class="row">
                                                <div class="inline-block">
                                                        <div class="form-label">
                                                                Password<span class="required error" id="login-password-info"></span>
                                                        </div>
                                                        <input class="input-box-330" type="password"
                                                                name="login-password" id="login-password">
                                                </div>
                                        </div>
                                        <div class="row">
                                                <input class="btn" type="submit" name="login-btn"
                                                        id="login-btn" value="Login">
                                        </div>
                                </form>
                        </div>
                </div>
        </div>

        <script>
function loginValidation() {
        var valid = true;
        $("#username").removeClass("error-field");
        $("#password").removeClass("error-field");

        var UserName = $("#username").val();
        var Password = $('#login-password').val();

        $("#username-info").html("").hide();

        if (UserName.trim() == "") {
                $("#username-info").html("required.").css("color", "#ee0000").show();
                $("#username").addClass("error-field");
                valid = false;
        }
        if (Password.trim() == "") {
                $("#login-password-info").html("required.").css("color", "#ee0000").show();
                $("#login-password").addClass("error-field");
                valid = false;
        }
        if (valid == false) {
                $('.error-field').first().focus();
                valid = false;
        }
        return valid;
}
</script>
</BODY>
</HTML>

This is how a login code looks like.

Therefore, this information will suffice for creating your registration and login page with the technological tools provided.

Let me know if you have any doubts or if you need anything to change. 

If you are satisfied with the solution, please leave a +ve feedback : ) Let me know for any help with any other questions.

Thank You!
===========================================================================

Related Solutions

Using PHP and MYSQL and with a simple customer database, how can I create a simple...
Using PHP and MYSQL and with a simple customer database, how can I create a simple log in and registration system for an ecommerce site
HTML 5 (Website Registration Form with Optional Survey) Create a website registration form to obtain a...
HTML 5 (Website Registration Form with Optional Survey) Create a website registration form to obtain a user’s first name, last name and e-mail address. In addition, include an optional survey question that asks the user’s year in college (e.g., Freshman). Place the optional survey question in a details element that the user can expand to see the question.
Using PHP and MySQL Create a simple web form with at least 5 fields Include validation...
Using PHP and MySQL Create a simple web form with at least 5 fields Include validation and error messages Create a MySQL Database Create a table to store submissions from the form Only insert new data into the database when all validation is passed Use PHP to create an HTML table showing all the content of the database   New submissions should appear in table
Create a Registration and login page using React,nodejs and all the data should store in MongoDB...
Create a Registration and login page using React,nodejs and all the data should store in MongoDB database.
Create in html5 a Website Registration Form with Optional Survey) Create a website registration form to...
Create in html5 a Website Registration Form with Optional Survey) Create a website registration form to obtain a user’s first name, last name and e-mail address. In addition, include an optional survey question that asks the user’s year in college (e.g, freshman,junior). Place the optional survey question in a details element that the user can expand to see the question.
Create a program using python that provides a simple calculator: Requires a login with a prompt...
Create a program using python that provides a simple calculator: Requires a login with a prompt for a username and a password prior to using the calculator If username and password are incorrect, the program should re-prompt to re-enter correct username and password Once logged in, the user should have access to the calculator and should have the ability for the following mathematical operators: Addition Subtraction Multiplication Division Square Root PI Exponents
Using the zip file provided, create a secure login/registration app. Make sure that your game pages...
Using the zip file provided, create a secure login/registration app. Make sure that your game pages (at least two) are unavailable to unregistered users. Upload a zip file with your working PHP application. Contents of zip Index.php ----------------- <!DOCTYPE html> <html>     <head>         <meta charset="UTF-8">         <title></title>     </head>     <body>         <?php         // 1. display error message in the session (if any): $_SESSION['error']         // 2. display either the user's name and the game menu or the...
Create a form using the following HTML elements at a minimum. Style the form in your...
Create a form using the following HTML elements at a minimum. Style the form in your CSS. You do not need to include a form action (i.e. the form doesn't have to do anything - we're designing the front end of the form). textarea textbox input type of "email" select radio button checkbox submit button style at least three elements of your form in your stylesheet, including your submit button Use a comment to delineate the beginning and end of...
Create following webpage in HTML : 1. Login Page This is the first page the user...
Create following webpage in HTML : 1. Login Page This is the first page the user should see. The user can login, signup, or continue as a guest. Your task is to implement the following features: a) Signup form This form should collect the information required for creating a new account on your movie database website. At the least, it should collect an email address, username, avatar image/graphic, first name, last name, and a password. You can ask for more...
JS Bin / Tax Calculator / using HTML | CSS | JavaScript ------------------------------------------------------------------------------------------- How can I...
JS Bin / Tax Calculator / using HTML | CSS | JavaScript ------------------------------------------------------------------------------------------- How can I edit the JavaScript below so that when the calculate button is clicked the total price only shows two decimal places by using the toFixed() method? ----------------------------------------------------------------------------------------------------------- JavaScript: // Variables var tax = "tax"; // Tax percentage var taxRate = document.getElementById('tax'); // Selecting tax element // On the time of loading the DOM we are setting the tax rate window.addEventListener('DOMContentLoaded', (event) => { taxRate.value =...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT