php script sometimes receives post data sometimes not. It seems a cache problem











up vote
1
down vote

favorite












I am submitting post data from a HTML form (using javascript to validate the form) to a php script



Several hours ago I realized I was sending empty data so I fixed this problem and now I am still not receiving the post data in the server side even though I am sending it.



When I echo the post variables on the server side I can see the variables echoed when I remove the echo it keeps telling me "No login information". I tried to comment/uncomment the echo several times and it keeps showing the same problem. It seems some kind of cache.



I tried to disable cache using clearstatcache(); and



header("Content-Type: text/html");

header("Expires: 0");

header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");

header("Cache-Control: no-store, no-cache, must-revalidate");

header("Cache-Control: post-check=0, pre-check=0", false);

header("Pragma: no-cache");


It does not work. Maybe it is some kind of cache from the html form side, apparently it keeps sending the wrong (empty) data.



When I remove the "no login information" part, it tells me "user does not exist" as when the login info is really missing.



I need to add that this code has been working well for years. I did not change it , besides the first lines for preventing to cache (but this was after the problem appeared). The new code was the html form which is calling this php code.
Part of php code follows



<?php
clearstatcache();
header("Content-Type: text/html");
header("Expires: 0");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
include("conexion/conexion.php");

//$form_password=$_GET['form_password'];
//$form_email=$_GET['form_email'];
$form_password=$_POST['form_password'];
$form_email=$_POST['form_email'];

//echo "form_password=$form_password";
//echo "form_email=$form_email";



function autentificar(){

global $form_email,$form_password;

echo "form_password=$form_password";
echo "form_email=$form_email";

//exit();
$mensaje=1;

if($form_email=='' || $form_password=='')
{
$mensaje="No login information";
//echo "form_password=$form_password";
//echo "form_email=$form_email";
}
else
{
$con=openDB();
if(!$con)
{
$mensaje="Database connection not opened";
//exit();
}
else
{

$query="SELECT USERCODE,NAME,AES_DECRYPT(UNHEX(PASSWORD),UNHEX(SHA2('babel',512))) ,USERTYPE,BALANCE,ACTIVELESSONSTATUS,ACTIVELESSONCODEVAR FROM USERS WHERE EMAIL='$form_email'";

//echo "query=$query";
//exit();
//$query="SELECT * FROM usuario ";
$resultado=genesis_exec($con,$query);
//$resultado=mysql_query($query,$con);


if(!$resultado)
{
$mensaje="Error en la sentencia SQL";
echo "Sentencia: $query <br>";
echo "Error: ".mysql_error();
closeDB($con);
exit();
}
else
{
$fila=genesis_fetch_row($resultado);

if(!$fila)
{
$mensaje="User does not exist";
}
else
{
$user=genesis_result($resultado,1);
$name=genesis_result($resultado,2);
$p=genesis_result($resultado,3);
$type=genesis_result($resultado,4);
$balance=genesis_result($resultado,5);
$status=genesis_result($resultado,6);
$lesson=genesis_result($resultado,7);
if($p!=$form_password)
{
$mensaje="Incorrect password";

/*echo "user=$user";
echo "name=$name";
echo "p=$p";
echo "type=$type";

echo "$mensaje";
exit();*/
}
else
{
//AQUI ABRE LA SESION
//para abrir sesion y usar Header no se debe haber hecho ninguna salida
session_start(); //aqui se abre la sesion por primera vez
$SESION=session_id();

$query="UPDATE USERS SET SESSIONID='$SESION' WHERE USERCODE='$user'";
$resultado=genesis_exec($con,$query);
//Aqui registra las variables de sesion
$_SESSION['TIPO_USUARIO']=$type; //usar esto si register_globals=off
$_SESSION['COD_USUARIO']=$user; //usar esto si register_globals=off
$_SESSION['NOMBRE_USUARIO']=$name;
$_SESSION['BALANCE']=$balance;
$_SESSION['ACTIVE_LESSONSTATUS']=$status;
$_SESSION['LESSON_CODEVAR']=$lesson;
$mensaje=1; //solo devuelve 1 si el usuario se autentificó con éxito
if($pagina=="" && $type=="STUDENT") $pagina="lesson.htm"; //valor por defecto
if($pagina=="" && $type!="STUDENT") $pagina="opportunities.htm"; //valor por defecto

}
}
}
genesis_commit($con);
closeDB($con);
}

}

return $mensaje;
}//fin autentificar()


