Hi Team,
I want the html code with which i can create a log in page, and when user id and password is put it should open a small page which is basically created in html.

I have used the below html tag to create an user nad password column

<html>
<body style="background-color:#5A6673">
                 <h1 style="text-align:center"><b>My Site</b></h1>


<frameset cols="40%,60%">

<form action="">
               Username: <input type="text" name="user" /><br />
               

Password: <input type="password" name="password" />
               
<input type="submit" value="Submit" />
</form>

</body>
</html>

Kindly do advice..

Dani AI

Generated

HTML alone cannot provide a secure login. The original post by used a frameset and a plain form; framesets are obsolete (as notes) and client-side-only checks are insecure. The correct flow — echoed by — is: POST credentials from the form to a server-side script, validate those credentials against a database, create a server-side session, and require that session on every restricted page. is right that the form action must point at the server script; avoid popups or frames for authentication UIs.

A minimal, secure server-side pattern (example in PHP) uses prepared statements and password hashing. Example login handler:

// login.php (POST handler)
session_start();
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $u = $_POST['username'] ?? '';
    $p = $_POST['password'] ?? '';

    $pdo = new PDO('mysql:host=localhost;dbname=myapp;charset=utf8mb4', 'dbuser', 'dbpass', [
        PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
    ]);

    $stmt = $pdo->prepare('SELECT id, password_hash FROM users WHERE username = ? LIMIT 1');
    $stmt->execute([$u]);
    $user = $stmt->fetch(PDO::FETCH_ASSOC);

    if ($user && password_verify($p, $user['password_hash'])) {
        session_regenerate_id(true);
        $_SESSION['user_id'] = $user['id'];
        header('Location: dashboard.php');
        exit;
    }
    $error = 'Invalid username or password.';
}

Key hardening and practical notes: always use HTTPS; store only salted hashes (use password_hash/password_verify or Argon2bcrypt equivalents), never plaintext; use prepared statements to prevent SQL injection; set session cookies with Secure, HttpOnly and SameSite flags and call session_regenerate_id(true) on login; protect every restricted page by checking the session; use CSRF tokens for stateful forms; present generic error messages and implement rate-limiting or lockouts to slow brute-force attempts. The DB-side approach in ’s post is workable if it verifies hashed passwords and uses parameterized queries. For static hosting or very small sites, Apache Basic Auth (.htaccess) can protect a folder but is not a substitute for application-level authentication. Hosted auth providers are an option to avoid rolling security-critical code from scratch.

Recommended Answers

All 4 Replies

You need to learn PHP programming and MySQL databases to do this properly. It is not a simple fix. You then need to secure each and every page that is for logged in people to exclude those who are not authorised. The action part of the form has to call a script (program) that you write to process the data input.

Alternatively, you can use the .htaccess file to secure a folder, but be aware that you might just lock yourself out as well.

create or replace procedure CheckLogin(u_name in varchar2, u_pwd in varchar2,is_admin in number) is
uname varchar2(30);
upwd varchar2(30);
begin
if (is_admin = 0) then
select user_name,password into uname,upwd from cms_users_login
where user_name = u_name and password = u_pwd;
else
select admin_name,password into uname,upwd from cms_admin_login
where admin_name = u_name and password = u_pwd;
end if;
end CheckLogin;
==================
personal trainer certification
business intelligence consultants

Hi Team,
I want the html code with which i can create a log in page, and when user id and password is put it should open a small page which is basically created in html.

I have used the below html tag to create an user nad password column

<html>
<body style="background-color:#5A6673">
                 <h1 style="text-align:center"><b>My Site</b></h1>


<frameset cols="40%,60%">

<form action="">
               Username: <input type="text" name="user" /><br />
               

Password: <input type="password" name="password" />
               
<input type="submit" value="Submit" />
</form>

</body>
</html>

Kindly do advice..

Create that small page and give URI of that page as value of action attribute of form tag e.g. <form action="small-page.html">. opening poup is not recommended.

Member Avatar for Member #120589

YUK! Framesets? This is 2010.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.