-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwelcome.php
More file actions
115 lines (110 loc) · 3.5 KB
/
welcome.php
File metadata and controls
115 lines (110 loc) · 3.5 KB
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
114
115
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Manager Details </title>
</head>
<body style="background-color:skyblue">
<hr />
<center> <h2> Manager Details </h2> </center>
<hr />
<center>
<form #action="registration.php" method = "post">
<br />
<table>
<tr>
<td><br />MID       </td>
<td><br /><input type="name" name="manageid" /><font color="RED" SIZE="2">*</font>            </td>
</tr>
<tr>
<td><br />Firstname       </td>
<td><br /><input type="name" name="fname" /><font color="RED" SIZE="2">*</font>            </td>
<td><br />Middlename       </td>
<td><br /><input type="name" name="mname" />            </td>
<td><br />Lastname       </td>
<td><br /><input type="name" name="lname" /> <font color="RED" SIZE="2">*</font></td>
</tr>
<tr>
<td> <br /> Date Of Birth       </td>
<td> <br /><input type="name" name="dob" /> <font color="RED" SIZE="2">*(yyyy-mm-dd)</font></td>
</tr>
<tr>
<td> <br /> Sex       </td>
<td> <br /> <input type="radio" name="male" value="Male"> Male</td>
<td> <br /> <input type="radio" name="female" value="Female"> Female</td>
</tr>
<tr>
<td> <br /> Store ID       </td>
<td> <br /><input type="name" name="ssid" /> <font color="RED" SIZE="2">*</font></td>
</tr>
<tr>
<td> <br />Username       </td>
<td> <br /><input type="name" name="username" /><font color="RED" SIZE="2">*</font> </td>
</tr>
<tr>
<td> <br />Password       </td>
<td> <br /><input type="password" name="passw" /><font color="RED" SIZE="2">*</font>       </td>
</tr>
</table>
<input type="submit" value="Register">
</form>
</center>
<?php
$sex = "N";
$con = mysql_connect("localhost","root","");
if(!$con)
{
die("Connection Failed");
}
if(!(mysql_select_db("medical_inventory", $con)))
{
die ("Database Not Selected");
}
if(isset($_POST['male']))
$sex = "M";
else if(isset($_POST['female']))
$sex = "F";
if ( isset ($_POST['ssid']))
{
$query = "SELECT * from store where SID=".$_POST['ssid'].";";
$sql = mysql_query($query,$con);
$row=mysql_fetch_array($sql);
if (!empty($row))
{
if (isset($_POST['manageid']) && isset($_POST['fname']) && isset($_POST['mname']) && isset($_POST['lname']) && isset($_POST['dob']))
$query = "INSERT INTO managed (MID,Fname,Mname,Lname,Sex,DOB,SSID) VALUES ('$_POST[manageid]','$_POST[fname]','$_POST[mname]','$_POST[lname]','$sex','$_POST[dob]','$_POST[ssid]')";
if (isset ($query))
$sql = mysql_query($query,$con);
if (isset ($sql))
if (!$sql)
{
echo "<br /> <font size='2' color='red'>*Required Fields are Mandotary</font>";
}
else
header ("Location:index.php");
mysql_close($con);
$con = mysql_connect("localhost","root","");
if(!$con)
{
die("Connection Failed");
}
if(!(mysql_select_db("medical_inventory", $con)))
{
die ("Database Not Selected");
}
if (isset($_POST['username']) && isset($_POST['passw']))
$query = "INSERT INTO login VALUES ('$_POST[username]','$_POST[passw]')";
if (isset ($query))
$sql = mysql_query($query,$con);
if (isset ($sql))
if (!$sql)
{
echo "<br /> <font size='2' color='red'>*Required Fields are Mandotary</font>";
}
}
else
echo "<script>alert('Store does not exist!');</script>";
}
?>
</body>
</html>