-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin_company_approval.php
148 lines (124 loc) · 4.19 KB
/
admin_company_approval.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
<?php
session_start();
if(!isset($_SESSION['user']))
{
header("Location: vit.php");
}
if($_SESSION['user']=='student_int' )
{
header("Location: index_student_intern.php");
}
if($_SESSION['user']=='student_place' )
{
header("Location: index_student_placement.php");
}
if($_SESSION['user']=='company')
{
header("Location: index_company.php");
}
?>
<?php
$company_id="";
$company_name="";
$company_type="";
$website="";
$address2="";
$coming_date="";
$errors = array();
$positives=array();
$db = mysqli_connect('localhost', 'root', '', 'placement');
if (isset($_POST['approve_company']))
{
// receive all input values from the form
$company_name = mysqli_real_escape_string($db, $_POST['company_name']);
if ($company_name=='Company Name')
{
array_push($errors, "Select company or No company with Pending Approval");
}
// Finally, register user if there are no errors in the form
if (count($errors) == 0)
{
$query = "update company set APPROVAL='approved' where COMPANY_NAME='$company_name'";
mysqli_query($db, $query);
//if we want to empty all the entered details then again initialize all the$variable_name to "";
array_push($positives, "Successfully approved the company");
//header('location: index_company.php');
}
}
if (isset($_POST['disapprove_company'])) //??????????????//
{
// receive all input values from the form
$company_name = mysqli_real_escape_string($db, $_POST['company_name']);
if ($company_name=='Company Name')
{
array_push($errors, "Select company or No company to reject");
}
// Finally, register user if there are no errors in the form
if (count($errors) == 0)
{
$query = "update company set APPROVAL='rejected' where COMPANY_NAME='$company_name'";
mysqli_query($db, $query);
$query = "delete from companybranch where COMPANY_NAME='$company_name'";
mysqli_query($db, $query);
array_push($positives, "Successfully rejected the company");
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Admin Change Status of Company</title>
<link rel="stylesheet" type="text/css" href="1.css">
<link rel="shortcut icon" type="image/png" href="vit.png">
<link rel="stylesheet" type="text/css" href="stl.css">
</head>
<body>
<div class="list-unstyled3" >
<ul>
<li><a href="vit.php"><img src="vit.png" alt="VIT Pune" class="logo2" height="40" align="left"/></a></li>
<li style="float:right"><a href="logout.php" title="<?php echo $_SESSION['student_name']; ?> ">Log Out</a></li>
<div class="para">
<p> Training & Placement,VIT Pune</p>
</div>
</ul>
</div>
<div class="header">
<h2>Company Approval</h2>
</div>
<!--/*The PHP superglobals $_GET and $_POST are used to collect form-data.-->
<form method="post" action="admin_company_approval.php">
<?php include('wrong.php'); ?>
<?php include('positive.php'); ?>
<div class="input-group">
<label>Companies Visiting</label>
<!-- <input type="text" name="gender" value="<?php echo $gender; ?>"> -->
<select name="company_name" >
<option>Company Name</option>
<?php
$db1 = mysqli_connect('localhost', 'root', '', 'placement');
$user_check_query1 = " SELECT COMPANY_NAME FROM company where STATUS='visiting' and APPROVAL='not approved' and APPROVAL<>'rejected'";
$result1 = mysqli_query($db1, $user_check_query1);
//The mysqli_fetch_assoc() function fetches a result row as an associative array.
// $count=mysql_num_rows($result);
while($count=mysqli_fetch_array($result1))
{
// $user = mysqli_fetch_assoc($result);
// $ans=$user['COMPANY_NAME'] ;
// $count--;
?>
<option> <?php echo $count["COMPANY_NAME"]; ?> </option>
<?php
}
?>
</select>
</div>
<div class="input-group">
<button type="submit" class="btn" name="approve_company">Approve</button>
<button type="submit" class="btn" name="disapprove_company">Reject</button>
</div>
<p>
Approved the company? <a href="index_admin.php">Go Back</a>
</p>
</form>
</body>
</html>