Query field changing abnormally changing with Chrome
I have a project I am working on, it is in a limited access environment on
a LAMP server. The script I am having trouble with updates the database on
page refresh with the logged in user's current page and a timestamp.
However in Chrome, the page variable is being changed to the string
'nopage' The mysql field is a tinytext field with no default set. I
modified the code just for testing and pinpointing the problem:
So on page 'home'
echo $thePage;
//outputs home
$sql_in = "
UPDATE `users`
SET idle='".$config['time']."',
last_page_visit='".$thePage."'
WHERE username='".$row['username']."'
LIMIT 1 ";
echo $sql_in;
outputs:
'UPDATE `users`
SET idle='1375975152',
last_page_visit='home'
WHERE username='Admin'
LIMIT 1'
$dbcnx->query($sql_in );
exit();
Here is the weird thing. The first echo outputs the page correctly, such
as 'home' and the last echo outputs the correct sql with 'home' for the
variable for all browsers (I know, browser should not matter here). But,
when I use Chrome, it always enters the string 'nopage' for the
last_page_visit field in the database. I cannot figure out why it would
echo correctly, but change in the database only when using Chrome.
I put the exit in so I am sure no other code is being executed after this.
Also I searched my whole project for the string 'nopage' and it is not
found. The variable $thePage is getting the value from $_GET['home'], so I
could see Chrome reporting the wrong value to the list of $_GET variables,
but it is echoing out correct. When I replace the variable for
last_page_visit with a string, the database will correctly record whatever
I put in it. I do not know what else to try.
No comments:
Post a Comment