-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconnect.php
44 lines (37 loc) · 1.03 KB
/
connect.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
<?php
session_start();
//This is the DB connection for my local server.
$conn = mysqli_connect('localhost', 'wissy47', 'qwerty123Q', 'handwork');
if (!$conn) {
echo 'Connection Error: ' . mysqli_connect_error();
}
function queryResult($email)
{
global $conn;
$query = "SELECT * FROM users WHERE user_email = '$email'";
$result = mysqli_query($conn, $query);
return $result;
}
function queryResult_for_artisans($email)
{
global $conn;
$query = "SELECT * FROM artisans WHERE user_email = '$email'";
$result = mysqli_query($conn, $query);
return $result;
}
function queryResult_for_artisan($adminEmail)
{
global $conn;
$query = "SELECT * FROM artisans WHERE created_by = '$adminEmail'";
$results = mysqli_query($conn, $query);
$result = mysqli_fetch_all($results, MYSQLI_ASSOC);
mysqli_free_result($results);
mysqli_close($conn);
return $result;
}
if(isset($_GET['functions'])){
if($_GET['functions'] == "logout"){
session_destroy();
header('location: index.php');
}
}