-
Notifications
You must be signed in to change notification settings - Fork 0
/
formvalid.php
113 lines (78 loc) · 1.88 KB
/
formvalid.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<html>
<head>
<title>Sky Net</title>
</head>
<body bgcolor="#ffe6ff">
<?php
$Fname=$_POST['Fname'];
$Lname=$_POST['Lname'];
$upassword=$_POST['password'];
/*echo $name."<br/>";
echo $email."<br/>";
//echo $password."<br/>";
echo $gender."<br/>";
echo $comments."<br/>";
echo $admin."<br/>";*/
// checking empty input for First Name
if(empty($_POST['Fname']))
{
echo "First Name is required <br/>";
}
else
{
//checking empty input for Last Name
if(empty($_POST['Lname']))
{
echo "Last Name is required <br/>";
}
else
{
//name validation
if (!preg_match("/^[a-z A-Z ]*$/",$_POST['Fname'])||!preg_match("/^[a-z A-Z ]*$/",$_POST['Lname']))
{
echo "not valid name";
}
else
{ //empty password
if(empty($_POST['password']))
{
echo "Password is requred <br/>";
}
else
{ //password validation
/*if(!preg_match("/([A-Z]{7}|[0-9]{1})/",$_POST['password'])
{
echo "Not a vallid password";
}
else
{
}*/
// correct this there is an issue
//echo "test done";
//echo "validation has been done<br/>";
//echo("done");
$server='127.0.0.1';
$user='root';
$password='';
$database='banana';
$conn=mysqli_connect($server,$user,$password,$database) or die("unable connect");
//check connection
echo('Successfully connected</br>');
$sql13="INSERT INTO myfriends (Fname,Lname,Password)
values ('$Fname','$Lname','$upassword');";
if(mysqli_query($conn,$sql13))
{
echo "successfully enterd a row ";
}
else
{
echo 'unable to enter a row'.mysqli_error($conn);
}
}
}
}
}
?>
<a href="EventRecoder.html"><button type="button" value="Add Event">Add Event</button></a>
</body>
</html>