-
Notifications
You must be signed in to change notification settings - Fork 0
/
folders.php
35 lines (30 loc) · 1.11 KB
/
folders.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
<?php
include 'common.php';
if($_SESSION['is_logged']===true){
if(isset($_POST['fs'])){
if($_POST['fs']==1){
$new_name=addslashes(trim($_POST['new_folder_name']));
if(strlen($new_name)>1){
$rs = run_q('SELECT COUNT(*) as cnt FROM user_catalogues
WHERE user_id='.$_SESSION['user_id'].' AND name="'.$new_name.'"');
$row = mysql_fetch_assoc($rs);
if($row['cnt']==0){
run_q('INSERT INTO user_catalogues (user_id,name) VALUES ('.$_SESSION['user_id'].',"'.$new_name.'")');
}else{
$error[]='The name already exists';
}
} else {
$error[]='Please enter a name!';
}
}
}
$folders = fetch_all(run_q('SELECT * FROM user_catalogues WHERE user_id='.$_SESSION['user_id']));
$cssFile = 'user_folders1.css';
$pageTitle = 'My Folders';
include 'templates/header.php';
include 'templates/user_folders.php';
include 'templates/footer.php';
} else {
header('Location: index.php');
exit;
}