Problem: Session does not work on some browsers / PCs

0

Hello,

I would like some guidance, or the direction of the path that I must follow to solve my problem.

I'm having trouble with the Session on some PCs and phones.

For example:

PC-A (Ubuntu): works

PC-B (Win7): works

PC-C (WinXP): DOES NOT work

cell-D (android): DOES NOT work

Follow the source codes of what I'm testing:

[index.html]

[CODE]

<html>
<head>
<title>FORM</title>
</head>
<body>

<form action="salvar.php" method="post">
Nome<br />
<input type="text" name="nome" /><br />
E-mail<br />
<input type="text" name="email" /><br /><br />
<input type="submit" value="Enviar" />
</form>

</body>
</html>

[/ CODE]

[save.php]

[CODE]

<?php
// iniciar a session
session_start();

// pegando os dados do input

// para pegar o valor do input nome
$nome = $_POST['nome'];

// colocando a variavel nome na session
$_SESSION['nome'] = $nome;

// para pegar o valor do input nome
$email = $_POST['email'];

// colocando a variavel email na session
$_SESSION['email'] = $email;

// vamos imprimir os valores dgitados dos campos na pagina

echo "Nome: $nome<br />";
echo "E-mail: $email<br />";
?>

[/ CODE]

[test.php]

[CODE]

<?php
// vamos iniciar a session
session_start();

// vamos imprimir a variavel nome
echo $_SESSION['nome'] . '<br />';

// vamos imprimir a variavel email
echo $_SESSION['email'];

?>

[/ CODE]

In summary, I first populate the data in index.html, it directs me to the salva.php and the data appears. So far it works everywhere I tested.

Now if I open test.php on PCs A and B the data stored by the Session will appear.

BUT if I open test.php on PC-C or D-cell, the Session did not store variable values.

Any hint of what I should look for / check / search for, or some solution to it.

It's sad to find the bug and can not fix it.

Thank you all.

    
asked by anonymous 20.09.2016 / 20:05

2 answers

0

Check if there is space on the server disk to save the session, I have already experienced a problem like this. See also the PHP documentation for using session_write_close, which forces data to be saved, especially in competing scripts. ( link )

    
20.09.2016 / 21:42
0

Hello,

I tried the session_write_close function, but on PCs that did not work, it still did not work. On the PCs that already worked, it continued to work.

It's strange being a lack of disk space, because if it were, it would not work anywhere.

But what happens is that some PCs work and others do not.

Thanks for the attention, but I'm still looking for more knowledge to solve this.

    
21.09.2016 / 13:53