problem with a alarm program

Hi i am an italian student and i'm working about a domotic home with an alarm and a keypad to generate a code and a lcd display, i want to know if this program is right....i have to control two magnetic sensor with arduino and a keypad 4x4 to switch off and on the alarm.
The program isn't complete because i have a problem: when i send the program the number on the display starts autmatically even that i push a key, thank you very much.

#include <LiquidCrystal.h>
LiquidCrystal lcd(12,11,5,4,3,2);
int ri1=31;
int ri2=33;
int ri3=35;
int ri4=37;
int co1=39;
int co2=41;
int co3=43;
int co4=45;
int r1;
int r2;
int r3;
int r4;
int c1;
int c2;
int c3;
int c4;
char str1 [4];
char str2 [4] = {'2','5','8','0'};

void setup () {
pinMode (ri1,INPUT);
pinMode (ri2,INPUT);
pinMode (ri3,INPUT);
pinMode (ri4,INPUT);
pinMode (co1,INPUT);
pinMode (co2,INPUT);
pinMode (co3,INPUT);
pinMode (co4,INPUT);
lcd.begin (16,2);
lcd.clear ();
}

void loop () {
r1 = digitalRead (ri1);
r2 = digitalRead (ri2);
r3 = digitalRead (ri3);
r4 = digitalRead (ri4);
c1 = digitalRead (co1);
c2 = digitalRead (co2);
c3 = digitalRead (co3);
c4 = digitalRead (co4);
if (r1==HIGH & c1==HIGH) {
lcd.setCursor (0,0);
lcd.print ("1");
char str1 [4] = "1";
delay (1000);}
if (r1==HIGH & c2==HIGH) {
lcd.setCursor (0,0);
lcd.print ("2");
char str1 [4] = "2";
delay (1000);}
if (r1==HIGH & c3==HIGH) {
lcd.setCursor (0,0);
lcd.print ("3");
char str1 [4] = "3";
delay (1000);}
if (r2==HIGH & c1==HIGH) {
lcd.setCursor (0,0);
lcd.print ("4");
char str1 [4] = "4";
delay (1000);}
if (r2==HIGH & c2==HIGH) {
lcd.setCursor (0,0);
lcd.print ("5");
char str1 [4] = "5";
delay (1000);}
if (r2==HIGH & c3==HIGH) {
lcd.setCursor (0,0);
lcd.print ("6");
char str1 [4] = "6";
delay (1000);}
if (r3==HIGH & c1==HIGH) {
lcd.setCursor (0,0);
lcd.print ("7");
char str1 [4] = "7";
delay (1000);}
if (r3==HIGH & c2==HIGH) {
lcd.setCursor (0,0);
lcd.print ("8");
char str1 [4] = "8";
delay (1000);}
if (r3==HIGH & c3==HIGH) {
lcd.setCursor (0,0);
lcd.print ("9");
char str1 [4] = "9";
delay (1000);}
if (r4==HIGH & c1==HIGH) {
lcd.setCursor (0,0);
lcd.print ("*");
delay (1000);}
if (r4==HIGH & c2==HIGH) {
lcd.setCursor (0,0);
lcd.print ("0");
char str1 [4] = "0";
delay (1000);}
if (r4==HIGH & c3==HIGH) {
lcd.setCursor (0,0);
lcd.print ("#");
delay (1000);}
if (str1 == str2) {
lcd.clear ();
lcd.print ("ok"); }
}

and a keypad

So, why are you NOT using the Keypad library?

Because i'm not able to use it, i haven'ti studied it...i had tried to study it on Internet but i didn't succeed

Because i'm not able to use it

Why not?

i haven'ti studied it

Not much to study. Find the library. Download it. Open the example. Connect the keypad the same way (except using your pin numbers). Put your pin numbers in the example.

i had tried to study it on Internet but i didn't succeed

Well, that's a reason to quit. If you are studying scuba diving or sky diving. Not programming.

There is nothing much to study. With basic programming skills you can understand everything you need.

You can try this site