Saturday, February 10, 2018

Login Security System with Display Username in Visual Basic NET and Microsoft Access

Here is a program that I wrote using Microsoft Visual Basic NET 2013 and Microsoft Access 2010 to protect the user from intruders I called this program login security system. The program will search and display the name of the registered user of the system. I hope you will find my work useful.

I am currently accepting programming and web development work kindly contact me in the following email address for further details. Thank you.

My email address are the following jakerpomperada@gmail.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 is (034) 4335675.




Database, Table and Sample Record structure in Microsoft Access 2010









Sample Program Output


Program Listing

Form1.vb

Imports System.Data.OleDb


Public Class Form1
    Public fullname As String
    Dim user As String = ""
    Dim pass As String = ""

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim con As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\Login.accdb")
        Dim cmd As OleDbCommand = New OleDbCommand( _
                   "SELECT * FROM tblusers WHERE USERNAME = '" & _
                   TextBox1.Text & "' AND PASSCODE = '" & TextBox2.Text & "' ", con)
        con.Open()
        Dim sdr As OleDbDataReader = cmd.ExecuteReader()
        If (sdr.Read() = True) Then
            user = sdr("USERNAME")
            pass = sdr("PASSCODE")
            fullname = sdr("FIRSTNAME") + " " + sdr("LASTNAME")
            Form2.Show()
        Else
            MessageBox.Show("Invalid username or password!")
            TextBox1.Text = ""
            TextBox2.Text = ""
            TextBox1.Focus()
        End If
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Me.Close()
    End Sub
End Class

Form2.vb

Public Class Form2

    Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Me.Show()
        Label2.Text = Trim(Form1.fullname)
    End Sub
End Class







Tuesday, February 6, 2018

Armstrong Number in JavaScript

Here is a sample program that will check if the given number is an Armstrong Number or Not using JavaScript. I hope you will find my work useful.

I am currently accepting programming and web development work kindly contact me in the following email address for further details. Thank you.

My email address are the following jakerpomperada@gmail.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 is (034) 4335675.






Sample Program Output


Program Listing

index.htm


<!--
 Written By Mr. Jake R. Pomperada, MAED-IT
 February 6, 2018   04:24 PM   Tueday
 Bacolod City, Negros Occidental Republic of the Philippines
 jakerpomperada@yahoo.com and jakerpomperada@gmail.com -->
<!doctype html>
<html>
<head>
<title> Armstrong Number in JavaScript </title>
<style>

   .art {

      font-family: arial;
      font-weight: bold;
      color:red;
      text-align: center;
      width:45%;
      background-color:yellow;
   }

.art2 {

      font-family: arial;
      font-weight: bold;
      font-size: 25px;
      color:blue;
      text-align: center;
      width:45%;
      background-color:lightgreen;
   }

   body {
     font-family: arial;
     font-weight: bold;
     font-size: 20px;
   }

   #button_me {
    background-color: #008CBA;
    font-family: arial;
    font-weight: bold;
    font-size: 20px;
    height: 50px;
    width: 120px
     text-align: center;
    cursor: pointer;
 }

 input[type=text] {
    font-family: arial;
    font-weight: bold;
    font-size: 20px;
   
 }
</style>
      
<script>

function armstrong()
{

var arm=0,a,b,c,d,num;
num=Number(document.getElementById("no_input").value);

temp=num;
while(temp>0)
{
a=temp%10;
temp=parseInt(temp/10); // convert float into Integer
arm=arm+a*a*a;
}
if(arm==num)
{

 document.getElementById("msg").innerHTML = "The given number " + num
 + " is a Armstrong number.";
}
else
{
document.getElementById("msg").innerHTML = "The given number " + num
 + " is Not a Armstrong number.";
}
}
</script>

<script>
function clear_me()
{
document.getElementById("msg").innerHTML = "";
document.getElementById("no_input").value = "";
document.getElementById("no_input").focus();
}
</script>

</head>
<body>
<h1 class="art"> Armstrong Number in JavaScript </h1>
    <p  class="art2"> Created By Mr. Jake R. Pomperada, MAED-IT </p>
<br><br>
Give a Number <input id="no_input" type="text" size="5" autofocus>
<br><br>
<p id="msg"> </p> 
<button id="button_me" onclick="armstrong()">Check</button>
&nbsp;&nbsp;&nbsp;
<button id="button_me" onclick="clear_me()">Clear</button>
</br></br>
</body>
</html>






Difference of Two Numbers in PHP

Here is a simple code in PHP to solve the difference of the two numbers.

I am currently accepting programming and web development work kindly contact me in the following email address for further details. Thank you.

My email address are the following jakerpomperada@gmail.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 is (034) 4335675.