part of the client side code follows



<form id="sky-form" class="sky-form" method="post" onsubmit="return validate()" action="login.php">
<header>Login form</header>

<fieldset>
<section>
<div class="row">
<label class="label col col-4">E-mail</label>
<div class="col col-8">
<label class="input">
<i class="icon-append icon-user"></i>
<input type="email" name="form_email" id="form_email">
</label>
</div>
</div>
</section>

<section>
<div class="row">
<label class="label col col-4">Password</label>
<div class="col col-8">
<label class="input">
<i class="icon-append icon-lock"></i>
<input type="password" name="form_password" id="form_password">
</label>
<div class="note"><a href="#sky-form2" class="modal-opener">Forgot password?</a></div>
</div>
</div>
</section>
<!--
<section>
<div class="row">
<div class="col col-4"></div>
<div class="col col-8">
<label class="checkbox"><input type="checkbox" name="remember" checked><i></i>Keep me logged in</label>
</div>
</div>
</section>
-->
</fieldset>
<footer>
<div class="fright">
<a href="register.html" class="button button-secondary">Register</a>
<button type="submit" class="button">Log in</button>
</div>

</footer>
</form>


and the validation function is following



<script type="text/javascript">
function validate()
{
//alert('validate');
if(document.getElementById("form_email").value=='')
{
alert('Enter the email');
return false;
}

if(document.getElementById("form_password").value=='')
{
alert('Enter the password');
return false;
}
//alert(document.getElementById("form_email").value);
//alert(document.getElementById("form_password").value);
return true;
}
</script>


I need to say that all started when in fact I was not sending the data due to an issue with the form and javascript. But I am confident now I am sending the data Because when I echo the post data in the server side it shows the data when I do not echo the data it says "no login information"



IMPORTANT UPDATE: I deleted the file login.php from server and I am still getting the message "No login information" from server. What is going on ? Please help










share|improve this question









New contributor




Jorge Chavez Salas is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • I can't think of any thing that would be caching your POST data between your HTML form and your PHP script. I suspect there's an error with the rest of your PHP and you're erroneously printing No login information despite actually having login information. Could you edit your question to include more of your PHP script (at the very least, the entirety of authentificar())?
    – HPierce
    Nov 17 at 3:35












  • I added more information/code, thanks
    – Jorge Chavez Salas
    Nov 17 at 4:28










  • UPDATE: I deleted the file login.php from server and I am still getting the message "No login information" from server. What is going on ? Please help
    – Jorge Chavez Salas
    Nov 17 at 19:38










  • The PHP script in its entirety looks reasonable. I don't see a way that you'd get "No login information" if the form submission was successful. But it sounds like you're past that at this point. If you've deleted login.php and you're still getting the message... you're missing something significant. and unfortunately, without that critical piece to the puzzle, we aren't going to be able to help :(. If I were you, I would check that the webserver settings are correct, and figure out if the webserver is using /var/web/login.php, but you deleted /home/me/web/login.php (or whatever)
    – HPierce
    Nov 18 at 1:41










  • Thanks for trying. I merged both files in one single file And it works now.
    – Jorge Chavez Salas
    Nov 18 at 4:28















up vote
1
down vote

favorite












I am submitting post data from a HTML form (using javascript to validate the form) to a php script



Several hours ago I realized I was sending empty data so I fixed this problem and now I am still not receiving the post data in the server side even though I am sending it.



When I echo the post variables on the server side I can see the variables echoed when I remove the echo it keeps telling me "No login information". I tried to comment/uncomment the echo several times and it keeps showing the same problem. It seems some kind of cache.



I tried to disable cache using clearstatcache(); and



header("Content-Type: text/html");

header("Expires: 0");

header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");

header("Cache-Control: no-store, no-cache, must-revalidate");

header("Cache-Control: post-check=0, pre-check=0", false);

header("Pragma: no-cache");


It does not work. Maybe it is some kind of cache from the html form side, apparently it keeps sending the wrong (empty) data.



When I remove the "no login information" part, it tells me "user does not exist" as when the login info is really missing.



I need to add that this code has been working well for years. I did not change it , besides the first lines for preventing to cache (but this was after the problem appeared). The new code was the html form which is calling this php code.
Part of php code follows



