User Logged In Cookie

If you aren't speaking german, you can ask for support or post your request here.
Antworten
stub
Beiträge: 8
Registriert: 15. Apr 2017, 06:41

User Logged In Cookie

Beitrag von stub »

Hi,

I need to be able to check if a user is logged in or not. What is the name of the cookie you use to know that a user is logged in. Does it ever change for any reason?

rgds
stu
XimeX
Developer
Beiträge: 1148
Registriert: 12. Jul 2015, 13:21
Wohnort: Austria

Re: User Logged In Cookie

Beitrag von XimeX »

You only have to include common.php and check the variable $gValidLogin
stub
Beiträge: 8
Registriert: 15. Apr 2017, 06:41

Re: User Logged In Cookie

Beitrag von stub »

This is what my programmer said about this....

Also, I wasn't able to include the commons.php file they told you about in the admidio forums. Including it in other php documents causes a php error. I just don't have a way to check if the user is logged in or not as I cannot include commons.php and check for the $gValidLogin variable

What we are trying to do is check that a user is logged in to Admidio before they are allowed to send me a specific buynow/makeoffer email. If not logged in, goto admidio and register or login, if logged in, then go to the email page. We are not in the admidio system when we are trying to do this. We are trying to go to the Admidio system based on the results of the test.

Is it possible for you to be more specific about including common.php in a non-admidio php file and how to test for the logon variable?

rgds
stu
XimeX
Developer
Beiträge: 1148
Registriert: 12. Jul 2015, 13:21
Wohnort: Austria

Re: User Logged In Cookie

Beitrag von XimeX »

Which Admidio version are we talking about? It should work to include the common.php in other projects. Could you post the php error message?
stub
Beiträge: 8
Registriert: 15. Apr 2017, 06:41

Re: User Logged In Cookie

Beitrag von stub »

This is what my programmer said....

The error I was getting was Error HTTP 500, but I was able to include the common.php file from another file (previously I was including it directly in the template file and was getting that error, now I tried including it from the inner workings file of the details page and I'm no longer getting the error).

But when I try to click on the BuyNow button I'm still getting the popup that I need to be registered to buy the product. Even though I am logged in. I supposed there could be a multitude of reasons for this. But let's first rule out that I am receiving the $gValidLogin variable. Where do you send it to on my system, and how should the programmer look it up?

rgds
stu
stub
Beiträge: 8
Registriert: 15. Apr 2017, 06:41

Re: User Logged In Cookie

Beitrag von stub »

Sorry. I'm using the latest version of admidio. v3.2.8
Benutzeravatar
fasse
Administrator
Beiträge: 6182
Registriert: 12. Nov 2005, 16:06

Re: User Logged In Cookie

Beitrag von fasse »

Hi Stub,

here an example. You have your own buysomething.php script.

Now you include the common.php and after that you have access in that file to $gValidLogin.

Code: Alles auswählen

<?php
include('admidio/adm_program/system/common.php'); // maybe another path in your system

... other code ...

if($gValidLogin)
{
	... only code if you have a valid admidio login ...
}
Maybe that helps a little ...
stub
Beiträge: 8
Registriert: 15. Apr 2017, 06:41

Re: User Logged In Cookie

Beitrag von stub »

Hi Fasse,

Not to me. But it might to my programer :)

Please forgive me for asking an additional question. But the reason for this might be critical (for me). Because what I'm trying to achieve is this. Let's say there are five visitors to my website, which has thousands of domains for sale, or make offer. They all decide to buy a domain within say a five minute period. How do I decide which of these are logged in and can proceed to buy a domain and which ones need to be redirected to Admidio for Registration or Login. To me. As a non-programer. It seems there might be some kind of disconnect, where the login variable might get used by the wrong user. Or is that some kind of just crazy thinking? Or if it's not just crazy thinking, is there a workaround for this?

To put it another way. If the variable is going to the visitor's computer, I suppose everything is fine, provided we are checking their computer for this variable. Is that what we are doing when we are checking for the login variable?

My programer appears to be having variable success checking this login variable. Sometimes it works sometimes it doesn't. Sometimes even an http 500 error. For me. When I try it. I login to Adminio, go to buy a domain, but my system never lets me pass that check. Which could be for a multitude of reasons. I've asked him to come on here. But so far he hasn't agreed. (I keep him busy).

rgds
stu
Benutzeravatar
fasse
Administrator
Beiträge: 6182
Registriert: 12. Nov 2005, 16:06

Re: User Logged In Cookie

Beitrag von fasse »

If you have several users on your website than the webserver will manage this. Every user get a single session and within this session the script will check the variable. So there will be no problem.
Antworten