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
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 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.
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...
Need this in java .Create a simple login screen in java That lets people sign in...
Need this in java .Create a simple login screen in java That lets people sign in to the emergency room. It needs to ask for name, social,and DOB. Once all the information is received it then display the info back to them if any info is is missing have the program prompt the user to re enter their information.
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 =...
Using the sample.sql script, create the sample database in MySQL. Submit the MySQL interactive screen that...
Using the sample.sql script, create the sample database in MySQL. Submit the MySQL interactive screen that results. create database sample; use sample; create table customer (custno int auto_increment primary key, firstname varchar(20), middle varchar(20), lastname varchar(20), address varchar(60), telnum1 varchar(10), telnum2 varchar(10), telnum3 varchar(10), pin varchar(6), email varchar(30)); create table accttype (id int primary key, type varchar(10)); insert into accttype (id, type) values (1,'check'); insert into accttype (id, type) values (2,'save'); insert into accttype (id, type) values (3,'cd'); insert into...
- Create an html form (bank form) and the PHP code with 2 accounts with options...
- Create an html form (bank form) and the PHP code with 2 accounts with options to transfer, deposit or withdraw money.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT