-
Notifications
You must be signed in to change notification settings - Fork 8
/
cl_exec.php
42 lines (39 loc) · 1.13 KB
/
cl_exec.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
<?php
// This page handles Validate, Ignore and Migrate requests.
require_once("config.php");
session_start();
if (isset($_SESSION["type"])) {
if ($_SESSION["type"] != 'CL') {
exit("Please go back and try again!");
}
} else {
header("Location: $start_page");
exit();
}
if (isset($_GET['id']) && isset($_GET['do'])) {
$id = $_GET['id'];
$do = $_GET['do'];
if (isset($_GET['dest']))
$dest = $_GET['dest'];
} else
exit("Invalid request!");
$mysqli = new mysqli($host,$db_user,$db_password,$db_name);
if ($mysqli->connect_errno)
die("Connect failed: ".$mysqli->connect_error);
if ($do == 'ign') // Ignore request
$query="UPDATE colleges SET validated=-1 WHERE id='$id'";
else if ($do == 'val') // Validate request
$query="UPDATE colleges SET validated=1 WHERE id='$id'";
else if ($do == 'mig' && $dest) // Migrate request
$query="UPDATE student_reg SET clg_id='$dest' WHERE clg_id='$id'";
else
echo "Invalid request!!!";
if ($query) {
if ($mysqli->query($query))
echo "Success! ".$mysqli->affected_rows." rows affected!";
else
echo "Failed! ".$mysqli->error;
}
echo " <a href='cl.php'>Go back!</a>";
$mysqli->close();
?>