-
Notifications
You must be signed in to change notification settings - Fork 0
/
insert.php
172 lines (121 loc) · 3.26 KB
/
insert.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<title>
Posted!
</title>
</head>
<body>
<?php
$conn=mysqli_connect('localhost','root','',) or die(mysqli_error($conn));
$select_db=mysqli_select_db($conn,'freelance') or die(mysqli_error($conn));
$total="SELECT MAX(project_id) FROM project_details;";
$result=mysqli_query($conn,$total) or die(mysqli_error($conn));
//if(!mysqli_num_rows($result)) $total=1;
$trend_rate; //Numbers from 1-7 assigned to each project based on the cost (highest cost has 7 rating and lowest has rating 1)
if($result==true)
{
//echo "Successfully connectted!";
$rows=mysqli_fetch_assoc($result);
$total=$rows['MAX(project_id)'];
}
else echo "failed!";
if(isset($_POST['name']))
$name=$_POST['name'];
if(isset($_POST['project_name']))
$project_name=$_POST['project_name'];
if(isset($_POST['about']))
$description=$_POST['about'];
if(isset($_POST['price_range']))
$rate=$_POST['price_range'];
/* JOB TITLE ASSIGNMENT */
$fullstack=0;
$backend=0;
$frontend=0;
$admin=0;
//Checking if frontend skills are required -html,css,javascript,bootstrap and angular or react JS
if((!empty( $_POST['html']))||(!empty($_POST['css']))||(!empty($_POST['bootstrap']))||(!empty($_POST['javascript']))||
(!empty ($_POST['angularorreact'])))
{
$frontend=1 ;
}
if((!empty( $_POST['php']))||(!empty($_POST['mysql']))||(!empty($_POST['nodejs']))||(!empty($_POST['expressjs']))||
(!empty ($_POST['mongodb'])))
{
$backend=1 ;
}
//checking if back-end skills are required-php,nodejs,mysql,mongodb,expressJS
//checking if full stack skills are required
if($frontend==1&&$backend==1)
{
$fullstack=1;
}
//check if database admin is needed
if(!empty($_POST['admin']))
{
$admin=1;
}
if($admin==1)
{
$job_type="Database Admin";
}
elseif($fullstack==1)
$job_type="Fullstack Developer";
elseif($backend==1)
$job_type="Back-end Developer";
else $job_type="Front-end Developer";
/* PRICE BRACKET OF PROJECT */
if($rate=='major')
{
$price_range=">₹10000000";
$trend_rate=7;
}
elseif($rate=='verylarge')
{
$price_range="₹5000000-₹10000000";
$trend_rate=6;
}
elseif($rate=='larger')
{
$price_range="₹100000-₹5000000";
$trend_rate=5;
}
elseif($rate=='medium')
{
$price_range="₹50000-₹100000";
$trend_rate=4;
}
elseif($rate=='small')
{
$price_range="₹20000-₹50000";
$trend_rate=3;
}
elseif($rate=='simple')
{
$price_range="₹5000-₹20000";
$trend_rate=2;
}
else
{
$price_range="₹600-₹5000";
$trend_rate=1;
}
$total=$total+1;
$sql="INSERT into project_details VALUES ('$total','$name','$project_name','$description','$job_type','$price_range',-1,'','$trend_rate');";
$result=mysqli_query($conn,$sql) or die(mysqli_error($conn));
if($result==true)
{
?>
<div class="alert alert-success">
<strong><h1 align="center"> SUCCESSFULLY POSTED YOUR PROJECT !!! </h1></strong>
</div>
<?php
//echo "Successfully posted your project!";
}
?>
</body>
</html>