Tuesday, April 21, 2020

LOGIN SYSTEM IN PERL AND MYSQL

I wrote this login system using Perl programming language and MySQL database I try to search this code over the Internet but unfortunately, I can't found any so I decided to write one. I hope this can help you learn database programming and security using Perl and MySQL.

I am currently accepting programming work inventory system, enrollment system, accounting system, payroll system, information system, website design and development using WordPress, IT projects, school and application development, programming projects, thesis, and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details. If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is +63 (034) 4335675.

Here in Bacolod City, Negros Occidental I also accepting computer repair, web development using WordPress, Computer Networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com

My programming website is http://www.jakerpomperada.blogspot.com

I am also a book author you can purchase my books on computer programming and information technology in the following links below.

https://www.mindshaperspublishing.com/

https://www.unlimitedbooksph.com/




Sample Program Output


Program Listing

login.pl

# login.pl
# Author   : Jake R. Pomperada,MAED-IT,MIT
# Date     : April 21, 2020   Tuesday   4:25 PM
# Location : Bacolod City, Negros Occidental
# Email    : jakerpomperada@gmail.com
# Websites : http://www.jakerpomperada.com
#            http://www.jakerpomperada.blogspot.com


# Login System Using Perl and MySQL Database


use DBI;

$myConnection = DBI->connect('DBI:mysql:login:localhost','root','');

sub get_pword {
    use Term::ReadKey;

    my ($prompt) = shift; 
    my $pword;
    my $key;
    local $| = 1;  
    print "$prompt: ";
    ReadMode 4;   
    while( 1 ) {
        while (not defined ($key = ReadKey(-1))) { }
        if(ord($key) == 13) {
            print "\n";       
            last;            
        }
        print '*';
        $pword .= $key;
    }
    ReadMode 0; 
    return $pword; 
}


back:
printf("\n\n");
printf("\t\t===== LOGIN SYSTEM IN PERL AND MYSQL =====");
printf("\n\n");
printf("\t\tCreated By: Mr. Jake R. Pomperada,MAED-IT,MIT");
printf("\n\n");
print "\tEnter Username   : ";
chomp($name =<>);

printf("\n");
my $pass = get_pword("\tEnter Password   " );

$username= lc $name;
$password = uc $pass;


my $sql = q{
   SELECT COUNT(*) 
   FROM users 
   WHERE username = ? and 
         password = ?
};

if (($myConnection->selectcol_arrayref($sql, undef, $username, $password)->[0] == 1)) {
printf("\n\n");
     printf("\tUsername and Password Accepted. Welcome to the System.");
} else {
     printf("\n\n");
     printf("\tUsername and Password is Not Correct. Please Try Again.");
     goto back;
}
printf("\n\n");
# End of Code 


logil.sql

-- phpMyAdmin SQL Dump
-- version 4.0.4.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Apr 21, 2020 at 11:57 AM
-- Server version: 5.6.11
-- PHP Version: 5.5.1

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `login`
--
CREATE DATABASE IF NOT EXISTS `login` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `login`;

-- --------------------------------------------------------

--
-- Table structure for table `users`
--

CREATE TABLE IF NOT EXISTS `users` (
  `id` int(15) NOT NULL AUTO_INCREMENT,
  `username` varchar(100) NOT NULL,
  `password` varchar(100) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

--
-- Dumping data for table `users`
--

INSERT INTO `users` (`id`, `username`, `password`) VALUES
(1, '123', '123'),
(2, 'admin', 'admin');

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;





No comments:

Post a Comment