<?php
clearstatcache();
header("Content-Type: text/html");
header("Expires: 0");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
include("conexion/conexion.php");

//$form_password=$_GET['form_password'];
//$form_email=$_GET['form_email'];
$form_password=$_POST['form_password'];
$form_email=$_POST['form_email'];

//echo "form_password=$form_password";
//echo "form_email=$form_email";



function autentificar(){

global $form_email,$form_password;

echo "form_password=$form_password";
echo "form_email=$form_email";

//exit();
$mensaje=1;

if($form_email=='' || $form_password=='')
{
$mensaje="No login information";
//echo "form_password=$form_password";
//echo "form_email=$form_email";
}
else
{
$con=openDB();
if(!$con)
{
$mensaje="Database connection not opened";
//exit();
}
else
{

$query="SELECT USERCODE,NAME,AES_DECRYPT(UNHEX(PASSWORD),UNHEX(SHA2('babel',512))) ,USERTYPE,BALANCE,ACTIVELESSONSTATUS,ACTIVELESSONCODEVAR FROM USERS WHERE EMAIL='$form_email'";

//echo "query=$query";
//exit();
//$query="SELECT * FROM usuario ";
$resultado=genesis_exec($con,$query);
//$resultado=mysql_query($query,$con);


if(!$resultado)
{
$mensaje="Error en la sentencia SQL";
echo "Sentencia: $query <br>";
echo "Error: ".mysql_error();
closeDB($con);
exit();
}
else
{
$fila=genesis_fetch_row($resultado);

if(!$fila)
{
$mensaje="User does not exist";
}
else
{
$user=genesis_result($resultado,1);
$name=genesis_result($resultado,2);
$p=genesis_result($resultado,3);
$type=genesis_result($resultado,4);
$balance=genesis_result($resultado,5);
$status=genesis_result($resultado,6);
$lesson=genesis_result($resultado,7);
if($p!=$form_password)
{
$mensaje="Incorrect password";

/*echo "user=$user";
echo "name=$name";
echo "p=$p";
echo "type=$type";

echo "$mensaje";
exit();*/
}
else
{
//AQUI ABRE LA SESION
//para abrir sesion y usar Header no se debe haber hecho ninguna salida
session_start(); //aqui se abre la sesion por primera vez
$SESION=session_id();

$query="UPDATE USERS SET SESSIONID='$SESION' WHERE USERCODE='$user'";
$resultado=genesis_exec($con,$query);
//Aqui registra las variables de sesion
$_SESSION['TIPO_USUARIO']=$type; //usar esto si register_globals=off
$_SESSION['COD_USUARIO']=$user; //usar esto si register_globals=off
$_SESSION['NOMBRE_USUARIO']=$name;
$_SESSION['BALANCE']=$balance;
$_SESSION['ACTIVE_LESSONSTATUS']=$status;
$_SESSION['LESSON_CODEVAR']=$lesson;
$mensaje=1; //solo devuelve 1 si el usuario se autentificó con éxito
if($pagina=="" && $type=="STUDENT") $pagina="lesson.htm"; //valor por defecto
if($pagina=="" && $type!="STUDENT") $pagina="opportunities.htm"; //valor por defecto

}
}
}
genesis_commit($con);
closeDB($con);
}

}

return $mensaje;
}//fin autentificar()


part of the client side code follows



<form id="sky-form" class="sky-form" method="post" onsubmit="return validate()" action="login.php">
<header>Login form</header>

<fieldset>
<section>
<div class="row">
<label class="label col col-4">E-mail</label>
<div class="col col-8">
<label class="input">
<i class="icon-append icon-user"></i>
<input type="email" name="form_email" id="form_email">
</label>
</div>
</div>
</section>

<section>
<div class="row">
<label class="label col col-4">Password</label>
<div class="col col-8">
<label class="input">
<i class="icon-append icon-lock"></i>
<input type="password" name="form_password" id="form_password">
</label>
<div class="note"><a href="#sky-form2" class="modal-opener">Forgot password?</a></div>
</div>
</div>
</section>
<!--
<section>
<div class="row">
<div class="col col-4"></div>
<div class="col col-8">
<label class="checkbox"><input type="checkbox" name="remember" checked><i></i>Keep me logged in</label>
</div>
</div>
</section>
-->
</fieldset>
<footer>
<div class="fright">
<a href="register.html" class="button button-secondary">Register</a>
<button type="submit" class="button">Log in</button>
</div>

