}
                                        closedir($dh2);
                                    }
                                }
                                closedir($dh);
                            }
                        }
                    }
                }
            }
        }
    }
    $output .= '</ul>';
    Session::_setSession('text_data', $output);
    Session::_setSession('total_files', $totalAffectedfiles);
    Session::_setSession('total_places', $totalPlaces);
    Redirect::to('index.php');
} else {
    if (Session::_sessionExists('text_data') && Session::_sessionExists('total_files') && Session::_sessionExists('total_places')) {
        echo '<div id="overlay-text"><h2 class="redcolor">Warning!!<h2><p>Do not refresh page.</p></div>';
        echo Session::_flashSession('text_data');
        echo '<div id="bottom-files" style="display:none">
				<div class="row"><div class="total_rows">Total Updated Files : <span style="color:#000">' . Session::_flashSession('total_files') . '</span></div></div>
				<div class="row"><div class="total_rows">Total Words Replaced : <span style="color:#000">' . Session::_flashSession('total_places') . '</span></div></div>
				<div class="row"><div class="col-6"><a href="index.php" class="btn pull-right">Close</a></div>
    		  </div></div>';
    } else {
        ?>

<form name="ocForm" action="" method="post" onsubmit="return confirm('Are you sure you want to update?');">
	<div class="row">