-
Notifications
You must be signed in to change notification settings - Fork 0
/
referral.php
143 lines (131 loc) · 5.23 KB
/
referral.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Alumni Referral Portal</title>
<!-- Styles -->
<link href="https://fonts.googleapis.com/css?family=Raleway:400,400i,600,700,700i&subset=latin-ext" rel="stylesheet">
<link href="css/bootstrap.css" rel="stylesheet">
<link href="css/fontawesome-all.css" rel="stylesheet">
<link href="css/swiper.css" rel="stylesheet">
<link href="css/magnific-popup.css" rel="stylesheet">
<link href="css/styles.css" rel="stylesheet">
<link href="css/referral.css" rel="stylesheet">
<link rel="icon" href="images/logo.png">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<link href="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$('.search input[type="text"]').on("keyup input", function(){
/* Get input value on change */
var inputVal = $(this).val();
var resultDropdown = $(this).siblings(".result");
if(inputVal.length){
$.get("backend-search.php", {term: inputVal}).done(function(data){
// Display the returned data in browser
resultDropdown.html(data);
});
} else{
resultDropdown.empty();
}
});
// Set search input value on click of result item
$(document).on("click", ".result p", function(){
$(this).parents(".search").find('input[type="text"]').val($(this).text());
$(this).parent(".result").empty();
});
});
</script>
</head>
<body>
<?php
// Initialize the session
error_reporting(E_ALL);
ini_set("display_errors", 1);
include('config.php');
session_start();
$session_id = $_SESSION["id"];
// Check if the user is logged in, if not then redirect him to login page
if(!isset($_SESSION["loggedin"]) || $_SESSION["loggedin"] !== true){
header("location: login.php");
exit;
}
?>
<!-- Navigation -->
<nav class="navbar navbar-expand-lg navbar-dark navbar-custom fixed-top">
<a class="navbar-brand logo-image" href="index.php"><img src="images/logo.png" alt="alternative"></a>
<!-- Mobile Menu Toggle Button -->
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-awesome fas fa-bars"></span>
<span class="navbar-toggler-awesome fas fa-times"></span>
</button>
<!-- end of mobile menu toggle button -->
<div class="collapse navbar-collapse" id="navbarsExampleDefault">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link page-scroll" href="userHome.php">Dashboard</a>
</li>
</ul>
<?php
$sql = "SELECT * FROM Users where user_id= $session_id";
$result = mysqli_query($mysqli, $sql);
?>
<?php
while ($rows = mysqli_fetch_array($result)) {
?>
<div class="dropdown">
<a href= "#"> <img src="user_images/<?php echo $rows['image']; ?>" alt="" class="dropbtn"/> <img src="images/down-arrow.png"/></a>
<div class="dropdown-content">
<a href="profile.php">Edit Profile</a>
<a href="reset-password.php">Reset Password</a>
<a href="logout.php">Sign Out</a>
</div>
</div>
</div>
<?php
}
?>
</div>
</nav>
<div class= "login-card">
<h4 style= "text-align:center; color: #cf1d52;"><b>Alumni Referral Portal</b></h4>
<div class="wrap">
<div class="search">
<form method="POST" action= "#">
<input type="text" autocomplete="off" placeholder="Search Company..." name= "company" class= "searchTerm">
<button type= "submit" name="submit" class= "searchButton"><i class="fa fa-search"></i></button>
<div class="result"></div></form>
</div>
</div>
<?php
if (isset($_POST['submit'])) {
$company = $_POST['company'];
//the form has been posted, so save it
$sql = "SELECT * FROM Referral WHERE company= '$company'";
$result = mysqli_query($mysqli,$sql) or die(mysqli_error($mysqli));
if(!$result)
{
//something went wrong, display the error
echo 'Error' . mysqli_error($mysqli);
}
else if(mysqli_num_rows($result) > 0){
// Fetch result rows as an associative array
while($row = mysqli_fetch_array($result)){
echo "<br><br><p>" . $row["name"] . "</p>";
echo "<p>" . $row["company"] . "</p>";
echo "<p>" . $row["position"] . "</p>";
echo "<p>" . $row["location"] . "</p>";
echo "<p>" . $row["email"] . "</p>";
echo "<p>" . $row["linkedin_url"] . "</p>"; }
}
else{
echo "<p class= 'match' style= 'color: #28caeb; text-align: center; margin-top: 40px; font-size: 30px;'>No matches found!</p>";
}
}
?>
</div>
</body>
</html>