Howzit,
So been playing around with Ajax a bit, and searched the net for examples on how to us it. I added the code below to a website's simple register page, basically it just checks if someone trying to register with their email address already exists in the system.
It works great, but the code below is easily viewable if you select to view the source of the page. As you can see, it gives paths or directories, the PHP page that does the check and what parameters are expected. I would think this is a huge security risk and just asking for trouble.
Whats the best way to implement Ajax to your websites?
Code:<script type="text/javascript"> function checkEMail(str) { if (str=="") { document.getElementById("email_address_message").innerHTML=""; return; } if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else { // code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("email_address_message").innerHTML=xmlhttp.responseText; } else { document.getElementById("email_address_message").innerHTML=''; } } xmlhttp.open("GET","includes/ajax/check_email_address_exists.php?email_address="+str,true); xmlhttp.send(); } </script>










Reply With Quote

Bookmarks