DMXzone Security Provider PHP Support Product Page

Answered

How to start login session without security restrict?

Asked 13 Dec 2017 13:21:01
1
has this question
13 Dec 2017 13:21:01 Firdaus Rohman posted:
Is it possible to start login session after login success without security restrict enabled on the page?

Replies

Replied 13 Dec 2017 14:17:36
13 Dec 2017 14:17:36 Teodor Kuduschiev replied:
Hello Firdaus,
Login session is started as soon as the login step in the server action runs successfully.
Replied 13 Dec 2017 14:23:42
13 Dec 2017 14:23:42 Firdaus Rohman replied:
But after login success <?php print_r($_SESSION); ?> doesn't output running session unless security restrict is enabled on the page.
Replied 13 Dec 2017 14:32:04
13 Dec 2017 14:32:04 Teodor Kuduschiev replied:
I am not sure what exactly do you mean by: "security restrict is enabled on the page"?
As soon as you run the login action, and it returns a status of OK 200 the session is being created.
Replied 13 Dec 2017 14:37:41
13 Dec 2017 14:37:41 Firdaus Rohman replied:
DMXZone Security Provider Security Enforcer > Page Permissions > [/] Restrict Access With Security Provider

I mean is it possible to get php session without "Restrict Access With Security Provider" [/] on the page, because <?php print_r($_SESSION); ?> doesn't output the session if this option is not ticked [ ].
Replied 13 Dec 2017 14:41:12
13 Dec 2017 14:41:12 Teodor Kuduschiev replied:
Security enforcer only checks if the session is active, it does not create it ... so it is not required to create the session as i already explained above.
Тhe session is generated like: SecurityProviderName+"Id"
So if your security provider name in the server connect is called: dbUsers then your session name is: dbUsersId
Replied 13 Dec 2017 14:48:11
13 Dec 2017 14:48:11 Firdaus Rohman replied:
Ok all I need is for php to print current session after login success without the page is being restricted. How can I achieve it?
Replied 13 Dec 2017 14:49:56
13 Dec 2017 14:49:56 Teodor Kuduschiev replied:

QuoteТhe session is generated like: SecurityProviderName+"Id"
So if your security provider name in the server connect is called: dbUsers then your session name is: dbUsersId

Replied 13 Dec 2017 14:50:04
13 Dec 2017 14:50:04 Firdaus Rohman replied:
When the page is restricted, I get this output ( [session] => [securityId] => 35 ). I need to achieve similar thing without restricting the page.
Replied 13 Dec 2017 14:52:49
13 Dec 2017 14:52:49 Teodor Kuduschiev replied:
I already explained you, that the security restrict is not required and the session is being generated on login. Security enforcer has NOTHING to do with creating the session, it only READS the created session.
Are you sure your PHP code is correct?
Replied 13 Dec 2017 15:18:00
13 Dec 2017 15:18:00 Firdaus Rohman replied:
I fully understand what you already explained, but I still can't get php to print current session without this enabled "[/] Restrict Access With Security Provider". The code is standard and it prints the current session, but only when "[/] Restrict Access With Security Provider" is enabled on the page. If the option is disabled the code will print "Notice: Undefined variable: _SESSION in ......"
Replied 13 Dec 2017 15:23:03
13 Dec 2017 15:23:03 Teodor Kuduschiev replied:
Are you sure your PHP code has no errors? More specifically - are you sure you did not forget to include

<?php session_start(); ?> 


on top of the page where you want to print the session value?
Replied 13 Dec 2017 15:33:19
13 Dec 2017 15:33:19 Firdaus Rohman replied:

Quote<?php session_start(); ?>


Correct answer. Cheers!

Reply to this topic