</footer>
</form>


and the validation function is following



<script type="text/javascript">
function validate()
{
//alert('validate');
if(document.getElementById("form_email").value=='')
{
alert('Enter the email');
return false;
}

if(document.getElementById("form_password").value=='')
{
alert('Enter the password');
return false;
}
//alert(document.getElementById("form_email").value);
//alert(document.getElementById("form_password").value);
return true;
}
</script>


I need to say that all started when in fact I was not sending the data due to an issue with the form and javascript. But I am confident now I am sending the data Because when I echo the post data in the server side it shows the data when I do not echo the data it says "no login information"



IMPORTANT UPDATE: I deleted the file login.php from server and I am still getting the message "No login information" from server. What is going on ? Please help










share|improve this question









New contributor




Jorge Chavez Salas is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.




















  • I can't think of any thing that would be caching your POST data between your HTML form and your PHP script. I suspect there's an error with the rest of your PHP and you're erroneously printing No login information despite actually having login information. Could you edit your question to include more of your PHP script (at the very least, the entirety of authentificar())?
    – HPierce
    Nov 17 at 3:35












  • I added more information/code, thanks
    – Jorge Chavez Salas
    Nov 17 at 4:28










  • UPDATE: I deleted the file login.php from server and I am still getting the message "No login information" from server. What is going on ? Please help
    – Jorge Chavez Salas
    Nov 17 at 19:38










  • The PHP script in its entirety looks reasonable. I don't see a way that you'd get "No login information" if the form submission was successful. But it sounds like you're past that at this point. If you've deleted login.php and you're still getting the message... you're missing something significant. and unfortunately, without that critical piece to the puzzle, we aren't going to be able to help :(. If I were you, I would check that the webserver settings are correct, and figure out if the webserver is using /var/web/login.php, but you deleted /home/me/web/login.php (or whatever)
    – HPierce
    Nov 18 at 1:41










  • Thanks for trying. I merged both files in one single file And it works now.
    – Jorge Chavez Salas
    Nov 18 at 4:28













up vote
1
down vote

favorite









up vote
1
down vote

favorite











I am submitting post data from a HTML form (using javascript to validate the form) to a php script



Several hours ago I realized I was sending empty data so I fixed this problem and now I am still not receiving the post data in the server side even though I am sending it.



When I echo the post variables on the server side I can see the variables echoed when I remove the echo it keeps telling me "No login information". I tried to comment/uncomment the echo several times and it keeps showing the same problem. It seems some kind of cache.



I tried to disable cache using clearstatcache(); and



header("Content-Type: text/html");

header("Expires: 0");

header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");

header("Cache-Control: no-store, no-cache, must-revalidate");

header("Cache-Control: post-check=0, pre-check=0", false);

header("Pragma: no-cache");


It does not work. Maybe it is some kind of cache from the html form side, apparently it keeps sending the wrong (empty) data.



When I remove the "no login information" part, it tells me "user does not exist" as when the login info is really missing.



I need to add that this code has been working well for years. I did not change it , besides the first lines for preventing to cache (but this was after the problem appeared). The new code was the html form which is calling this php code.
Part of php code follows



<?php
clearstatcache();
header("Content-Type: text/html");
header("Expires: 0");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
include("conexion/conexion.php");

//$form_password=$_GET['form_password'];
//$form_email=$_GET['form_email'];
$form_password=$_POST['form_password'];
$form_email=$_POST['form_email'];

//echo "form_password=$form_password";
//echo "form_email=$form_email";



