Example #1
0
<?php

require "../config/connect.php";
require "../engine/func_remdir.php";
require "../engine/logger.php";
$userid = $_POST['userid'];
//Delete User's Directories and Files
rem_dir("../data/" . $userid . "/");
//Delete User's Files's and User's Data
mysql_query("delete from files where userid='" . $userid . "'");
mysql_query("delete from directories where userid='" . $userid . "'");
mysql_query("delete from users where userid='" . $userid . "'");
makelogger("Remusr", $userid, "", "", "");
Example #2
0
            if ($file == '.' || $file == '..') {
                continue;
            }
            // Rekursiv, If dir: FlxZipArchive::addDir(), else ::File();
            $do = filetype($location . $file) == 'dir' ? 'addDir' : 'addFile';
            $this->{$do}($location . $file, $name . $file);
        }
    }
}
//-----------------Class------------------//
//------------------Edit------------------//
require "../config/connect.php";
require "../engine/logger.php";
$uid = $_POST['uid'];
$did = $_POST['did'];
$seldir = mysql_query("select dirname,dirpath from directories where dirid='" . $did . "'");
$fetdir = mysql_fetch_array($seldir);
$path = "../data/" . $uid . "/files" . $fetdir['dirpath'] . $fetdir['dirname'];
$zip_name = "../data/" . $uid . "/zip/" . $fetdir['dirname'] . ".zip";
$zip = new FlxZipArchive();
$res = $zip->open($zip_name, ZipArchive::CREATE);
if ($res === TRUE) {
    $zip->addDir($path, basename($path));
    $zip->close();
    echo "data/" . $uid . "/zip/" . $fetdir['dirname'] . ".zip";
} else {
    echo 'ERROR';
    exit;
}
makelogger("Getdir", $uid, "", "", $fetdir['dirname']);
//------------------Edit------------------//
Example #3
0
<?php

require "../config/connect.php";
require "../engine/logger.php";
$fileid = $_POST['fid'];
$pathsearch = mysql_query("select path from files where fileid='" . $fileid . "'");
$namesearch = mysql_query("select filename from files where fileid='" . $fileid . "'");
$path = mysql_fetch_array($pathsearch);
$name = mysql_fetch_array($namesearch);
session_start();
$link = "data/" . $_SESSION['userid'] . "/files" . $path['path'] . $name['filename'];
if ($path['path'] == "" or $name['filename'] == "") {
    echo "ERROR File Not Found";
} else {
    echo "../" . $link;
}
makelogger("Getfile", $_SESSION['userid'], "", "", $name['filename']);
Example #4
0
    exit;
}
$passent = md5($password);
$selusr = mysql_query("select userid,password,type from users where username='******'");
if (mysql_num_rows($selusr) == 1) {
    $fetusr = mysql_fetch_array($selusr);
    $passusr = $fetusr['password'];
    $userid = $fetusr['userid'];
    $usrtype = $fetusr['type'];
    if ($passent == $passusr) {
        $_SESSION['userid'] = $userid;
        $_SESSION['login'] = true;
        $_SESSION['dirpath'] = "/";
        if ($usrtype == 'admin') {
            $_SESSION['admin'] = true;
            $_POST['rememberme'] = false;
        } else {
            include "../engine/clear_zip.php";
        }
        if ($_POST['rememberme'] == 'true') {
            setcookie('rememberme', true, time() + 7200, '/');
            setcookie('login', true, time() + 7200, '/');
            setcookie('userid', $userid, time() + 7200, '/');
        }
        makelogger("Login", $userid, "", "", "");
    } else {
        echo "Wrong Password";
    }
} else {
    echo "Unknown User";
}
Example #5
0
<?php

require "../config/connect.php";
require "../engine/logger.php";
$dname = $_POST['dname'];
$drname = $_POST['dirpath'];
session_start();
$userid = $_SESSION['userid'];
$realdir = "data/" . $userid . "/files";
$thumbdir = "data/" . $userid . "/thumbs";
$datenow = $datenow = date('Y-m-d-H-i-s');
mkdir("../" . $realdir . $drname . $dname);
mkdir("../" . $thumbdir . $drname . $dname);
mysql_query("insert into directories values(null,'" . $userid . "','" . $dname . "','" . $drname . "','" . $datenow . "')") or die(mysql_error());
makelogger("Crtdir", $userid, "", "", $dname);
Example #6
0
<?php

