Share login with static pages

Got something cool to share with AppGini users? Feel free to post it here!
Post Reply
Sergio
Posts: 21
Joined: 2013-01-08 19:22

Share login with static pages

Post by Sergio » 2014-04-03 16:52

I got some static pages inside my site and some pages developed with appgini, i would like to use the same login for these pages too, so only ppl logged in in appgini could see them...anyone know how this cam be done? I put pages inside the appgini menu, but no idea how to share the login chek, any suggestion? thx

User avatar
a.gneady
Site Admin
Posts: 1281
Joined: 2012-09-27 14:46
Contact:

Re: Share login with static pages

Post by a.gneady » 2014-04-05 08:50

Assuming the static page is a PHP file (if it's an HTML file, just change the extension to php and update links to that page), add this code to the top of the page:

Code: Select all

<?php
   $appgini_dir = '/path/to/your/appgini/application/'; /* change this to the path of your appgini application */
   include_once($appgini_dir . 'defaultLang.php');
   include_once($appgini_dir . 'language.php');
   include_once($appgini_dir . 'lib.php');

   $memberInfo = getMemberInfo(); /* see http://bigprof.com/appgini/help/working-with-generated-web-database-application/hooks/memberInfo */
   if(!$memberInfo['username'] || $memberInfo['username'] == 'guest'){
      die("You must log in first before accessing this page."); /* change this message if needed */
   }
?>
:idea: AppGini plugins to add more power to your apps:
  • DataTalk is an innovative AppGini plugin based on ChatGPT that allows you to interact with your AppGini database using natural language questions, without writing any SQL. Check the demo video
  • Mass Update plugin: Update multiple records at once and improve your workflow efficiency.
  • Check our other plugins and get a generous discount of up to 30% when buying 2 or more plugins.

Post Reply