function autentificar(){

global $form_email,$form_password;

echo "form_password=$form_password";
echo "form_email=$form_email";

//exit();
$mensaje=1;

if($form_email=='' || $form_password=='')
{
$mensaje="No login information";
//echo "form_password=$form_password";
//echo "form_email=$form_email";
}
else
{
$con=openDB();
if(!$con)
{
$mensaje="Database connection not opened";
//exit();
}
else
{

$query="SELECT USERCODE,NAME,AES_DECRYPT(UNHEX(PASSWORD),UNHEX(SHA2('babel',512))) ,USERTYPE,BALANCE,ACTIVELESSONSTATUS,ACTIVELESSONCODEVAR FROM USERS WHERE EMAIL='$form_email'";

//echo "query=$query";
//exit();
//$query="SELECT * FROM usuario ";
$resultado=genesis_exec($con,$query);
//$resultado=mysql_query($query,$con);


if(!$resultado)
{
$mensaje="Error en la sentencia SQL";
echo "Sentencia: $query <br>";
echo "Error: ".mysql_error();
closeDB($con);
exit();
}
else
{
$fila=genesis_fetch_row($resultado);

if(!$fila)
{
$mensaje="User does not exist";
}
else
{
$user=genesis_result($resultado,1);
$name=genesis_result($resultado,2);
$p=genesis_result($resultado,3);
$type=genesis_result($resultado,4);
$balance=genesis_result($resultado,5);
$status=genesis_result($resultado,6);
$lesson=genesis_result($resultado,7);
if($p!=$form_password)
{
$mensaje="Incorrect password";

/*echo "user=$user";
echo "name=$name";
echo "p=$p";
echo "type=$type";

echo "$mensaje";
exit();*/
}
else
{
//AQUI ABRE LA SESION
//para abrir sesion y usar Header no se debe haber hecho ninguna salida
session_start(); //aqui se abre la sesion por primera vez
$SESION=session_id();

$query="UPDATE USERS SET SESSIONID='$SESION' WHERE USERCODE='$user'";
$resultado=genesis_exec($con,$query);
//Aqui registra las variables de sesion
$_SESSION['TIPO_USUARIO']=$type; //usar esto si register_globals=off
$_SESSION['COD_USUARIO']=$user; //usar esto si register_globals=off
$_SESSION['NOMBRE_USUARIO']=$name;
$_SESSION['BALANCE']=$balance;
$_SESSION['ACTIVE_LESSONSTATUS']=$status;
$_SESSION['LESSON_CODEVAR']=$lesson;
$mensaje=1; //solo devuelve 1 si el usuario se autentificó con éxito
if($pagina=="" && $type=="STUDENT") $pagina="lesson.htm"; //valor por defecto
if($pagina=="" && $type!="STUDENT") $pagina="opportunities.htm"; //valor por defecto

}
}
}
genesis_commit($con);
closeDB($con);
}

}

return $mensaje;
}//fin autentificar()


part of the client side code follows



<form id="sky-form" class="sky-form" method="post" onsubmit="return validate()" action="login.php">
<header>Login form</header>

<fieldset>
<section>
<div class="row">
<label class="label col col-4">E-mail</label>
<div class="col col-8">
<label class="input">
<i class="icon-append icon-user"></i>
<input type="email" name="form_email" id="form_email">
</label>
</div>
</div>
</section>

<section>
<div class="row">
<label class="label col col-4">Password</label>
<div class="col col-8">
<label class="input">
<i class="icon-append icon-lock"></i>
<input type="password" name="form_password" id="form_password">
</label>
<div class="note"><a href="#sky-form2" class="modal-opener">Forgot password?</a></div>
</div>
</div>
</section>
<!--
<section>
<div class="row">
<div class="col col-4"></div>
<div class="col col-8">
<label class="checkbox"><input type="checkbox" name="remember" checked><i></i>Keep me logged in</label>
</div>
</div>
</section>
-->
</fieldset>
<footer>
<div class="fright">
<a href="register.html" class="button button-secondary">Register</a>
<button type="submit" class="button">Log in</button>
</div>

</footer>
</form>


and the validation function is following



<script type="text/javascript">
function validate()
{
//alert('validate');
if(document.getElementById("form_email").value=='')
{
alert('Enter the email');
return false;
}

if(document.getElementById("form_password").value=='')
{
alert('Enter the password');
return false;
}
//alert(document.getElementById("form_email").value);
//alert(document.getElementById("form_password").value);
return true;
}
</script>


I need to say that all started when in fact I was not sending the data due to an issue with the form and javascript. But I am confident now I am sending the data Because when I echo the post data in the server side it shows the data when I do not echo the data it says "no login information"



IMPORTANT UPDATE: I deleted the file login.php from server and I am still getting the message "No login information" from server. What is going on ? Please help










share|improve this question









New contributor




Jorge Chavez Salas is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











I am submitting post data from a HTML form (using javascript to validate the form) to a php script



Several hours ago I realized I was sending empty data so I fixed this problem and now I am still not receiving the post data in the server side even though I am sending it.



When I echo the post variables on the server side I can see the variables echoed when I remove the echo it keeps telling me "No login information". I tried to comment/uncomment the echo several times and it keeps showing the same problem. It seems some kind of cache.



