-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathselect2.php
More file actions
68 lines (61 loc) · 2.38 KB
/
select2.php
File metadata and controls
68 lines (61 loc) · 2.38 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
<?php
$link = mysqli_connect("localhost", "root", "", "tap");
// Check connection
if($link === false){
die("ERROR: Could not connect. " . mysqli_connect_error());
}
// Escape user inputs for security
$interests = mysqli_real_escape_string($link, $_REQUEST['interests']);
$why = mysqli_real_escape_string($link, $_REQUEST['why']);
$club = mysqli_real_escape_string($link, $_REQUEST['club']);
$school = mysqli_real_escape_string($link, $_REQUEST['school']);
// $_COOKIE[$name] = mysqli_real_escape_string($link, $_REQUEST['name']);
// $_COOKIE[$email] = mysqli_real_escape_string($link, $_REQUEST['email']);
// $_COOKIE[$phone] = mysqli_real_escape_string($link, $_REQUEST['phone']);
// $_COOKIE[$city] = mysqli_real_escape_string($link, $_REQUEST['city']);
$name = $_COOKIE['name'];
$email = $_COOKIE['email'];
$phone = $_COOKIE['phone'];
$city = $_COOKIE['city'];
if($city == "mumbai" or $city == "pune"){
$sql = "INSERT INTO applicants (sr, name, email, phone, city, club, school, interests, why) VALUES ('', '$name', '$email', '$phone', '$city', '$club', '$school', '$interests', '$why')";
if(mysqli_query($link, $sql)){
echo "<script type='text/javascript'>
if (confirm('application registered!')) {
window.location = 'index.html';
}
else {
window.location = 'index.html';
}
</script>";
} else{
echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
} else{
echo "<script type='text/javascript'>
if (confirm('Not Available in your region but thank you for your support.')) {
window.location = 'index.html';
}
else {
window.location = 'index.html';
}
</script>";
}
// {
// echo 'inside if';
// echo '<script type="text/javascript">';
// echo ' alert("not eligible")';
// echo '</script>';
// header("Location:index.html");
// // }
// // else {
// $sql = "INSERT INTO applicants (sr, name, email, phone, city, club, school, interests, why) VALUES ('', '$name', '$email', '$phone', '$city', '$club', '$school', '$interests', '$why')";
// if(mysqli_query($link, $sql)){
// echo "Records added successfully.";
// header("Location:index.html");
// } else{
// echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
// }
// }
mysqli_close($link);
?>