-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtutor_activation.php
More file actions
35 lines (30 loc) · 897 Bytes
/
tutor_activation.php
File metadata and controls
35 lines (30 loc) · 897 Bytes
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
<?php
require_once 'scripts/app_config.php';
require_once 'scripts/database.php';
$accept = 'Accept';
$decline = 'Decline';
$url = "http///$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$tutor_id = substr($url, -2);
if(isset($_POST['accept'])){
$sql = "UPDATE tblTutors SET allowed = ? WHERE tutor_id = ?;";
$stmt = mysqli_stmt_init($con);
if(!mysqli_stmt_prepare($stmt, $sql)){
echo "prepare for accept no work";
} else{
mysqli_stmt_bind_param($stmt, "si", $accept, $tutor_id);
mysqli_stmt_execute($stmt);
header("Location: admin");
}
}
if(isset($_POST['decline'])){
$sql = "DELETE FROM tblTutors WHERE tutor_id = ?;";
$stmt = mysqli_stmt_init($con);
if(!mysqli_stmt_prepare($stmt, $sql)){
echo "prepare for accept no work";
} else{
mysqli_stmt_bind_param($stmt, "i", $tutor_id);
mysqli_stmt_execute($stmt);
header("Location: admin");
}
}
?>