Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Nov 2007
    Location
    Leeds, UK
    Posts
    514
    Thanks
    24
    Thanked 19 Times in 19 Posts

    Chrome/Safari/Webkit AJAX POST Error + onreadystatechange not working

    ok so there is 2 problems to this one
    The First Apparently WebKit nolonger supports AJAX POST due some tit in porgraming saying the setting the header "Content-length" is a security issue any one got a work around yet and i cant use jQuery the site has prototype in and used and the prototype AJAX is not working eather

    Code:
    Google Chrome Error Log:
    Refused to set unsafe header "Content-length"
    Refused to set unsafe header "Connection"
    And in FireFox where it dose work
    my onreadystatechange dose not work it just dose not fire
    PHP Code:
    this.textSearch = function(){
            
    this.query "SELECT * FROM `products`,`prices` WHERE `prices`.`product_id` = `products`.`product_id` "+
                         
    "AND (`products`.`name` LIKE '%{mysql[0]}%' OR `products`.`description` LIKE '%{mysql[1]}%') LIMIT 0, 15";
            var 
    searchVal document.getElementById("title").value;
            
    this.mysql searchVal+","+searchVal;
            
    this.prams "query="+escape(this.query);
            
    this.generateTime();
            
    this.startAjax();
        }
        
    this.startAjax = function(){
            
    this.AJAX.open("POST""/ajax.php"false);
            
    this.AJAX.setRequestHeader("Content-type""application/x-www-form-urlencoded");
            
    this.AJAX.setRequestHeader("AJAXSECURE"this.timeStamp);
            
    this.AJAX.setRequestHeader("CURRENTDATE"this.time);
            
    this.AJAX.setRequestHeader("Mysql-Secure"this.mysql);
            
    this.AJAX.setRequestHeader("Content-length"this.prams.length);
            
    this.AJAX.setRequestHeader("Connection""close");
            
    this.AJAX.onreadystatechange = function(){
                
    Search.readyState Search.AJAX.readyState;
                if(
    Search.AJAX.readyState == 4){
                    
    Results document.getElementById('SearchResults');
                    
    Results.innerHTML Search.AJAX.responseText;
                }
            }
            
    this.AJAX.send(this.prams);
        } 
    This is my post but for som reason Search.responseText = "" and not the Search.AJAX.responseText;
    and the Search.readyState is never set


    this.AJAX.setRequestHeader("AJAXSECURE", this.timeStamp);
    this.AJAX.setRequestHeader("CURRENTDATE", this.time);
    this.AJAX.setRequestHeader("Mysql-Secure", this.mysql);

    Are custom Header they help my script varify that AJAX is calling the page and not some tit trying to hack the site being that it passes a SQL query it gose though 4 stages of authentication
    send a time stamp and the date it used to create the timestamp
    The php then varifiys that the date matches the time stamp sent,
    It then varifyes this to within 2 mins of the server timestamp
    it then chackes that the SQL values are all {mysql[*]} and then replaces them with the values send in the mysql-secure header if any of these fails it logs the IP in a Block table and 403's them and if there IP is in the ban table they cant load any thing
    Last edited by barkermn01; 10-21-2009 at 12:54 PM.
    Working towards a Internet where we don't have website just browser applications Kill the Hyper-link and say hello to 3D Games in the browser :)

  • #2
    Regular Coder
    Join Date
    Nov 2007
    Location
    Leeds, UK
    Posts
    514
    Thanks
    24
    Thanked 19 Times in 19 Posts
    Up Date:::

    Due to the Webkit F*ck up i have changed it to get but this bugs in IE any idears
    Working towards a Internet where we don't have website just browser applications Kill the Hyper-link and say hello to 3D Games in the browser :)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •