-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwork.php
106 lines (71 loc) · 1.88 KB
/
work.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
<!DOCTYPE html>
<html>
<body>
<?php
session_start();
$user = $_SESSION["user"];
$company1 = $_POST["company1"];
$company2 = $_POST["company2"];
$company3 = $_POST["company3"];
$year1 = $_POST["year1"];
$year2 = $_POST["year2"];
$year3 = $_POST["year3"];
$i=0;
$conn = mysqli_connect("localhost:3308","root","","project3-2");
$check="select user from work where user='$user'";
$checkans=mysqli_query($conn,$check);
$chck=mysqli_fetch_array($checkans);
if(is_null($chck[0]))
{
if(isset($_POST["company1"])&& isset($_POST["year1"]))
{
$que1 = "insert into work values ('$user','$company1','$year1')";
$ans1 = mysqli_query($conn,$que1);
$i++;
}
if(isset($_POST["company2"])&& isset($_POST["year2"]))
{
$que2 = "insert into work values ('$user','$company2','$year2')";
$ans2 = mysqli_query($conn,$que2);
$i++;
}
if(isset($_POST["company3"])&& isset($_POST["year3"]))
{
$que3 = "insert into work values ('$user','$company3','$year3')";
$ans3 = mysqli_query($conn,$que3);
$i++;
}
if($i>0)
{
header("location:hobbies.html");
}}
else{
$del="delete from work where user='$user'";
$dele=mysqli_query($conn,$check);
if(isset($_POST["company1"])&& isset($_POST["year1"]))
{
$que1 = "insert into work values ('$user','$company1','$year1')";
$ans1 = mysqli_query($conn,$que1);
$i++;
}
if(isset($_POST["company2"])&& isset($_POST["year2"]))
{
$que2 = "insert into work values ('$user','$company2','$year2')";
$ans2 = mysqli_query($conn,$que2);
$i++;
}
if(isset($_POST["company3"])&& isset($_POST["year3"]))
{
$que3 = "insert into work values ('$user','$company3','$year3')";
$ans3 = mysqli_query($conn,$que3);
$i++;
}
if($i>0)
{
header("location:hobbies.html");
}
}
$conn->close();
?>
</body>
</html>