Greetings,
I have this very strange and unexpected problem. I am currently building a website (store like website, however it makes use of content from affiliates, so no own check-out) and at one category it seems to be changing the value of my session.
In fact two session it changes.
[php]
$id = $_SESSION[“product”][“id”] = $mysqli->real_escape_string($_GET[“id”]);
$SQL_filter = $_SESSION[“product”][“sql”] = “SELECT DISTINCT c.* FROM m4n_content c, category_link link, m4n_sub2category sub WHERE link.sub2catergory_id = sub.id AND sub.subcategory_id = '”.$id."’ AND c.ownCatogoryString = link.cat_stringId AND NOT c.id IN (SELECT item_id FROM shops_store WHERE shop_id = ‘$shopId’) AND c.price != ‘NULL’ AND c.price !=’’ ";[/php]
Both of the session are good and ok when first getting on the page, at the end of the script id = 1 and in the sql the id also shows 1. However When I make an ajax call (going to the next page for example) the session $_SESSION[“product”][“id”] changes to 0810890000116 and the value in $SQL_filter = $_SESSION[“product”][“sql”] where you see $id also change to 0810890000116 and that is what makes it so strange to me.
At the end of the script it work fine, but at the beginnen (before doing anything else beside the AJAX call) of the PHP script with is called with AJAX has changed the value. While typing this I figure to search for 0810890000116 at google and what I saw was that this is the EAN code of a product that is loaded, however I do not believe I have this EAN code even in my own database. It’s also the only product that seems to be doing this.
How is this even possible?
End of the first script (regular non ajax call php page) this page that is loaded contains this product. However doing this the values are still good.
[php]
After pressing an other page or sorting the page differently the following code might happen (although they slightly differ, however all are JQUERY ajax call expecting JSON)
$('#content').on("click", "#pages span div", function(event){
$.ajax({
url: directUrl+"js/ajax/filter.php",
dataType: 'json',
data: "page="+$(this).html(),
success: function(data){
$("#products").html(data.products);
$("#pages span").html(data.numbers);
$("#pagesB span").html(data.numbers);
},
complete: function() {
currentItem = "";
wait();
},
});
});
and after loading the filter.php file (I only echo the Session values, so this page does nothing more then that) suddenly the ID has been replace by the EAN code that is not in my database even:
[php]<?php
session_start();
echo $_SESSION[“product”][“sql”];
echo $_SESSION[“product”][“id”];
?>[/php]
I hope my problem is clear and someone might be able to help me. This is the first problem I simply do not even get close to understanding.