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 9296037
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T21:44:50+00:00 2026-06-18T21:44:50+00:00

I have this login sistem: require_once conexion.php; class login extends conexion { public function

  • 0

I have this login sistem:

    require_once "conexion.php";


    class login extends conexion {



    public function log_user($user,$pass)
        {
        $conexion = mysql_conexion();
            $login = "SELECT user_name,user_pass,id FROM menssager_user WHERE user_name='$user' AND user_pass='$pass'";
                $e = $conexion->prepare($login);
                    $e->execute();

                $re = $e->fetch(PDO::FETCH_ASSOC);

                    if($user == $re["user_name"] && $pass == $re["user_pass"])
                    {

                    $this->is_online($re["id"]);
                    return $re["id"];
                    }

        $conexion = null;

        }   }

And when i execute that code, it takes 1.3 seconds to find out if that user exists and I have just 2 username in the DB.
Can someone tell me why so slow?
Note: yesterday i upgrade to 5.4.7 and re-write the code again(for new features of that version).

Update:

And the database conexion:

class conexion{

        public function mysql_conexion(){

            $conexion_path = "mysql:dbname=menssager;host:127.0.0.1";
                $root = "root";
                $pass = "";

                try{

                    $conectar = new PDO($conexion_path,$root,$pass);
                    $conectar->setAttribute(PDO::ATTR_EMULATE_PREPARES,false);
                    $conectar->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

                }catch(PDOException $error)
                {
                    echo $conectar = $error->getMessage();
                }
                return $conectar;

        }
    }
  • 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-18T21:44:52+00:00Added an answer on June 18, 2026 at 9:44 pm

    While you are still measuring the connection vs execution times, I am going to hazard a guess at the answer. I think your connection time is what is causing the delays. Look at this similar question asked earlier.
    https://serverfault.com/questions/408550/connecting-to-mysql-from-php-is-extremely-slow

    Turning off reverse DNS lookup might help you.
    Adding a link showing how you can turn it off:

    http://developers.sugarcrm.com/wordpress/2012/01/10/howto-turn-off-mysql-reverse-dns-lookup-to-speed-up-response-times/

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

Sidebar

Related Questions

I have this code for displaying content for login and registration in my PHP
I have this table: User id INT PK login VARCHAR UNIQUE I want to
This aspect of my login system works just fine if I have the return
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
I have this horribly stripped delphi code that basically login to server, save cookie
I have this code in JS: if($('.log input:checked')) { alert('login checked'); alert('do what you
i have this page . login: fer password: m Note: after login you will
i have this chatbox, and when users login i want it to send a

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.