Exemplo n.º 1
0
 public static function deleteUser($username)
 {
     //delete picture
     $usr = self::getUserWithoutPassword($username);
     if ($usr->getProfile_pic() != "images/users/default.jpg") {
         $dir = 'images/users/' . $username;
         $files = array_diff(scandir($dir), array('.', '..'));
         foreach ($files as $file) {
             is_dir("{$dir}/{$file}") ? delTree("{$dir}/{$file}") : unlink("{$dir}/{$file}");
         }
         rmdir($dir);
     }
     DAL::deleteUser($username);
 }
Exemplo n.º 2
0
<?php

header('Content-type: application/json; charset=utf-8');
$callback = $_REQUEST['callback'];
$model = $_REQUEST["models"];
if (!isset($callback) || !isset($model)) {
    die('Missing callback or model');
}
$data = json_decode($model, TRUE);
include 'dal.php';
$dal = new DAL();
$dal->deleteUser($data[0]["email"]);
echo sprintf("%s(%s)", $callback, $model);