-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathusertags.php
More file actions
95 lines (84 loc) · 2.66 KB
/
usertags.php
File metadata and controls
95 lines (84 loc) · 2.66 KB
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
<?php
include( "sessionRedirector.php" );
include( "queryFunctions.php" );
$userid = $_SESSION[ "userid" ];
if ( isset( $_POST[ "add" ] ) ) {
if ( checkUserTagExist( $userid, $_POST[ "formtags" ] ) ) {
header( "Location: usertags.php?status=TagsAlreadyExist" );
} else {
if ( addTagToUser( $userid, $_POST[ "formtags" ] ) ) {
header( "Location: usertags.php?status=TagUpdated" );
} else {
header( "Location: usertags.php?status=somethingWentWrong" );
}
}
}
if ( isset( $_POST[ "remove" ] ) ) {
if ( !checkUserTagExist( $userid, $_POST[ "formtags" ] ) ) {
header( "Location: usertags.php?status=TagsDoesNotExist" );
} else {
if ( removeTagFromUser( $userid, $_POST[ "formtags" ] ) ) {
header( "Location: usertags.php?status=TagRemoved" );
} else {
header( "Location: usertags.php?status=somethingWentWrong" );
}
}
}
?>
<?php include( "userDashboardHeader.php" ); ?>
<div class="breadcrumbs">
<div class="col-sm-4">
<div class="page-header float-left">
<div class="page-title">
<h1>
<?php
if (isset($_GET["status"])) {
//var_dump($_GET);
echo $_GET["status"];
}
?>
</h1>
</div>
</div>
</div>
<div class="col-sm-8">
<div class="page-header float-right">
<div class="page-title">
<ol class="breadcrumb text-right">
<li class="active"></li>
</ol>
</div>
</div>
</div>
</div>
<div class="content mt-3">
<div class="col-lg-12">
<div class="card">
<div class="card-header"><strong>User Tags</strong>
</div>
<div class="card-body card-block">
<form method="post" action="usertags.php">
<div class="form-group">
<label for="vat" class=" form-control-label">Current Tags</label>
<input type="text" id="vat" value='<?php echo implode(", ", getCurrentUserTags($userid)); ?>' class="form-control col-lg-12" readonly>
<br>
<label for="vat" class=" form-control-label">Add User Interest Tags</label>
<select name="formtags" id="activities" class="form-control">
<?php
global $connection;
$query = "SELECT * FROM tags ORDER BY tagname";
$results = mysqli_query( $connection, $query );
while ( $row = mysqli_fetch_assoc( $results ) ) {
echo( "<option value = '" . $row[ "tagid" ] . "' >" . $row[ "tagname" ] . "</option>" );
}
?>
</select> <br>
<button id="payment-button" type="submit" name="add" class="btn btn-lg btn-info col-lg-2"> Add</button>
<button id="payment-button" type="submit" name="remove" class="btn btn-lg btn-info col-lg-2">Remove</button>
</div>
</form>
</div>
</div>
<!-- .content -->
</div>
<?php include( "userDashboardFooter.php" ); ?>