You've already forked OpenShorte.old
							
							Updated the login page with a new cool template.
Source template from https://bootsnipp.com/snippets/z8aQr.
This commit is contained in:
		@@ -1,3 +1,36 @@
 | 
			
		||||
<?php
 | 
			
		||||
    if ( ! isset ( $_SESSION [ 'user_id' ] ) ) {
 | 
			
		||||
        header ( "Location: " . substr ( $_SERVER [ 'SCRIPT_NAME' ], 0, -10 ) . "/login" );
 | 
			
		||||
    }
 | 
			
		||||
    if ( isset ( $_POST [ 'url' ] ) ) {
 | 
			
		||||
        $url = $_POST [ 'url' ];
 | 
			
		||||
        $db_connection = db_connect ( );
 | 
			
		||||
        $statement = db_prepare ( $db_connection, "INSERT INTO `links` ( `ID`, `URL`, `created_by` ) VALUES ( NULL, ?, " . $_SESSION [ 'user_id' ] . " );" );
 | 
			
		||||
        $parameters = [
 | 
			
		||||
            [ "s" ],
 | 
			
		||||
            [ &$url ],
 | 
			
		||||
        ];
 | 
			
		||||
        db_bind ( $statement, $parameters );
 | 
			
		||||
        db_execute ( $statement );
 | 
			
		||||
        $statement = db_prepare ( $db_connection, "SELECT COUNT( links.ID ) as `count` FROM links;");
 | 
			
		||||
        db_execute ( $statement );
 | 
			
		||||
        $result = $statement->get_result ( );
 | 
			
		||||
        $row = $result->fetch_assoc ( );
 | 
			
		||||
        header ( 'Content-Type: application/json' );
 | 
			
		||||
        $response = [
 | 
			
		||||
            'status' => 200,
 | 
			
		||||
            'message' => 'URL inserted correctly.',
 | 
			
		||||
            'new_id' => $row [ 'count' ],
 | 
			
		||||
        ];
 | 
			
		||||
        echo ( json_encode ( $response ) );
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
        $db_connection = db_connect ( );
 | 
			
		||||
        $statement = db_prepare ( $db_connection, "SELECT links.ID, links.URL FROM links WHERE links.created_by = " . $_SESSION [ 'user_id' ] );
 | 
			
		||||
        db_execute ( $statement );
 | 
			
		||||
        $result = $statement->get_result ( );
 | 
			
		||||
        $row = $result->fetch_assoc ( );
 | 
			
		||||
?>
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html>
 | 
			
		||||
    <head>
 | 
			
		||||
@@ -23,4 +56,7 @@
 | 
			
		||||
        <script src="js/insertnew.js"></script>
 | 
			
		||||
        <script>var script_name = "<?=substr($_SERVER['SCRIPT_NAME'],0,-10)?>";</script>
 | 
			
		||||
    </body>
 | 
			
		||||
</html>
 | 
			
		||||
</html>
 | 
			
		||||
<?php
 | 
			
		||||
    }
 | 
			
		||||
?>
 | 
			
		||||
		Reference in New Issue
	
	Block a user