You've already forked bryanpedini.it_old
							
							
		
			
				
	
	
		
			35 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
    switch ( $_SERVER [ 'QUERY_STRING' ] ) {
 | 
						|
        case "/login":
 | 
						|
            if ( isset ( $_SESSION [ 'user_id' ] ) ) {
 | 
						|
                header ( "Location: " . $environment [ 'installation_path' ] );
 | 
						|
                exit;
 | 
						|
            }
 | 
						|
            if ( isset ( $_POST [ 'username' ] ) && isset ( $_POST [ 'password' ] ) ) {
 | 
						|
                //TODO: maybe implement two factor authentication, if possible
 | 
						|
                include ( $environment [ 'installation_path' ] . '/lib/php/user_login.php' );
 | 
						|
                exit;
 | 
						|
            }
 | 
						|
            include ( $environment [ 'installation_path' ] . '/lib/php/templates/login.php' );
 | 
						|
            break;
 | 
						|
        case "/insert":
 | 
						|
            if ( ! isset ( $_SESSION [ 'user_id' ] ) || $_SESSION [ 'user_permission_level' ] != 0 ) {
 | 
						|
                header ( "Location: " . $environment [ 'installation_path' ] . "/login" );
 | 
						|
                exit;
 | 
						|
            }
 | 
						|
            if ( isset ( $_POST [ 'new_article' ] ) ) {
 | 
						|
                //TODO: insert the new article into the database, previous validation of course!
 | 
						|
                $_SESSION [ 'section_id'] = 0; //TODO: get the ID of the last article just inserted and redirect the editor to the new article for preview.
 | 
						|
                header ( "Location: " . $environment [ 'installation_path' ] );
 | 
						|
                exit;
 | 
						|
            }
 | 
						|
            include ( $environment [ 'installation_path' ] . '/lib/php/templates/insert.php' );
 | 
						|
            break;
 | 
						|
        case "/contactme":
 | 
						|
            if ( ! isset ( $_POST [ 'contact_message' ] ) ) {
 | 
						|
                header ( "Location: " . $environment [ 'installation_path' ] );
 | 
						|
                exit;
 | 
						|
            }
 | 
						|
            include ( $environment [ 'installation_path' ] . '/lib/php/contactme.php' );
 | 
						|
            break;
 | 
						|
    } |