tags:

views:

39

answers:

1

When i declare mac = 123, my internet explorer and firefox will keep refresh non-stop. And if i declare mac = getMacAddress it returns a value 1...

I'm able to do a document.write(getMacAddress()) and it would able to display the mac address nicely.

1) Why my explorer will keep refreshing non-stop when i code it manually with "123"

2) why is the document.write able to display out, and when i store it to the cookie, somehow it didnt mange to capture into the cookie and it return a value of "1".

Anyone help?

create_users.php

    <script language="JavaScript">

    function getMacAddress(){
    document.macaddressapplet.setSep( "-" );
    return (document.macaddressapplet.getMacAddress());
    }

    function setCookie(c_name,value) {
    document.cookie = c_name + "=" +escape(value);
    }

    //error checking
    //var mac = getMacAddress();
    var mac = "123";

    setCookie('cookie_name',mac);
    window.location = "checkAvailability.php";

    </script> 

checkAvailability.php

$javascript_cookie_value = isset($_COOKIE["cookie_name"]) ? $_COOKIE["cookie_name"] : 1;
mysql_query("INSERT INTO test (mac) VALUES ('$javascript_cookie_value')");
A: 

Hard to say for sure without seeing more code but it looks like the issue is lies in checkAvailability.php. The code above works fine and redirects to checkAvailability.php so there probably is something in that file that is redirecting back to the page with this code.

John Conde
in checkAvailability.php i did a header('Location: create_users.php')
kennedy