//Menyertakan File Untuk Koneksi DB
require "../config/connect.php";
require "../engine/logger.php";
//Menangkap Nila Dari File filename.php
$fname = $_POST['fname'];
$olfid = $_POST['olfid'];
//Get Datenow
$datenow = date('Y-m-d-H-i-s');
$pathsearch = mysql_query("select path from files where fileid='" . $olfid . "'");
$namesearch = mysql_query("select filename from files where fileid='" . $olfid . "'");
$path = mysql_fetch_array($pathsearch);
$name = mysql_fetch_array($namesearch);
session_start();
$oldlink = "data/" . $_SESSION['userid'] . "/files" . $path['path'] . $name['filename'];
$newlink = "data/" . $_SESSION['userid'] . "/files" . $path['path'] . $fname;
$drname = $path['path'];
if ($path['path'] == "" or $name['filename'] == "") {
    echo "ERROR File Not Found";
} else {
    //Rename File
    rename("../" . $oldlink, "../" . $newlink);
    //Update Nama File
    mysql_query("update files set filename='" . $fname . "',time='" . $datenow . "' where fileid='" . $olfid . "'");
    echo $drname;
}
makelogger("Renfile", $_SESSION['userid'], $name['filename'], $fname, "");
Example #7
0
<?php

require "../config/connect.php";
require "../engine/logger.php";
$userid = $_POST['userid'];
$fstname = $_POST['fstname'];
$lstname = $_POST['lstname'];
$usrname = $_POST['usrname'];
$usrpass = md5($_POST['usrpass']);
$usremail = $_POST['usremail'];
$usrgender = $_POST['usrgender'];
$usrbdate = $_POST['usrbdate'];
$usrpnumb = $_POST['usrpnumb'];
rename("../data/" . $userid . "/img/usrphot.jpg", "../data/" . $userid . "/img/usrphotold.jpg");
unlink("../data/" . $userid . "/img/usrphotold.jpg");
rename("../data/" . $userid . "/img/usrphotnew.jpg", "../data/" . $userid . "/img/usrphot.jpg");
mysql_query("update users set firstname='" . $fstname . "',lastname='" . $lstname . "',username='******',password='******',gender='" . $usrgender . "',bday='" . $usrbdate . "',phone='" . $usrpnumb . "',email='" . $usremail . "' where userid='" . $userid . "'");
makelogger("Saveprofile", $userid, "", "", "");
Example #8
0
//Select Old Dirname
$seloldnam = mysql_query("select dirname from directories where dirid='" . $dirid . "'");
$fetoldnam = mysql_fetch_array($seloldnam);
$oldnam = $fetoldnam['dirname'];
//Rename Dir Name
mysql_query("update directories set dirname='" . $dname . "',time='" . $datenow . "' where dirid='" . $dirid . "'");
rename("../" . $realdir . $drname . $oldnam, "../" . $realdir . $drname . $dname);
rename("../" . $thumbdir . $drname . $oldnam, "../" . $thumbdir . $drname . $dname);
//Assign Old and New Path
$oldpath = $drname . $oldnam . "/";
$newpath = $drname . $dname . "/";
//Select Files in Dir
$selfildir = mysql_query("select path from files where path like '" . $oldpath . "%'");
//Select Sub Dir Path
$selsubdir = mysql_query("select dirpath from directories where dirpath like '" . $oldpath . "%'");
while ($fetfildir = mysql_fetch_array($selfildir)) {
    $fildir = $fetfildir['path'];
    $expfilpath = explode($oldpath, $fildir);
    $partfilpath = $expfilpath[1];
    //Update File Path
    mysql_query("update files set path='" . $newpath . $partfilpath . "' where path='" . $oldpath . $partfilpath . "'");
}
while ($fetsubdir = mysql_fetch_array($selsubdir)) {
    $subdir = $fetsubdir['dirpath'];
    $expsubpath = explode($oldpath, $subdir);
    $partsubpath = $expsubpath[1];
    //Update Sub Dir Path
    mysql_query("update directories set dirpath='" . $newpath . $partsubpath . "' where dirpath like '" . $oldpath . $partsubpath . "'");
}
makelogger("Rendir", $_SESSION['userid'], $oldnam, $dname, "");
Example #9
0
<?php

