-
Notifications
You must be signed in to change notification settings - Fork 0
/
connect-agent.php
161 lines (120 loc) · 4.78 KB
/
connect-agent.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
<?php
session_start();
if(!isset($_SESSION['id'])){
header("location: login.php");
}
require "database/connection.php";
if(isset($_SESSION['id'])){
$id = $_SESSION['id'];
}
if(isset($_GET['id'])){
$friend_id = $_GET['id'];
}
$sql1 = "SELECT * FROM users WHERE user_id=?";
$stmt1 = $conn->prepare($sql1);
$stmt1->bind_param('s', $friend_id);
if($stmt1->execute()){
$result1 = $stmt1->get_result();
if($result1->num_rows > 0){
$rows1 = $result1->fetch_assoc();
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1.0" name="viewport">
<title>Easy Learn</title>
<meta content="" name="description">
<meta content="" name="keywords">
<!-- Favicons -->
<link href="assets/img/easylearn/logo2.jpg" rel="icon">
<link href="assets/img/easylearn/logo2.jpg" rel="apple-touch-icon">
<!-- Google Fonts -->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,600;1,700&family=Poppins:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700&family=Inter:ital,wght@0,300;0,400;0,500;0,600;0,700;1,300;1,400;1,500;1,600;1,700&display=swap" rel="stylesheet">
<!-- Vendor CSS Files -->
<link href="assets/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<link href="assets/vendor/bootstrap-icons/bootstrap-icons.css" rel="stylesheet">
<link href="assets/vendor/fontawesome-free/css/all.min.css" rel="stylesheet">
<link href="assets/vendor/glightbox/css/glightbox.min.css" rel="stylesheet">
<link href="assets/vendor/swiper/swiper-bundle.min.css" rel="stylesheet">
<link href="assets/vendor/aos/aos.css" rel="stylesheet">
<!-- Template Main CSS File -->
<link href="assets/css/main.css" rel="stylesheet">
</head>
<body>
<main id="main">
<section id="pricing" class="pricing pt-0">
<div class="container" data-aos="fade-up">
<div class="section-header mt-2">
<a href="javascript:history.back();" style="font-size: 1.4rem; margin-right: 4rem; color: rgba(0,0,0,1);"><i class="bi bi-arrow-left" style="margin-right: 4rem;"></i> Hostel Finder</a>
</div>
<div class="fetch-room-mate">
<div class="row gy-4">
<div class="col-lg-4" data-aos="fade-up" data-aos-delay="100">
<div class="pricing-item">
<img src="uploads/<?= $rows1['image']; ?>" style="max-width: 100%; margin-bottom: 1rem;" alt="">
<h3>Are you sure you want to connect with <span class="text-primary"><?= $rows1['lastname']; ?></span></h3>
<form id="connect_form">
<input type="hidden" id="friend_id" value="<?= $friend_id; ?>">
<input type="hidden" id="user_id" value="<?= $id; ?>">
<a id="connect_btn" class="buy-btn" style="cursor: pointer;">Yes</a>
</form>
</div>
</div><!-- End Pricing Item -->
</div>
</div>
</div>
</section><!-- End Pricing Section -->
</main>
<footer id="footer" class="footer">
</footer><!-- End Footer -->
<!-- End Footer -->
<a href="#" class="scroll-top d-flex align-items-center justify-content-center"><i class="bi bi-arrow-up-short"></i></a>
<div id="preloader"></div>
<!-- Vendor JS Files -->
<script src="assets/vendor/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="assets/vendor/purecounter/purecounter_vanilla.js"></script>
<script src="assets/vendor/glightbox/js/glightbox.min.js"></script>
<script src="assets/vendor/swiper/swiper-bundle.min.js"></script>
<script src="assets/vendor/aos/aos.js"></script>
<script src="assets/vendor/php-email-form/validate.js"></script>
<!-- Template Main JS File -->
<script src="js/jquery2.js"></script>
<script src="assets/js/main.js"></script>
<script src="./assets/js/sweetalert.js"></script>
</body>
</html>
<script>
$(document).ready(function(){
$(document).on('click', '#connect_btn', function(e){
e.preventDefault();
var friend_id = $('#friend_id').val();
var user_id = $('#user_id').val();
$.ajax({
url: 'backend/insert-connect.php',
type: 'post',
data:
{
friend_id: friend_id,
user_id:user_id
},
success: function(data){
if(data == "yes"){
Swal.fire(
'',
'Already Friends',
'error'
)
} else {
location.href = 'messages.php';
}
}
});
$('#connect_form')[0].reset();
});
});
</script>