-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrequestedLab.php
More file actions
38 lines (25 loc) · 835 Bytes
/
Copy pathrequestedLab.php
File metadata and controls
38 lines (25 loc) · 835 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
36
37
38
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
session_start();
include("credentials.php");
$code = '';
//Query lab
try {
$dsn = 'mysql:dbname='.$db_database.';host='.$db_host;
$pdo = new PDO($dsn,$db_username,$db_password);
$pdo->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
$stmt = $pdo->prepare("SELECT * FROM Requests WHERE Generated_by = :generated_by;");
$stmt->bindParam(':generated_by', $_SESSION['username']);
$stmt->execute();
$rows = $stmt->fetchAll();
foreach ($rows as $row) {
if ($row['State'] == 'Waiting' || $row['State'] == 'Suspended'){
$code = $row['Made_In'];
}
}
echo $code;
} catch (Exception $exception){
echo "<script type='text/javascript'> alert('Error when query lab!') </script>";
exit(0);
}