Can you share your both file code image here?

|
Mayank_theDevloper 2019-06-15 19:09:00
MiguelAngelBC 2019-06-15 15:10:39
So, what’s wrong here?

@MiguelAngelBC try this
If (isset ($_SESSION[‘logged’] ) && $_SESSION[‘logged’] == ‘ok’ ) {
Return true
}
Else
{
Return false
}

2019-06-15 19:14:57
if(empty($_SESSION[“logged”]) || $_SESSION[“logged”] != ‘ok’) then false
Else

True

2019-06-15 19:15:08
Please try that condition
MiguelAngelBC 2019-06-15 19:16:31
It says it’s empty
MiguelAngelBC 2019-06-15 19:16:49
Mayank_theDevloper 2019-06-15 19:09:00
@MiguelAngelBC try this
If (isset ($_SESSION[‘logged’] ) && $_SESSION[‘logged’] == ‘ok’ ) {
Return true
}
Else
{
Return false
}

Ok, will try

MiguelAngelBC 2019-06-15 19:19:59
Mayank_theDevloper 2019-06-15 19:09:00
@MiguelAngelBC try this
If (isset ($_SESSION[‘logged’] ) && $_SESSION[‘logged’] == ‘ok’ ) {
Return true
}
Else
{
Return false
}

This doesn´t work

MiguelAngelBC 2019-06-15 19:21:14
2019-06-15 19:14:57
if(empty($_SESSION[“logged”]) || $_SESSION[“logged”] != ‘ok’) then false
Else

True

This neither work

Mayank_theDevloper 2019-06-15 19:21:26
MiguelAngelBC 2019-06-15 19:19:59
This doesn´t work

Then print $_SESSION ;

Mayank_theDevloper 2019-06-15 19:21:51
And check output
MiguelAngelBC 2019-06-15 19:23:22
array (size=0)
empty
Mayank_theDevloper 2019-06-15 19:23:42
MiguelAngelBC 2019-06-15 19:23:22
array (size=0)
empty

Means session not set

Mayank_theDevloper 2019-06-15 19:25:04
@MiguelAngelBC
Chek this example
https://www.tutorialspoint.com/php/php_login_example.htm

PHP – Login ExampleTutorialspoint
PHP – Login Example, Php login script is used to provide the authentication for our web pages. the Script executes after submitting the user login button.
MiguelAngelBC 2019-06-15 19:25:40
Mayank_theDevloper 2019-06-15 19:23:42
Means session not set

That´s what I think, but don’t know how to solve it

2019-06-15 19:26:27
Try ternary opertor to check
Mayank_theDevloper 2019-06-15 19:28:47
MiguelAngelBC 2019-06-15 19:25:40
That´s what I think, but don’t know how to solve it

Can you share your both file code image here ?

MiguelAngelBC 2019-06-15 19:30:10
Mayank_theDevloper 2019-06-15 19:28:47
Can you share your both file code image here ?

Of course 👍

MiguelAngelBC 2019-06-15 19:30:52
luv_php-4373.jpg

MiguelAngelBC 2019-06-15 19:31:30
luv_php-4374.jpg

MiguelAngelBC 2019-06-15 19:32:13
Don’t take into account all the select part, it works ok, just the session part doesn´t works
Mayank_theDevloper 2019-06-15 19:34:03
@MiguelAngelBC
Can you check $row_cnt is more then 0 ?
MiguelAngelBC 2019-06-15 19:37:02
Yes, it’s more than 0, cuz i’m receiving the JSON with the data selected
2019-06-15 19:38:32
Can you tell what is $_Session[logged] output?
Mayank_theDevloper 2019-06-15 19:39:58
MiguelAngelBC 2019-06-15 19:37:02
Yes, it’s more than 0, cuz i’m receiving the JSON with the data selected

Do one thing simple first file create static session and second file show the session

MiguelAngelBC 2019-06-15 19:51:29
2019-06-15 19:38:32
Can you tell what is $_Session[logged] output?

array (size=0)
empty

MiguelAngelBC 2019-06-15 19:51:46
Mayank_theDevloper 2019-06-15 19:39:58
Do one thing simple first file create static session and second file show the session

Ok, just to see if there works

MiguelAngelBC 2019-06-15 19:55:24
I’ve created these:
MiguelAngelBC 2019-06-15 19:55:27
luv_php-4383.jpg

MiguelAngelBC 2019-06-15 19:55:46
luv_php-4384.jpg

MiguelAngelBC 2019-06-15 19:56:27
And returns true…
2019-06-15 19:56:55
Hello

I am BCA fresher.

I am Looking internship or Training in PHP…

Or Web Designing or development…

Plz… Hire me….

2019-06-15 20:00:38
Try to print session[‘prueba’]
2019-06-15 20:00:47
I am sure it will give erroe
2019-06-15 20:00:50
Error
MiguelAngelBC 2019-06-15 20:02:46
2019-06-15 20:00:38
Try to print session[‘prueba’]

No, it says ok

MiguelAngelBC 2019-06-15 20:03:04
luv_php-4391.jpg

MiguelAngelBC 2019-06-15 20:04:05
MiguelAngelBC 2019-06-15 19:31:30

That’s so fucking strange, so if it works separately, something is going wrong inside the last if

2019-06-15 20:05:18
MiguelAngelBC 2019-06-15 20:03:04

Is it output “ok ” in second file where if condition is stated??

MiguelAngelBC 2019-06-15 20:07:04
2019-06-15 20:05:18
Is it output “ok ” in second file where if condition is stated??

Yes, in the second php, where I say if (isset….. ). If comment that and do an echo $_SESSION[“prueba”]; it says ok, which is the value I set in the first one

MiguelAngelBC 2019-06-15 20:09:12
I’m thinking of another way to check login without sessions in Angular, maybe creating an object or setting some localStorage when login is correct and the checking it instead of $_SESSION
2019-06-15 20:09:47
There is some minor mistake
2019-06-15 20:10:19
Which is currently we all are not catching… I thin
MiguelAngelBC 2019-06-15 20:11:23
Which one?
2019-06-15 20:21:35
MiguelAngelBC 2019-06-15 19:55:46

Is it going in if part?? Here

2019-06-15 20:23:56
MiguelAngelBC 2019-06-15 19:55:46

If you are saying its output is ok here then it surely will go in if part…

MiguelAngelBC 2019-06-15 20:54:50
I’ve been trying things and…
MiguelAngelBC 2019-06-15 20:55:59
If I check the output inside the web it returns false (session not initialized), but if I try it in another window just calling the php, then it returns true
MiguelAngelBC 2019-06-15 20:56:41
So I’ve decided doing it with localStorage as I ain’t got enough time to think of a solution to this
2019-06-16 08:35:27
Hello All
We are looking for a Magento developer who can join immediately
Full time and part time both are required
Reference should be highly appreciated
Job location Indore
Experience required- 1 to 3 years
Salary-no bars for right candidate
Company name- Arbutus Infotech private limited
2019-06-16 08:37:43
Thanks Vijay
2019-06-16 08:38:26
Welcome😊
|