Sample Program Output



Program Listing

diff.php



<html>
  <head>
   <title>Difference of Two Number in PHP </title>
  </head>
  <style>
    body {
            font-family:arial;
            size:16px;
             } 
 </style>
  <body>
    <?php

      $a = 5;
      $b = 2;
  
      $difference = ($a - $b);

     echo "The difference of $a and $b is $difference.";

    ?>

</body>
</html>

   
     

Friday, February 2, 2018

Factorial Number in Java


A simple program that will ask the user to give a number and then our program will compute the factorial value of the given number using Java programming language.  

I am currently accepting programming and web development work kindly contact me in the following email address for further details. Thank you.

My email address are the following jakerpomperada@gmail.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 is (034) 4335675.






Sample Program Output


Program Listing

factorial.java

import java.util.Scanner;

// factorial.java
// Written By Mr. Jake R. Pomperada, MAED-IT
// February 2, 2018   4:24 PM   Friday
// Bacolod City, Negros Occidental Republic of the Philippines
// jakerpomperada@yahoo.com and jakerpomperada@gmail.com

class factorial {
public static void main(String[] args)
      {

      int num1=0, c=0, fact = 1;


        Scanner s = new Scanner(System.in);

        System.out.println();
        System.out.println("=== Factorial Number in Java === ");
        System.out.println();

         System.out.print("Give a Number : ");
         num1 = s.nextInt();

if (num1 < 0) {
     System.out.println("\n");
         System.out.println("Number should be non-negative.");
}
      else
      {
         for (c = 1; c <= num1; c++)
            fact = fact*c;
   }
         System.out.println("\n");
         System.out.println("The factorial value of "+num1+" is = "+fact);
System.out.println("\n");
System.out.println("\t End of Program");
         System.out.println();
}
}




Longest Word in PHP

In this article I would like to share with you a sample program that I wrote using PHP that will ask the user to give a sentence and then our program will check and determine which of the word in the given sentence is the longest. The code is very simple and easy to understand.

I am currently accepting programming and web development work kindly contact me in the following email address for further details. Thank you.

My email address are the following jakerpomperada@gmail.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 is (034) 4335675.







Sample Program Output


Program Listing

long.php

<!-- long.php                                        -->
<!-- Written By Mr. Jake R. Pomperada, MAED-IT             -->
<!-- February 2, 2018 Friday   4:03 PM               -->
<!-- jakerpomperada@yahoo.com and jakerpomperada@gmail.com -->
<!-- Bacolod City, Negros Occidental Philippines           -->
<!DOCTYPE html>
<html> 
<head>
   <title>Longest Word in PHP</title>
   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
   </head>
   <style>

   .art {

      font-family: arial;
      font-weight: bold;
      color:red;
      text-align: center;
      width:45%;
      background-color:yellow;
   }

.art2 {

      font-family: arial;
      font-weight: bold;
      font-size: 25px;
      color:blue;
      text-align: center;
      width:45%;
      background-color:lightgreen;
   }

   body {
     font-family: arial;
     font-weight: bold;
     font-size: 20px;
   }

   input[type=submit] {
    background-color: #008CBA;
    font-family: arial;
    font-weight: bold;
    font-size: 20px;
    height: 50px;
    width: 120px
     text-align: center;
    cursor: pointer;
 }

 input[type=text] {
    font-family: arial;
    font-weight: bold;
    font-size: 20px;
   
 }
</style>
   <body>
    <?php
    error_reporting(0);
    
    ?>
    <h1 class="art"> Longest Word in PHP </h1>
    <p  class="art2"> Created By Mr. Jake R. Pomperada, MAED-IT </p>
    <br><br>
   <form method="post">
   Enter a Sentence :
 <input type="text" name="val_str" size="50" autofocus=""><br><br>
 <input type="submit" name="submit" value="Check"> &nbsp;&nbsp;&nbsp;
 <input type="submit" name="clear" value="Clear">
 </form><br><br><br>
<?php

function longest_word($str_test)
{
$words  = explode(' ', $str_test);

$longestWordLength = 0;
$longestWord = '';

foreach ($words as $word) {
   if (strlen($word) > $longestWordLength) {
      $longestWordLength = strlen($word);
      $longestWord = $word;
   }
}
return strtoupper($longestWord);
}

 if(isset($_POST['submit']))  
    { 

      $str_value = $_POST['val_str'];

      $display = "The longest word is " .longest_word($str_value).".";
      echo "The sentence : " .$str_value;
      echo "<br><br>";
      echo $display;
  
 }

 if(isset($_POST['clear']))  
    { 
    $display="";
    }

?>
</body>
</html>