-1

on login success echo message is append with spaces

<?php
include "dbconn.php";
if((isset($_REQUEST['email'])) && (!empty($_REQUEST['password'])))
{
$email = $_REQUEST['email'];
$password = $_REQUEST['password'];
$check ="select * from register_unity where email='".$_REQUEST['email']."' and password='".$_REQUEST['password']."'";
$query = mysql_query($check);
$result = mysql_fetch_assoc($query);
$numrows = mysql_num_rows($query);

if($numrows == 0)
{
echo "Invalid username/password";
}
else 
{
echo "login success";
}
}
?>

Echoed values are sent using the url for eg: when logging success, values should be sent as "login success" but what actually happened is " login success "

anbu
  • 35
  • 7
  • 2
    Do you have a leading space before ` – deceze Oct 17 '17 at 07:46
  • 3
    BTW, you're open to SQL injection *and* you're storing passwords in plaintext. *Very frowny face :(((* – deceze Oct 17 '17 at 07:46
  • I have no leading space before. – anbu Oct 17 '17 at 08:08
  • can you give me detail about : SQL injection – anbu Oct 17 '17 at 08:09
  • Read: https://stackoverflow.com/q/332365/476, https://stackoverflow.com/q/60174/476, [The Great Escapism (Or: What You Need To Know To Work With Text Within Text)](http://kunststube.net/escapism/), https://stackoverflow.com/q/401656/476 – deceze Oct 17 '17 at 08:11
  • thank you so much for that password protection. can you help me out the solve above problem i am facing,why i am getting that spaces – anbu Oct 17 '17 at 08:14
  • I think we should need some more code for your problem @anbu – Tomm Oct 17 '17 at 08:32
  • i have post all code on that page , before few day the code worked fine i uploaded some other php files to server ,i got this problem in all the pages – anbu Oct 17 '17 at 08:34
  • Is there a space in `dbconn.php`, before ``? – Don't Panic Oct 17 '17 at 09:46

1 Answers1

0

Please check if there are spaces or page breaks before php tag (I mean at the start of the page). remove unwanted page breaks from the page (at the begining and in between) For example: before :

    if($numrows == 0)
{
echo "Invalid username/password";
}

mark as answer if this helps.

Blesson Christy
  • 380
  • 3
  • 13