access to (some) web pages without logging in

Hi, I wanted to allow at least accessing some specific read only pages (like the myelectric example) for users without need to login. Is there a place where I could e.g. simply add the readonly apikey just in the code to allow that?

Currently I only see the page -- but not showing the values ... ;--(

Thanks for your help!

Arwed

TrystanLea's picture

Re: access to (some) web pages without logging in

try adding ?apikey= to the URL with your api key that may work, if it doesnt I will need to update a few things in the module to make it work.

arwed's picture

Re: access to (some) web pages without logging in

Hm, I tried it with the read only apikey directly in the URL of the browser. No change in display except that I now saw appearing the Extras menu (but with no item to select below).

What I would find great is if one could add the apikey to one of the files to keep the apikey a bit hidden. Do you think that is possible? In that case I could enable a fiew pages only for "public" access.

arwed

arwed's picture

Re: access to (some) web pages without logging in

Yet another question related to that: in the packetgen's file "setpoint.php"  there is some PHP code like

<?php global $path;

  if (!isset($_GET['apikey'])) $apikey = ""; else $apikey = $_GET['apikey'];

?>

So if apikey is _not_ set we set it to an empty string, otherwise to the apikey value? That's not really clear to me; ok, I'm new with PHP and quite new with webpages, but I would like to understand that ...

For test purposes I tried to echo the apikey variable and it's empty even after this line. I also tried to show the value from the script area of the file and there apikey is empty as well. Does anyone have some helping hints for me here?

Thanks a lot!

ukmoose's picture

Re: access to (some) web pages without logging in

emoncms isn't the easiest place to start learning php as it gets quite complicated.
$_GET['apikey'] looks at the string passed via the URL (after the ?)  and see if it includes a key called apikey.
if it doesn't exist the variable $apikey within the php page gets set to an empty string, as the value hasn't been passed to the page via the URL.
If the URL does include a key called apikey the variable gets set to whatever value was passed associated with the key apikey.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.