Question

HI I am sending a username to my php file located on the server to check if the username exists in my database. If it does I want to send back a response which contains only "False", or else it will send back "True".

Here is my php code:

<?php

$username = $_POST['username'];
$password = $_POST['passsword'];
$email = $_POST['email'];

mysql_connect(//server name, server_admin, server_password) or die(mysql_error());
mysql_select_db("a1754417_word") or die (mysql_error());

$result = mysql_query("SELECT username FROM Users WHERE username = '$username'");

if(mysql_num_rows($result) != 0){
  echo mysql_num_rows;
  echo "False"; 
}else{
  echo "True";
}
?>

Here is my output from Logcat

01-13 03:16:34.606: I/Response 'False'(791): True
01-13 03:16:34.606: I/Response 'False'(791): <!-- Hosting24 Analytics Code -->
01-13 03:16:34.606: I/Response 'False'(791): <script type="text/javascript" src="http://stats.hosting24.com/count.php"></script>
01-13 03:16:34.606: I/Response 'False'(791): <!-- End Of Analytics Code -->

My code is sending back "True" correctly but it is also sending the extra information why?

Thanks in advance

Was it helpful?

Solution

It seems, that your hoster has configured the server to append some analytics stuff. If you cannot disable it somewhere in a control panel, you might need to switch to a more reputable hoster. You could also try to modify the header with header() to get rid of this:

Also, have a look at this question:

Webhoster inserts a javascript which brokes my code how to remove it?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top