require "../config/connect.php";
require "../engine/logger.php";
$file = $_FILES['files'];
$name = $_FILES['files']['name'];
$size = $_FILES['files']['size'];
$tmp_name = $_FILES['files']['tmp_name'];
$type = explode(".", $name);
$type = strtolower(end($type));
session_start();
$user_dir = $_SESSION['userid'];
if (!$_SESSION['admin'] and ($type == "jpg" or $type == "png" or $type == "gif")) {
    //Destination Path
    $dest = "../data/" . $user_dir . "/img/usrphotnew.jpg";
    move_uploaded_file($tmp_name, $dest);
    makelogger("Uploadphot", $user_dir, "", "", "");
}
Example #10
0
require "../config/connect.php";
require "../engine/logger.php";
session_start();
$fstname = $_POST['fstname'];
$lstname = $_POST['lstname'];
$usrname = $_POST['usrname'];
$passreg = $_POST['usrpass'];
$usrtype = $_POST['usrtype'];
$mailname = $_POST['mailname'];
$MaFe = $_POST['MaFe'];
$usrbdate = $_POST['usrbdate'];
$phone = $_POST['phone'];
$answer = $_POST['answer'];
$datenow = date('Y-m-d');
if (md5($answer) != $_SESSION['captcha_code']) {
    echo "Captcha Incorrect";
} else {
    mysql_query("insert into users values(null,'" . $fstname . "','" . $lstname . "','" . $usrname . "','" . md5($passreg) . "','" . strtolower($usrtype) . "','" . $MaFe . "','" . $usrbdate . "','" . $phone . "','" . $mailname . "','" . $datenow . "')") or die(mysql_error());
    $seluserid = mysql_query("select max(userid) as userid from users") or die(mysql_error());
    $fetuserid = mysql_fetch_array($seluserid);
    $userid = $fetuserid['userid'];
    if ($usrtype == "User") {
        mkdir("../data/" . $userid . "/");
        mkdir("../data/" . $userid . "/files/");
        mkdir("../data/" . $userid . "/zip/");
        mkdir("../data/" . $userid . "/thumbs/");
        mkdir("../data/" . $userid . "/img/");
    }
    makelogger("Register", $userid, "", "", $usrtype);
}
Example #11
0
require "../engine/func_remdir.php";
require "../engine/logger.php";
$dirid = $_POST['did'];
$userid = $_POST['uid'];
//Select Dir Path
$seldirpath = mysql_query("select dirpath from directories where dirid='" . $dirid . "'");
$fetdirpath = mysql_fetch_array($seldirpath);
$dirpath = $fetdirpath['dirpath'];
//Select Dir Name
$seldirnam = mysql_query("select dirname from directories where dirid='" . $dirid . "'");
$fetdirnam = mysql_fetch_array($seldirnam);
$dirnam = $fetdirnam['dirname'];
//Assign File in Dir and Dir Path
$path = $dirpath . $dirnam . "/";
//Delete Files Subdir and Dir
rem_dir("../data/" . $userid . "/files" . $path);
//Delete Thumbs Dir
rem_dir("../data/" . $userid . "/thumbs" . $path);
//Delete Files in Dir and Sub Dir
mysql_query("delete from files where path like '" . $path . "%' and userid='" . $userid . "'");
//Delete Dir and Sub Dir
mysql_query("delete from directories where dirpath like '" . $path . "%' and userid='" . $userid . "'");
mysql_query("delete from directories where dirid='" . $dirid . "'");
//Send Back To Path
if ($dirpath == "/") {
    echo "";
} else {
    echo $dirpath;
}
makelogger("Remdir", $userid, "", "", $dirnam);
Example #12
0
<?php

require "../config/connect.php";
require "../engine/logger.php";
session_start();
setcookie('rememberme', '', time() - 7200, '/');
setcookie('login', '', time() - 7200, '/');
setcookie('userid', '', time() - 7200, '/');
session_destroy();
if ($_POST['userid'] == "admin") {
    $userid = $_SESSION['userid'];
} else {
    $userid = $_POST['userid'];
}
makelogger("Logout", $userid, "", "", "");
Example #13
0
        //Destination Path Data
        $path = $check_dir;
        $datenow = date('Y-m-d-H-i-s');
        $type = explode(".", $name);
        $type = end($type);
        switch ($size) {
            case $size >= 1000000:
                $size = round($size / 1000000);
                $size = $size . " MB";
                break;
            case $size >= 1000:
                $size = round($size / 1000);
                $size = $size . " KB";
                break;
            case $size < 1000:
                $size = $size . " B";
                break;
        }
        if (file_exists($dest)) {
            unlink($dest);
            move_uploaded_file($tmp_name, $dest);
            mysql_query("update files set size='" . $size . "',time='" . $datenow . "' where userid='" . $user_dir . "' and filename='" . $name . "' and path='" . $check_dir . "'") or die(mysql_error());
        } else {
            move_uploaded_file($tmp_name, $dest);
            mysql_query("insert into files values(null,'" . $user_dir . "','" . $name . "','" . $type . "','" . $path . "','" . $size . "','" . $datenow . "')") or die(mysql_error());
        }
        makelogger("Upload", $user_dir, "", "", $name);
    } else {
        echo "Full";
    }
}