I tried to disable cache using clearstatcache(); and



header("Content-Type: text/html");

header("Expires: 0");

header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");

header("Cache-Control: no-store, no-cache, must-revalidate");

header("Cache-Control: post-check=0, pre-check=0", false);

header("Pragma: no-cache");


It does not work. Maybe it is some kind of cache from the html form side, apparently it keeps sending the wrong (empty) data.



When I remove the "no login information" part, it tells me "user does not exist" as when the login info is really missing.



I need to add that this code has been working well for years. I did not change it , besides the first lines for preventing to cache (but this was after the problem appeared). The new code was the html form which is calling this php code.
Part of php code follows



<?php
clearstatcache();
header("Content-Type: text/html");
header("Expires: 0");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
include("conexion/conexion.php");

//$form_password=$_GET['form_password'];
//$form_email=$_GET['form_email'];
$form_password=$_POST['form_password'];
$form_email=$_POST['form_email'];

//echo "form_password=$form_password";
//echo "form_email=$form_email";



function autentificar(){

global $form_email,$form_password;

echo "form_password=$form_password";
echo "form_email=$form_email";

//exit();
$mensaje=1;

if($form_email=='' || $form_password=='')
{
$mensaje="No login information";
//echo "form_password=$form_password";
//echo "form_email=$form_email";
}
else
{
$con=openDB();
if(!$con)
{
$mensaje="Database connection not opened";
//exit();
}
else
{

$query="SELECT USERCODE,NAME,AES_DECRYPT(UNHEX(PASSWORD),UNHEX(SHA2('babel',512))) ,USERTYPE,BALANCE,ACTIVELESSONSTATUS,ACTIVELESSONCODEVAR FROM USERS WHERE EMAIL='$form_email'";

//echo "query=$query";
//exit();
//$query="SELECT * FROM usuario ";
$resultado=genesis_exec($con,$query);
//$resultado=mysql_query($query,$con);


if(!$resultado)
{
$mensaje="Error en la sentencia SQL";
echo "Sentencia: $query <br>";
echo "Error: ".mysql_error();
closeDB($con);
exit();
}
else
{
$fila=genesis_fetch_row($resultado);

if(!$fila)
{
$mensaje="User does not exist";
}
else
{
$user=genesis_result($resultado,1);
$name=genesis_result($resultado,2);
$p=genesis_result($resultado,3);
$type=genesis_result($resultado,4);
$balance=genesis_result($resultado,5);
$status=genesis_result($resultado,6);
$lesson=genesis_result($resultado,7);
if($p!=$form_password)
{
$mensaje="Incorrect password";

/*echo "user=$user";
echo "name=$name";
echo "p=$p";
echo "type=$type";

echo "$mensaje";
exit();*/
}
else
{
//AQUI ABRE LA SESION
//para abrir sesion y usar Header no se debe haber hecho ninguna salida
session_start(); //aqui se abre la sesion por primera vez
$SESION=session_id();

$query="UPDATE USERS SET SESSIONID='$SESION' WHERE USERCODE='$user'";
$resultado=genesis_exec($con,$query);
//Aqui registra las variables de sesion
$_SESSION['TIPO_USUARIO']=$type; //usar esto si register_globals=off
$_SESSION['COD_USUARIO']=$user; //usar esto si register_globals=off
$_SESSION['NOMBRE_USUARIO']=$name;
$_SESSION['BALANCE']=$balance;
$_SESSION['ACTIVE_LESSONSTATUS']=$status;
$_SESSION['LESSON_CODEVAR']=$lesson;
$mensaje=1; //solo devuelve 1 si el usuario se autentificó con éxito
if($pagina=="" && $type=="STUDENT") $pagina="lesson.htm"; //valor por defecto
if($pagina=="" && $type!="STUDENT") $pagina="opportunities.htm"; //valor por defecto

}
}
}
genesis_commit($con);
closeDB($con);
}

}

return $mensaje;
}//fin autentificar()


part of the client side code follows



<form id="sky-form" class="sky-form" method="post" onsubmit="return validate()" action="login.php">
<header>Login form</header>

<fieldset>
<section>
<div class="row">
<label class="label col col-4">E-mail</label>
<div class="col col-8">
<label class="input">
<i class="icon-append icon-user"></i>
<input type="email" name="form_email" id="form_email">
</label>
</div>
</div>
</section>

