How To Only Allow Logged In Users To View Your New Pages.
If you have created a new page on your AdQuick website, using the AdQuick template system, as explained on this guide, www.phplemon.com/create-new-page.php - You will know that the new page is visible to anyone using your website.
It is possible to only allow logged in users to view these new pages with a simple line of code.
If you followed the guide at www.phplemon.com/create-new-page.php, you will know that the blank template for the new .php file looks like this,
<?php
include ("include/config.php");
$smarty->assign('right_panel', 'off');
//// ******* just change the name 'blank.tpl' as you need
$content = $smarty->fetch('blank.tpl');
//// ********************
$smarty->assign('content',$content);
$smarty->display('master_page.tpl');
?>
All you need to do is add this line of code,
if(!isset($_SESSION[uid])) { header("location: account.php"); exit(); }
So your new .php page should look like,
<?php
include ("include/config.php");
if(!isset($_SESSION[uid])) { header("location: account.php"); exit(); }
$smarty->assign('right_panel', 'off');
//// ******* just change the name 'blank.tpl' as you need
$content = $smarty->fetch('blank.tpl');
//// ********************
$smarty->assign('content',$content);
$smarty->display('master_page.tpl');
?>