-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchuperustomreg.php
324 lines (282 loc) · 9.67 KB
/
chuperustomreg.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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Chuperustom</title>
<link rel="shortcut icon" type="image/x-icon" href="images/zephyr-logo.JPG"> <!-- icon shown on top of heading of admin page -->
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<!-- jQuery library -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
body {
margin: auto;
background: #eaeaea;
font-family: 'Open Sans', sans-serif;
}
form h1 {
font-size: 18px;
background: #F6AA93 none repeat scroll 0% 0%;
color: rgb(255, 255, 255);
padding: 22px 25px;
border-radius: 5px 5px 0px 0px;
margin: auto;
text-shadow: none;
text-align: left
}
form {
border-radius: 5px;
width: 100%;
margin: 5% auto;
background-color: #FFFFFF;
overflow: hidden;
}
p span {
color: #F00;
}
p {
margin: 0px;
font-weight: 500;
line-height: 2;
color: #333;
}
h1 {
text-align: center;
color: #666;
text-shadow: 1px 1px 0px #FFF;
margin: 50px 0px 0px 0px
}
input {
border-radius: 0px 5px 5px 0px;
border: 1px solid #eee;
margin-bottom: 15px;
width: 90%;
height: 40px;
float: left;
padding: 0px 15px;
}
.form-group {
overflow: inherit;
clear: both;
}
.icon-case {
width: 35px;
float: left;
border-radius: 5px 0px 0px 5px;
background: #eeeeee;
height: 42px;
position: relative;
text-align: center;
line-height: 40px;
}
i {
color: #555;
padding-top: 11px;
}
.contentform {
padding: 40px 30px;
}
.button-contact {
background-color: #81BDA4;
color: #FFF;
text-align: center;
width: 100%;
border: 0;
padding: 17px 25px;
border-radius: 0px 0px 5px 5px;
cursor: pointer;
margin-top: 40px;
font-size: 18px;
}
.button-contact2 {
background-color: rgb(231, 181, 14);
color: #FFF;
text-align: center;
width: 100%;
border: 0;
padding: 17px 25px;
border-radius: 0px 0px 5px 5px;
cursor: pointer;
margin-top: 40px;
font-size: 18px;
}
input[type=button]
{
background-color:#000080;
border: none;
color: white;
padding: 15px 20px;
text-align: center;
text-decoration: none;
display: inline-block;
text-transform: uppercase;
font-size: 13px;
-webkit-box-shadow: 0 10px 30px 0 rgba(95,186,233,0.4);
box-shadow: 0 10px 30px 0 rgba(95,186,233,0.4);
-webkit-border-radius: 5px 5px 5px 5px;
border-radius: 5px 5px 5px 5px;
margin: 5px 20px 40px 20px;
-webkit-transition: all 0.3s ease-in-out;
-moz-transition: all 0.3s ease-in-out;
-ms-transition: all 0.3s ease-in-out;
-o-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
}
input[type=button]:hover{
background-color: #000056;
}
</style>
</head>
<script>var c=1;</script>
<body>
<div class="row">
<div class="col-sm-1" style="float: left">
<input type="button" name="sub" class="fadeIn fourth" onclick="window.location.href='mainpage.php'" value="Home">
</div>
</div>
<h1>Registration form of CHUPE RUSTOM</h1>
<div class="container">
<form action="" method="POST">
<h1>Please enter the fields to register in CHUPE RUSTOM-Zephyr</h1>
<div class="contentform" id="parent">
<div class="form-group">
<p>Team Name: <span>*</span></p>
<span class="icon-case"><i class="fa fa-users"></i></span>
<input type="text" name="tname" id="usern" />
</div>
<div class="form-group">
<p>Enter credentials for team leader<br>User Id: <span>*</span></p>
<span class="icon-case"><i class="fa fa-user"></i></span>
<input type="text" name="user[0][userid]" id="usern" />
</div>
<div class="form-group">
<p>Password <span>*</span></p>
<span class="icon-case"><i class="fa fa-lock"></i></span>
<input type="password" name="user[0][password]" id="password" />
</div>
<div class="kid abc">
<div class="form-group">
<p>Enter credentials for team member<p id="d"></p><br>User Id: <span>*</span></p>
<span class="icon-case"><i class="fa fa-user"></i></span>
<input type="text" name="user[1][userid]" id="user" />
</div>
<div class="form-group">
<p>Password <span>*</span></p>
<span class="icon-case"><i class="fa fa-lock"></i></span>
<input type="password" name="user[1][password]" id="password" />
</div>
</div>
</div>
<button id="btn" type="button" class="button-contact2">ADD more members</button>
<button type="submit" class="button-contact" name="sub">Submit</button>
</form>
</div>
<script src="jquerylib.js" type="text/javascript"></script>
<!-- for giving the option of add members -->
<script>
var c=1;
//document.getElementById("demo").innerHTML = c;
//$(document).ready(function(){
$("#btn").click(function(){
//alert();
//$(".clone").append("<p>Test</p>");
//var c=1;
if(c<=8){
let row=$('.kid').clone().removeClass("kid")//.appendTo('#parent');
let name=row.find("#user").prop("name");
name=name.replace("1",$(".abc").length+1);
row.find("#user").prop("name",name);
let namep=row.find("#password").prop("name");
namep=namep.replace("1",$(".abc").length+1);
row.find("#password").prop("name",namep);
//alert($(".abc").length);
row.find("#user").prop("value","");
row.find("#password").prop("value","");
row.appendTo("#parent");
c=c+1;
} //var c=c+1;)
});
//}
</script>
<?php
include "linc.php";
if (isset($_POST["sub"])){
//getting team name
$t_id=mysqli_real_escape_string($mysqli,$_POST["tname"]);
$q="select * from t_participation where t_id='$t_id' ;";
$r=mysqli_query($mysqli,$q);
//checking for same team name
if(mysqli_num_rows($r)==0)
{
$tright=1;
}
else
{
$tright=0;
}
//echo $tright;
$user=$_POST["user"];
// print_r($_POST["user"]);
$i=count($_POST["user"]);
$j=0;
$mright=0;
//checking for invalid id and password
foreach($user as $u)
{
$p_id=mysqli_real_escape_string($mysqli,$u['userid']);
$pw=mysqli_real_escape_string($mysqli,$u['password']);
$t_id=mysqli_real_escape_string($mysqli,$_POST["tname"]);
$query="select * from participants where p_id='$p_id' and password='$pw'";
$result=mysqli_query($mysqli,$query);
if(mysqli_num_rows($result)==1)
{
$mright=$mright+1;
}
else
{
$mright=$mright+0;
}
}
//echo $mright;
//checking for neccessary conditions of insertion
if($tright==1)
{
if($mright==$i)
{
foreach ($user as $u)
{
$p_id=mysqli_real_escape_string($mysqli,$u['userid']);
// $pw=mysqli_real_escape_string($mysqli,$u['password']);
$t_id=mysqli_real_escape_string($mysqli,$_POST["tname"]);
$query2="insert into t_participation (t_id,p_id,e_id) values('$t_id','$p_id',9);";
if (!mysqli_query($mysqli,$query2))
{
echo "query error:".mysqli_error($mysqli);
die();
}
else
{
$j=$j+1;
};
}
if($j==$i)
{
echo "<script>alert('Succesfully registered your team in Chuperustom')</script>";
}
}
else
{
echo "<script>alert('Check you partcipant ids and password, some of them are wrong')</script>";
};
}
else
{
echo "<script>alert('This team name has already registered,Kindly change your team name')</script>";
};
}
?>
</body>
</html>