-
Notifications
You must be signed in to change notification settings - Fork 0
/
addtags.php
46 lines (45 loc) · 1.23 KB
/
addtags.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
45
46
<?php
ob_start();
session_start();
require_once('connectvars.php');
$dbc = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);
if (isset($_POST['tags']) && $_POST['tags']!='' && isset($_SESSION['userid']) && isset($_POST['photoid']))
{
$photoid = mysqli_real_escape_string($dbc, strip_tags($_POST['photoid']));
$tags = mysqli_real_escape_string($dbc, strip_tags($_POST['tags']));
$myid=$_SESSION['userid'];
$query = "SELECT * FROM files WHERE shareid='$myid'";
$data = mysqli_query($dbc, $query);
$myname = $_SESSION['usernaam'];
if (mysqli_num_rows($data)!=0)
{
while ($row=mysqli_fetch_array($data))
{
if ($row['id']=$photoid)
{
$q2 = "INSERT INTO tags VALUES (0, '$myid', '$photoid', '$tags')";
mysqli_query($dbc, $q2);
echo '<br /><big>'.$tags.'</big><br /><small>Tags Added</small>';
break;
}
}
}
else {
$query = "SELECT * FROM sharedfiles WHERE shareid='$myid'";
$data = mysqli_query($dbc, $query);
$myname = $_SESSION['usernaam'];
if (mysqli_num_rows($data)!=0)
{
while ($row=mysqli_fetch_array($data))
{
if ($row['fileid']=$photoid)
{
$q2 = "INSERT INTO tags VALUES (0, '$myid', '$photoid', '$tags')";
mysqli_query($dbc, $q2);
echo '<br /><big>'.$tags.'</big><br /><small>Tags Added</small>';
break;
}
}
}
}
?>