Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8186157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T02:05:59+00:00 2026-06-07T02:05:59+00:00

So I have this login php script that I am using and it works

  • 0

So I have this login php script that I am using and it works fine on one server (returns “success” || “invalid login”) and then this other server it breaks because it returns a line break and then “success” or “invalid login”

My guess is a php.ini setting. I am just not sure which one.

<?php
include("../config.php");
include("../connect.php");

$adminCheck = mysql_query("SELECT * FROM admins WHERE username = '" . mysql_real_escape_string($_POST['username']) . "' AND password = '" .  mysql_real_escape_string($_POST['password']) . "'");
if (mysql_num_rows($adminCheck) == 1)
{
    $result = mysql_fetch_array($adminCheck);
    $_SESSION['user']['level']    = "admin";
    $_SESSION['user']['userid']   = $result['id'];
    $_SESSION['user']['username'] = $result['username'];
    echo "success"; 
}
else
{
    $clientCheck = mysql_query("SELECT * FROM clients WHERE username = '" . mysql_real_escape_string($_POST['username']) . "' AND password = '" .  mysql_real_escape_string($_POST['password']) . "'");
    if (mysql_num_rows($clientCheck) == 1)
    {
        $result = mysql_fetch_array($clientCheck);
        $_SESSION['user']['level']      = "client";
        $_SESSION['user']['userid']     = $result['id'];
        $_SESSION['user']['username']   = $result['username'];
        $_SESSION['user']['client']     = $result['client'];
        echo "success";
    }
    else
    {
        echo "invalid login";   
    }
}
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T02:06:00+00:00Added an answer on June 7, 2026 at 2:06 am

    I’d bet you a coke that connect.php or config.php contain a \n (or \r\n) before or after their <?php ?> parts.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this horribly stripped delphi code that basically login to server, save cookie
I have this code for displaying content for login and registration in my PHP
In my login script I have put a checkbox that people can check if
I'm creating a login script for a website i'm developing, and am using PHP
i have a user login system which works off of sessions such that when
I have a facebook login system that seems to work fine, but I want
I have a PHP script that gets passed the MySQL connection details of a
I have this login form. This form is a grouped table view where the
Currently, in my settings module I have this: LOGIN_URL = '/login' If I ever
I have this situation: There are a login page with a login form (form

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.