Fixed session path warnings during setup, Fixed deleting users from database

This commit is contained in:
xevidos 2019-12-22 23:10:44 -05:00
parent 8c62326875
commit 7b0d6c3926
2 changed files with 15 additions and 5 deletions

View File

@ -277,6 +277,11 @@ class Common {
} catch( exception $e ) {
}
if( ! is_dir( SESSIONS_PATH ) ) {
mkdir( SESSIONS_PATH );
}
session_start();
if( ! defined( 'SESSION_ID' ) ) {

View File

@ -55,7 +55,12 @@ class User {
$query = "
DELETE FROM projects
WHERE owner=( SELECT id FROM users WHERE username=? )
AND ( SELECT COUNT(*) FROM access WHERE project = projects.id AND WHERE user <> ( SELECT id FROM users WHERE username=? ) );";
AND (
SELECT COUNT(*)
FROM access
WHERE project = projects.id
AND user <> ( SELECT id FROM users WHERE username=? )
) = 0;";
$bind_variables = array(
$username,
$username
@ -70,18 +75,18 @@ class User {
if( $return > 0 ) {
echo formatJSEND( "success", null );
exit( formatJSEND( "success", null ) );
} else {
echo formatJSEND( "error", "Error deleting user information." );
exit( formatJSEND( "error", "Error deleting user information." ) );
}
} else {
echo formatJSEND( "error", "Error deleting user project information." );
exit( formatJSEND( "error", "Error deleting user project information." ) );
}
} else {
echo formatJSEND( "error", "Error deleting user option information." );
exit( formatJSEND( "error", "Error deleting user option information." ) );
}
}