First of all you are trying to access a page that is not part of Joomla framework.
In Joomla you can't just explicitly use new pages like second.php
or something else.
Its based on MVC, you have to write component
or module
for your task based on your requirement.
Component gives a wide option for your requirement like form submission ,different pages (layouts) etc. Module is the smallest unit it just display the content (from DB or static) any where in the view page (you can include multiple module in a page.)
Another Dirty
option is to achieve your requirement very quickly is as below.
Instead of loading second.php
inside template use it in the root then include Joomla frame works to that page, USE ht-access to create some SEF URL
for this page, you can use below script to include Joomla frame work.
define( '_JEXEC', 1 );
define('JPATH_BASE', dirname(__FILE__) );//this is when we are in the root,means path to Joomla installation
define( 'DS', DIRECTORY_SEPARATOR );
require_once ( JPATH_BASE .DS.'includes'.DS.'defines.php' );
require_once ( JPATH_BASE .DS.'includes'.DS.'framework.php' );
$mainframe =& JFactory::getApplication('site');
$mainframe->initialise();
hope it make sense..
Or you have to describe more in details what are you trying to achieve.