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 ) { } catch( exception $e ) {
} }
if( ! is_dir( SESSIONS_PATH ) ) {
mkdir( SESSIONS_PATH );
}
session_start(); session_start();
if( ! defined( 'SESSION_ID' ) ) { if( ! defined( 'SESSION_ID' ) ) {

View file

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