<section>
<div class="row">
<label class="label col col-4">Password</label>
<div class="col col-8">
<label class="input">
<i class="icon-append icon-lock"></i>
<input type="password" name="form_password" id="form_password">
</label>
<div class="note"><a href="#sky-form2" class="modal-opener">Forgot password?</a></div>
</div>
</div>
</section>
<!--
<section>
<div class="row">
<div class="col col-4"></div>
<div class="col col-8">
<label class="checkbox"><input type="checkbox" name="remember" checked><i></i>Keep me logged in</label>
</div>
</div>
</section>
-->
</fieldset>
<footer>
<div class="fright">
<a href="register.html" class="button button-secondary">Register</a>
<button type="submit" class="button">Log in</button>
</div>

</footer>
</form>


and the validation function is following



<script type="text/javascript">
function validate()
{
//alert('validate');
if(document.getElementById("form_email").value=='')
{
alert('Enter the email');
return false;
}

if(document.getElementById("form_password").value=='')
{
alert('Enter the password');
return false;
}
//alert(document.getElementById("form_email").value);
//alert(document.getElementById("form_password").value);
return true;
}
</script>


I need to say that all started when in fact I was not sending the data due to an issue with the form and javascript. But I am confident now I am sending the data Because when I echo the post data in the server side it shows the data when I do not echo the data it says "no login information"



IMPORTANT UPDATE: I deleted the file login.php from server and I am still getting the message "No login information" from server. What is going on ? Please help







php






share|improve this question









New contributor




Jorge Chavez Salas is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question









New contributor




Jorge Chavez Salas is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question








edited Nov 17 at 19:40





















New contributor




Jorge Chavez Salas is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Nov 17 at 3:27









Jorge Chavez Salas

92




92




New contributor




Jorge Chavez Salas is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Jorge Chavez Salas is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Jorge Chavez Salas is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.












  • I can't think of any thing that would be caching your POST data between your HTML form and your PHP script. I suspect there's an error with the rest of your PHP and you're erroneously printing No login information despite actually having login information. Could you edit your question to include more of your PHP script (at the very least, the entirety of authentificar())?
    – HPierce
    Nov 17 at 3:35












  • I added more information/code, thanks
    – Jorge Chavez Salas
    Nov 17 at 4:28










  • UPDATE: I deleted the file login.php from server and I am still getting the message "No login information" from server. What is going on ? Please help
    – Jorge Chavez Salas
    Nov 17 at 19:38










  • The PHP script in its entirety looks reasonable. I don't see a way that you'd get "No login information" if the form submission was successful. But it sounds like you're past that at this point. If you've deleted login.php and you're still getting the message... you're missing something significant. and unfortunately, without that critical piece to the puzzle, we aren't going to be able to help :(. If I were you, I would check that the webserver settings are correct, and figure out if the webserver is using /var/web/login.php, but you deleted /home/me/web/login.php (or whatever)
    – HPierce
    Nov 18 at 1:41










  • Thanks for trying. I merged both files in one single file And it works now.
    – Jorge Chavez Salas
    Nov 18 at 4:28


















  • I can't think of any thing that would be caching your POST data between your HTML form and your PHP script. I suspect there's an error with the rest of your PHP and you're erroneously printing No login information despite actually having login information. Could you edit your question to include more of your PHP script (at the very least, the entirety of authentificar())?
    – HPierce
    Nov 17 at 3:35












  • I added more information/code, thanks
    – Jorge Chavez Salas
    Nov 17 at 4:28










  • UPDATE: I deleted the file login.php from server and I am still getting the message "No login information" from server. What is going on ? Please help
    – Jorge Chavez Salas
    Nov 17 at 19:38










  • The PHP script in its entirety looks reasonable. I don't see a way that you'd get "No login information" if the form submission was successful. But it sounds like you're past that at this point. If you've deleted login.php and you're still getting the message... you're missing something significant. and unfortunately, without that critical piece to the puzzle, we aren't going to be able to help :(. If I were you, I would check that the webserver settings are correct, and figure out if the webserver is using /var/web/login.php, but you deleted /home/me/web/login.php (or whatever)
    – HPierce
    Nov 18 at 1:41










  • Thanks for trying. I merged both files in one single file And it works now.
    – Jorge Chavez Salas
    Nov 18 at 4:28
















