debsdesign Posted February 18, 2016 Share Posted February 18, 2016 (edited) Hi I have a number of pages that I would like to be restricted from being able to be viewed without first agreeing to the disclaimer page. I do not want the users to have to click on the agreement for each page they want to view in the restricted section so I would like the session to continue across all restricted pages until the user logs out of their browser. I have set a form on the disclaimer page that directs users to the first page once the required check box has been clicked and submitted. However I have clearly missed a few things as I can directly access the page that is supposed to be restricted via the session if I enter the direct url. Obviously the same goes for other sample pages. The form page is WholesaleAgree.php WholesaleAgree.php this directs to agreeAccept1.php agreeAccept1.php There are also going to be a number of other pages I need to restrict with the disclaimer so I have also attached agreeAccept2.php agreeAccept2.php. My apologies if this is a stupid question but I can't seem to work it out at the moment. Thanks in advance for your help. WholesaleAgree.php <!doctype html> <!--[if lt IE 7]> <html class="ie6 oldie"> <![endif]--> <!--[if IE 7]> <html class="ie7 oldie"> <![endif]--> <!--[if IE 8]> <html class="ie8 oldie"> <![endif]--> <!--[if gt IE 8]><!--> <html class=""> <!--<![endif]--> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Macreon - What we do</title> <meta name="keywords" content="Macreon, Investment, Management, Capital, Managers, Investments, SMSF, Funds under management, Fund management Australia, Wealth management, investment management, Super investment, International fund, IDPS, Wholesale, Australian Investments, Boutique Fund Manager, Unit Prices, Product Performance, Australian investments, investment specialists, funds management, funds, Funds Management Brisbane, australian funds" /> <meta name="description" content="Macreon Investment Management Pty Ltd's philosophy is simple: to build a business that targets specific market niches, through our financial products, for the end investor in a rapidly and ever-changing environment" /> <link href="boilerplate.css" rel="stylesheet" type="text/css"> <link href="css/MacreonStyle.css" rel="stylesheet" type="text/css"> <link rel="stylesheet" href="css/style.css" /> <!-- js --> <script src="js/jquery-1.9.1.min.js"></script> <script src="js/modernizr.custom.js"></script> <script> $(document).ready(function(){ $("#nav-mobile").html($("#nav-main").html()); $("#nav-trigger span").click(function(){ if ($("nav#nav-mobile ul").hasClass("expanded")) { $("nav#nav-mobile ul.expanded").removeClass("expanded").slideUp(250); $(this).removeClass("open"); } else { $("nav#nav-mobile ul").addClass("expanded").slideDown(250); $(this).addClass("open"); } }); }); </script> <style> body,td,th { font-family: "Myriad Pro"; } @media screen and (max-width: 600px) { #Slider { visibility: hidden; clear: both; float: left; margin: 10px auto 5px 20px; width: 28%; display: none; } } </style> <!-- To learn more about the conditional comments around the html tags at the top of the file: paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ Do the following if you're using your customized build of modernizr (http://www.modernizr.com/): * insert the link to your js here * remove the link below to the html5shiv * add the "no-js" class to the html tags at the top * you can also remove the link to respond.min.js if you included the MQ Polyfill in your modernizr build --> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <script src="respond.min.js"></script> <link rel="apple-touch-icon" sizes="57x57" href="favicon/apple-icon-57x57.png"> <link rel="apple-touch-icon" sizes="60x60" href="favicon/apple-icon-60x60.png"> <link rel="apple-touch-icon" sizes="72x72" href="favicon/apple-icon-72x72.png"> <link rel="apple-touch-icon" sizes="76x76" href="favicon/apple-icon-76x76.png"> <link rel="apple-touch-icon" sizes="114x114" href="favicon/apple-icon-114x114.png"> <link rel="apple-touch-icon" sizes="120x120" href="favicon/apple-icon-120x120.png"> <link rel="apple-touch-icon" sizes="144x144" href="favicon/apple-icon-144x144.png"> <link rel="apple-touch-icon" sizes="152x152" href="favicon/apple-icon-152x152.png"> <link rel="apple-touch-icon" sizes="180x180" href="favicon/apple-icon-180x180.png"> <link rel="icon" type="image/png" sizes="192x192" href="favicon/android-icon-192x192.png"> <link rel="icon" type="image/png" sizes="32x32" href="favicon/favicon-32x32.png"> <link rel="icon" type="image/png" href="favicon/favicon-96x96.png" sizes="96x96"> <link rel="icon" type="image/png" sizes="16x16" href="favicon/favicon-16x16.png"> <link rel="manifest" href=favicon/manifest.json"> <style type="text/css"> </style> <meta name="msapplication-TileColor" content="#ffffff"> <meta name="msapplication-TileImage" content="favicon/ms-icon-144x144.png"> <meta name="theme-color" content="#ffffff"> <!--The following script tag downloads a font from the free fonts server for use within the web page. We recommend that you do not modify it.--> <script src="http://webfonts.creativecloud.com/miniver:n4:default;droid-sans-mono:n4:default.js" type="text/javascript"></script> </head> <body> <div class="gridContainer clearfix"> <div id="Body" class="fluid"> <div align="center"> <h3 align="left"><strong>Dislaimer</strong> </h3> <p align="left">You are about to enter blah blah blah</p> <p align="left"> </p> <p align="left">Click I Agree if you have read, understood and agree to abide by the contents of this page and to confirm that you are an Institutional Investor in order to proceed. </p> <form id="form1" name="form1" method="post" action="https://www.macreon.com.au/agreeAccept1.php"> <p> <input name="agree" type="checkbox" id="agree" required="required" > <label for="agree">I agree </label> </p> <p> <input type="submit" name="submit" id="submit" value="Submit" > </p> </form> <p align="left"> </p> </div> <div id="OneThird" class="fluid"> <p> </p> </div> <div id="TwoThirds" class="fluid"> <p> </p> </div> <div id="ThreeThirds" class="fluid"> <p> </p> </div ></div> <div id="HalfLeft" class="fluid">This is the content for Layout Div Tag "HalfLeft"</div> <div id="HalfRight" class="fluid">This is the content for Layout Div Tag "HalfRight"</div> <div id="OneThird" class="fluid">This is the content for Layout Div Tag "OneThird"</div> <div id="TwoThirds" class="fluid">This is the content for Layout Div Tag "TwoThirds"</div> <div id="ThreeThirds" class="fluid">This is the content for Layout Div Tag "ThreeThirds"</div> <div id="OneThirdLeft" class="fluid">This is the content for Layout Div Tag "OneThirdLeft"</div> <div id="TwoThirdsRight" class="fluid">This is the content for Layout Div Tag "TwoThirdsRight"</div> <div id="TwoThirdsLeft" class="fluid">This is the content for Layout Div Tag "TwoThirdsLeft"</div> <div id="OneThirdRight" class="fluid">This is the content for Layout Div Tag "OneThirdRight"</div> <div id="div1" class="fluid">Use Insert Panel for additional Fluid Grid Layout Elements. Note: All Fluid Layout tags must be contained within the "gridContainer" div tag.</div> </body> </html> agreeAccept1.php <?php // initiate session session_start(); // check that form has been submitted and that name is not empty if ($_POST && !empty($_POST['agree'])) { // set session variable $_SESSION['agree'] = $_POST['agree']; } else { // if not set, send back to agreement echo ' <a href="https://www.macreon.com.au/WholesaleAgree.php"></a>'; } ?> <!doctype html> <!--[if lt IE 7]> <html class="ie6 oldie"> <![endif]--> <!--[if IE 7]> <html class="ie7 oldie"> <![endif]--> <!--[if IE 8]> <html class="ie8 oldie"> <![endif]--> <!--[if gt IE 8]><!--> <html class=""> <!--<![endif]--> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Macreon - What we do</title> <meta name="keywords" content="Macreon, Investment, Management, Capital, Managers, Investments, SMSF, Funds under management, Fund management Australia, Wealth management, investment management, Super investment, International fund, IDPS, Wholesale, Australian Investments, Boutique Fund Manager, Unit Prices, Product Performance, Australian investments, investment specialists, funds management, funds, Funds Management Brisbane, australian funds" /> <meta name="description" content="Macreon Investment Management Pty Ltd's philosophy is simple: to build a business that targets specific market niches, through our financial products, for the end investor in a rapidly and ever-changing environment" /> <link href="boilerplate.css" rel="stylesheet" type="text/css"> <link href="css/MacreonStyle.css" rel="stylesheet" type="text/css"> <link rel="stylesheet" href="css/style.css" /> <!-- js --> <script src="js/jquery-1.9.1.min.js"></script> <script src="js/modernizr.custom.js"></script> <script> $(document).ready(function(){ $("#nav-mobile").html($("#nav-main").html()); $("#nav-trigger span").click(function(){ if ($("nav#nav-mobile ul").hasClass("expanded")) { $("nav#nav-mobile ul.expanded").removeClass("expanded").slideUp(250); $(this).removeClass("open"); } else { $("nav#nav-mobile ul").addClass("expanded").slideDown(250); $(this).addClass("open"); } }); }); </script> <style> body,td,th { font-family: "Myriad Pro"; } @media screen and (max-width: 600px) { #Slider { visibility: hidden; clear: both; float: left; margin: 10px auto 5px 20px; width: 28%; display: none; } } </style> <!-- To learn more about the conditional comments around the html tags at the top of the file: paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ Do the following if you're using your customized build of modernizr (http://www.modernizr.com/): * insert the link to your js here * remove the link below to the html5shiv * add the "no-js" class to the html tags at the top * you can also remove the link to respond.min.js if you included the MQ Polyfill in your modernizr build --> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <script src="respond.min.js"></script> <link rel="apple-touch-icon" sizes="57x57" href="favicon/apple-icon-57x57.png"> <link rel="apple-touch-icon" sizes="60x60" href="favicon/apple-icon-60x60.png"> <link rel="apple-touch-icon" sizes="72x72" href="favicon/apple-icon-72x72.png"> <link rel="apple-touch-icon" sizes="76x76" href="favicon/apple-icon-76x76.png"> <link rel="apple-touch-icon" sizes="114x114" href="favicon/apple-icon-114x114.png"> <link rel="apple-touch-icon" sizes="120x120" href="favicon/apple-icon-120x120.png"> <link rel="apple-touch-icon" sizes="144x144" href="favicon/apple-icon-144x144.png"> <link rel="apple-touch-icon" sizes="152x152" href="favicon/apple-icon-152x152.png"> <link rel="apple-touch-icon" sizes="180x180" href="favicon/apple-icon-180x180.png"> <link rel="icon" type="image/png" sizes="192x192" href="favicon/android-icon-192x192.png"> <link rel="icon" type="image/png" sizes="32x32" href="favicon/favicon-32x32.png"> <link rel="icon" type="image/png" href="favicon/favicon-96x96.png" sizes="96x96"> <link rel="icon" type="image/png" sizes="16x16" href="favicon/favicon-16x16.png"> <link rel="manifest" href=favicon/manifest.json"> <style type="text/css"> </style> <meta name="msapplication-TileColor" content="#ffffff"> <meta name="msapplication-TileImage" content="favicon/ms-icon-144x144.png"> <meta name="theme-color" content="#ffffff"> <!--The following script tag downloads a font from the free fonts server for use within the web page. We recommend that you do not modify it.--> <script src="http://webfonts.creativecloud.com/miniver:n4:default;droid-sans-mono:n4:default.js" type="text/javascript"></script> </head> <body> <div class="gridContainer clearfix"> <div id="Body" class="fluid"> <div align="center"> <h3 align="left"><strong>Agreement accepted pg 1</strong> </h3> <p align="left">We are exclusively an Investment Management firm delivering professional asset management in order to meet the specified investment goals our clients. Macreon Investment Management is an established top quartile multi-asset manager with dedicated investment teams specialising in Australian Equities, US Equities, Fixed Income and Money Markets.    </p> <p align="left">Our focus is the delivery of consistent income whilst preserving capital in all market cycles. Skillfully executed, our active management approach is mindful of our clients’ risk constraints and our commitment is to helping them navigate the market cycles and achieve their goals. Our approach is to do a few things extremely well which is why we intentionally focus on delivering excellent long term results across a small number of core investment strategies and provide exceptional service along the way. </p> <p align="left">In a post-GFC world investment managers are being challenged by their clients to deliver both better capital protection and higher income contributions. When markets rise, the upside always takes care of itself, but when they fall, that is when the problems are realised. Our investment approach focuses on preserving capital when markets fall. We believe that long term returns are higher and more consistent for investors if we avoid permanent capital loss. </p> </div> <div id="OneThird" class="fluid"> <p><strong>Integrated Approach </strong><br> We make our investment decisions by integrating fundamental equity, quantitative and credit disciplines in our analysis.</p> </div> <div id="TwoThirds" class="fluid"> <p><strong>Collaboration</strong><br> Our team philosophy, incentive structure and long-term focus ensure strong collaboration across the firm.</p> </div> <div id="ThreeThirds" class="fluid"> <p><strong>Active Risk Management</strong><br> We take a universal approach to actively managing risk at the security, portfolio and firm levels.</p> </div ></div> <div id="HalfLeft" class="fluid">This is the content for Layout Div Tag "HalfLeft"</div> <div id="HalfRight" class="fluid">This is the content for Layout Div Tag "HalfRight"</div> <div id="OneThird" class="fluid">This is the content for Layout Div Tag "OneThird"</div> <div id="TwoThirds" class="fluid">This is the content for Layout Div Tag "TwoThirds"</div> <div id="ThreeThirds" class="fluid">This is the content for Layout Div Tag "ThreeThirds"</div> <div id="OneThirdLeft" class="fluid">This is the content for Layout Div Tag "OneThirdLeft"</div> <div id="TwoThirdsRight" class="fluid">This is the content for Layout Div Tag "TwoThirdsRight"</div> <div id="TwoThirdsLeft" class="fluid">This is the content for Layout Div Tag "TwoThirdsLeft"</div> <div id="OneThirdRight" class="fluid">This is the content for Layout Div Tag "OneThirdRight"</div> <div id="div1" class="fluid">Use Insert Panel for additional Fluid Grid Layout Elements. Note: All Fluid Layout tags must be contained within the "gridContainer" div tag.</div> </body> </html> agreeAccept2.php <?php // initiate session session_start(); // check that form has been submitted and that name is not empty if ($_POST && !empty($_POST['agree'])) { // set session variable $_SESSION['agree'] = $_POST['agree']; } else { // if not set, send back to agreement echo ' <a href="https://www.macreon.com.au/WholesaleAgree.php"></a>'; } ?> <!doctype html> <!--[if lt IE 7]> <html class="ie6 oldie"> <![endif]--> <!--[if IE 7]> <html class="ie7 oldie"> <![endif]--> <!--[if IE 8]> <html class="ie8 oldie"> <![endif]--> <!--[if gt IE 8]><!--> <html class=""> <!--<![endif]--> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Macreon - What we do</title> <meta name="keywords" content="Macreon, Investment, Management, Capital, Managers, Investments, SMSF, Funds under management, Fund management Australia, Wealth management, investment management, Super investment, International fund, IDPS, Wholesale, Australian Investments, Boutique Fund Manager, Unit Prices, Product Performance, Australian investments, investment specialists, funds management, funds, Funds Management Brisbane, australian funds" /> <meta name="description" content="Macreon Investment Management Pty Ltd's philosophy is simple: to build a business that targets specific market niches, through our financial products, for the end investor in a rapidly and ever-changing environment" /> <link href="boilerplate.css" rel="stylesheet" type="text/css"> <link href="css/MacreonStyle.css" rel="stylesheet" type="text/css"> <link rel="stylesheet" href="css/style.css" /> <!-- js --> <script src="js/jquery-1.9.1.min.js"></script> <script src="js/modernizr.custom.js"></script> <script> $(document).ready(function(){ $("#nav-mobile").html($("#nav-main").html()); $("#nav-trigger span").click(function(){ if ($("nav#nav-mobile ul").hasClass("expanded")) { $("nav#nav-mobile ul.expanded").removeClass("expanded").slideUp(250); $(this).removeClass("open"); } else { $("nav#nav-mobile ul").addClass("expanded").slideDown(250); $(this).addClass("open"); } }); }); </script> <style> body,td,th { font-family: "Myriad Pro"; } @media screen and (max-width: 600px) { #Slider { visibility: hidden; clear: both; float: left; margin: 10px auto 5px 20px; width: 28%; display: none; } } </style> <!-- To learn more about the conditional comments around the html tags at the top of the file: paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ Do the following if you're using your customized build of modernizr (http://www.modernizr.com/): * insert the link to your js here * remove the link below to the html5shiv * add the "no-js" class to the html tags at the top * you can also remove the link to respond.min.js if you included the MQ Polyfill in your modernizr build --> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <script src="respond.min.js"></script> <link rel="apple-touch-icon" sizes="57x57" href="favicon/apple-icon-57x57.png"> <link rel="apple-touch-icon" sizes="60x60" href="favicon/apple-icon-60x60.png"> <link rel="apple-touch-icon" sizes="72x72" href="favicon/apple-icon-72x72.png"> <link rel="apple-touch-icon" sizes="76x76" href="favicon/apple-icon-76x76.png"> <link rel="apple-touch-icon" sizes="114x114" href="favicon/apple-icon-114x114.png"> <link rel="apple-touch-icon" sizes="120x120" href="favicon/apple-icon-120x120.png"> <link rel="apple-touch-icon" sizes="144x144" href="favicon/apple-icon-144x144.png"> <link rel="apple-touch-icon" sizes="152x152" href="favicon/apple-icon-152x152.png"> <link rel="apple-touch-icon" sizes="180x180" href="favicon/apple-icon-180x180.png"> <link rel="icon" type="image/png" sizes="192x192" href="favicon/android-icon-192x192.png"> <link rel="icon" type="image/png" sizes="32x32" href="favicon/favicon-32x32.png"> <link rel="icon" type="image/png" href="favicon/favicon-96x96.png" sizes="96x96"> <link rel="icon" type="image/png" sizes="16x16" href="favicon/favicon-16x16.png"> <link rel="manifest" href=favicon/manifest.json"> <style type="text/css"> </style> <meta name="msapplication-TileColor" content="#ffffff"> <meta name="msapplication-TileImage" content="favicon/ms-icon-144x144.png"> <meta name="theme-color" content="#ffffff"> <!--The following script tag downloads a font from the free fonts server for use within the web page. We recommend that you do not modify it.--> <script src="http://webfonts.creativecloud.com/miniver:n4:default;droid-sans-mono:n4:default.js" type="text/javascript"></script> </head> <body> <div class="gridContainer clearfix"> <div id="Body" class="fluid"> <div align="center"> <h3 align="left"><strong>Agreement accepted pg 2</strong> </h3> <p align="left"> </p> <p align="left"> </p> </div> <div id="OneThird" class="fluid"> <p> </p> </div> <div id="TwoThirds" class="fluid"> <p> </p> </div> <div id="ThreeThirds" class="fluid"> <p> </p> </div ></div> <div id="HalfLeft" class="fluid">This is the content for Layout Div Tag "HalfLeft"</div> <div id="HalfRight" class="fluid">This is the content for Layout Div Tag "HalfRight"</div> <div id="OneThird" class="fluid">This is the content for Layout Div Tag "OneThird"</div> <div id="TwoThirds" class="fluid">This is the content for Layout Div Tag "TwoThirds"</div> <div id="ThreeThirds" class="fluid">This is the content for Layout Div Tag "ThreeThirds"</div> <div id="OneThirdLeft" class="fluid">This is the content for Layout Div Tag "OneThirdLeft"</div> <div id="TwoThirdsRight" class="fluid">This is the content for Layout Div Tag "TwoThirdsRight"</div> <div id="TwoThirdsLeft" class="fluid">This is the content for Layout Div Tag "TwoThirdsLeft"</div> <div id="OneThirdRight" class="fluid">This is the content for Layout Div Tag "OneThirdRight"</div> <div id="div1" class="fluid">Use Insert Panel for additional Fluid Grid Layout Elements. Note: All Fluid Layout tags must be contained within the "gridContainer" div tag.</div> </body> </html> Edited February 18, 2016 by requinix embedding code Quote Link to comment Share on other sites More sharing options...
requinix Posted February 18, 2016 Share Posted February 18, 2016 (edited) Most people don't want to download attachments and fire up a PHP editor to read someone's code online. In the future, help us all out by posting the code right in the post itself. (I've done it for you this time.) // if not set, send back to agreement echo ' <a href="https://www.macreon.com.au/WholesaleAgree.php"></a>';All you're doing here is outputting a link to the agreement page. You have to actually force the user to go back to it, and you do that with code like // if not set, send back to agreement header('Location: WholesaleAgree.php', true, 307); exit;This tells the browser to redirect, the 307 means it's only a temporary redirect, and the exit prevents the rest of the code from executing. Keep in mind that code that uses header() like this must happen before there is any output whatsoever. [edit] Oh. You're also missing a check for the acceptance flag in the session. All you look at now is the form - gotta check both of them. Edited February 18, 2016 by requinix Quote Link to comment Share on other sites More sharing options...
debsdesign Posted February 18, 2016 Author Share Posted February 18, 2016 Thanks for that My apologies for not embedding the code I will make the amendments and see how I go Regards Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.