-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlikecat.php
More file actions
27 lines (27 loc) · 1.11 KB
/
Copy pathlikecat.php
File metadata and controls
27 lines (27 loc) · 1.11 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
<?php
session_start();
$conn = new mysqli('localhost', 'People', '123456', 'main');
if ($conn->connect_error) die($conn->connect_error);
$emailfor = str_replace('.', '', $_SESSION['email']);
$emailfor = str_replace('@', '', $emailfor);
$_GET['cat'] = strip_tags($_GET['cat']);
$_GET['cat'] = addslashes($_GET['cat']);
$query = "SELECT * from category WHERE login='".$_SESSION['login']."' AND category='".$_GET['cat']."'";
$result = $conn->query($query);
$rows = $result->num_rows;
if($rows == 1) {
$query = "DELETE from category WHERE login='".$_SESSION['login']."' AND category='".$_GET['cat']."'";
$result = $conn->query($query);
}
elseif($rows == 0) {
$query = "INSERT into category(login,category) VALUES('".$_SESSION['login']."','".$_GET['cat']."')";
$result = $conn->query($query);
}
$query = "SELECT * from category WHERE login='".$_SESSION['login']."'";
$result = $conn->query($query);
$rows = $result->num_rows;
if($rows>2) {
print('true');
}
if (!$result) die ($conn->error);
?>