I can't think of any thing that would be caching your POST data between your HTML form and your PHP script. I suspect there's an error with the rest of your PHP and you're erroneously printing No login information despite actually having login information. Could you edit your question to include more of your PHP script (at the very least, the entirety of authentificar())?
– HPierce
Nov 17 at 3:35






I can't think of any thing that would be caching your POST data between your HTML form and your PHP script. I suspect there's an error with the rest of your PHP and you're erroneously printing No login information despite actually having login information. Could you edit your question to include more of your PHP script (at the very least, the entirety of authentificar())?
– HPierce
Nov 17 at 3:35














I added more information/code, thanks
– Jorge Chavez Salas
Nov 17 at 4:28




I added more information/code, thanks
– Jorge Chavez Salas
Nov 17 at 4:28












UPDATE: I deleted the file login.php from server and I am still getting the message "No login information" from server. What is going on ? Please help
– Jorge Chavez Salas
Nov 17 at 19:38




UPDATE: I deleted the file login.php from server and I am still getting the message "No login information" from server. What is going on ? Please help
– Jorge Chavez Salas
Nov 17 at 19:38












The PHP script in its entirety looks reasonable. I don't see a way that you'd get "No login information" if the form submission was successful. But it sounds like you're past that at this point. If you've deleted login.php and you're still getting the message... you're missing something significant. and unfortunately, without that critical piece to the puzzle, we aren't going to be able to help :(. If I were you, I would check that the webserver settings are correct, and figure out if the webserver is using /var/web/login.php, but you deleted /home/me/web/login.php (or whatever)
– HPierce
Nov 18 at 1:41




The PHP script in its entirety looks reasonable. I don't see a way that you'd get "No login information" if the form submission was successful. But it sounds like you're past that at this point. If you've deleted login.php and you're still getting the message... you're missing something significant. and unfortunately, without that critical piece to the puzzle, we aren't going to be able to help :(. If I were you, I would check that the webserver settings are correct, and figure out if the webserver is using /var/web/login.php, but you deleted /home/me/web/login.php (or whatever)
– HPierce
Nov 18 at 1:41












Thanks for trying. I merged both files in one single file And it works now.
– Jorge Chavez Salas
Nov 18 at 4:28




Thanks for trying. I merged both files in one single file And it works now.
– Jorge Chavez Salas
Nov 18 at 4:28












1 Answer
1






active

oldest

votes

















up vote
0
down vote













I had to merge both files in one single file and it works now






share|improve this answer








New contributor




Jorge Chavez Salas is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.


















    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });






    Jorge Chavez Salas is a new contributor. Be nice, and check out our Code of Conduct.










     

    draft saved


    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53347907%2fphp-script-sometimes-receives-post-data-sometimes-not-it-seems-a-cache-problem%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    I had to merge both files in one single file and it works now






    share|improve this answer








    New contributor




    Jorge Chavez Salas is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      up vote
      0
      down vote













      I had to merge both files in one single file and it works now






      share|improve this answer








      New contributor




      Jorge Chavez Salas is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.




















        up vote
        0
        down vote










        up vote
        0
        down vote









        I had to merge both files in one single file and it works now






        share|improve this answer








        New contributor




        Jorge Chavez Salas is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        I had to merge both files in one single file and it works now







        share|improve this answer








        New contributor




        Jorge Chavez Salas is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        share|improve this answer



        share|improve this answer






        New contributor




        Jorge Chavez Salas is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.









        answered Nov 18 at 4:30









        Jorge Chavez Salas

        92




        92




        New contributor




        Jorge Chavez Salas is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.





        New contributor





        Jorge Chavez Salas is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






        Jorge Chavez Salas is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
        Check out our Code of Conduct.






















            Jorge Chavez Salas is a new contributor. Be nice, and check out our Code of Conduct.










             

            draft saved


            draft discarded


















            Jorge Chavez Salas is a new contributor. Be nice, and check out our Code of Conduct.













            Jorge Chavez Salas is a new contributor. Be nice, and check out our Code of Conduct.












            Jorge Chavez Salas is a new contributor. Be nice, and check out our Code of Conduct.















             


            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53347907%2fphp-script-sometimes-receives-post-data-sometimes-not-it-seems-a-cache-problem%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Costa Masnaga

            Fotorealismo

            Sidney Franklin