Coders Packet

Login and verification in C# (Sharp)

By ITIKELA CHIRANMAI

Log in to the system and verify the details that are provided by the user and help in creating a profile in an easy manner.

This project helps in creating a user profile and in verifying the login details again.

And you can also check the login details by entering the used login details.

using System;

class Program
{
    static void Main()
    {
        string correctUsername = "admin";
        string correctPassword = "password";

        Console.WriteLine("Profile Creation");

        Console.Write("Enter username: ");
        string username = Console.ReadLine();

        Console.Write("Enter password: ");
        string password = Console.ReadLine();

        Console.WriteLine("\nPlease verify your details:");

        Console.Write("Username: ");
        string verifyUsername = Console.ReadLine();

        Console.Write("Password: ");
        string verifyPassword = Console.ReadLine();

        if (username == verifyUsername && password == verifyPassword)
        {
            Console.WriteLine("\nProfile creation successful!");

            Console.WriteLine("\nLogin Page");

            Console.Write("Username: ");
            string loginUsername = Console.ReadLine();

            Console.Write("Password: ");
            string loginPassword = Console.ReadLine();

            if (loginUsername == username && loginPassword == password)
            {
                Console.WriteLine("Login successful!");
                // Additional code or logic can be added here for further actions after successful login.
            }
            else
            {
                Console.WriteLine("Invalid username or password. Please try again.");
                // Additional code or logic can be added here for handling failed login attempts.
            }
        }
        else
        {
            Console.WriteLine("\nVerification failed. Please check your details and try again.");
            // Additional code or logic can be added here for handling failed verification.
        }

        Console.ReadLine();
    }
}

 

OUTPUT:

Profile Creation
Enter username: sun
Enter password: sun

Please verify your details:
Username: sun
Password: sun

Profile creation successful!

Login Page
Username: sun
Password: sun
Login successful!

OUTPUT



 

Download Complete Code

Comments

No comments yet

Download Packet

Reviews Report

Submitted by ITIKELA CHIRANMAI (Chiranmai)

Download packets of source code on Coders Packet