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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T03:29:00+00:00 2026-05-27T03:29:00+00:00

I have a single php file to handle login/logout on my site. The login

  • 0

I have a single php file to handle login/logout on my site. The login works fine, but when I try to log out, I get told that the file could not be found on the server.

This link calls the page for a log out:

<a href="/logansarchive/admin/do.login?action=out">Sign Out</a>

Here’s the code in the file:

<?php
    session_start();

    if (isset($action) && $action == "out") {
        // Log out
        if (ini_get("session.use_cookies")) {
            $params = session_get_cookie_params();

            setcookie(session_name(), '', time() - 42000,
                $params["path"], $params["domain"],
                $params["secure"], $params["httponly"]
            );
        }
        session_destroy();
        header("Location: /logansarchive/admin/login.php?logged_out=1");
    }
    else {
        $username = $_REQUEST["txt_username"];
        $password = $_REQUEST["txt_password"];
        $action = $_GET["action"];

        $host = "127.0.0.1";
        $user = "root";
        $pass = "12157114";

        try {
            $dbh = new PDO("mysql:host=$host;dbname=logansarchive", $user, $pass);
            $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        }
        catch(PDOException $e) {
            echo $e->getMessage();
        }

        // Log in
        $hashed_pass = hash("sha512", $password);

        $sql = "select count(*) as count, adminid, adminname, DATE_FORMAT(lastlogin, '%W, %M %e, %Y @ %h:%i %p' ) AS lastlogin from admin where adminname = :name and adminpass = :pass";
        $result = $dbh->prepare($sql);

        $result->bindParam(":name", $username);
        $result->bindParam(":pass", $hashed_pass);

        $stmt = $result->execute();
        $row = $result->fetch();
        if ($row["count"] == 1) {
            session_start();
            $_SESSION["adminid"] = $row["adminid"];
            $_SESSION["adminname"] = $row["adminname"];
            $_SESSION["lastlogin"] = $row["lastlogin"];     

            $dbh = null;
            header("Location: /logansarchive/admin/index.php");
        }
        else {
            $dbh = null;
            header("Location: /logansarchive/admin/login.php?login_attempt=1");
        }
    };
?>

Any explanation of this behavior and (ideally) a way to fix it, would be greatly appreciated.

  • 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-05-27T03:29:01+00:00Added an answer on May 27, 2026 at 3:29 am

    do.login doesn’t seem a valid php file name
    why don’t you use login.php instead?

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

Sidebar

Related Questions

Basically I have a single page on my site that I want any php
I have already a site with a single homepage index.php which accepts 2 parameters
I have a single PHP file which handles credit card processing. It starts as
Is it possible to have a single php file that gets called before the
I have a single php script on my site that facilitates my site's downloads
I have a flash application which uses a single php file to retrieve records
I have a single PHP file that i require in many different php files.
I have defined the following function in my Wordpress site's functions.php file, it should
I realized that I can have problems with single quotes in php arrays: <?php
I'm writing a photo gallery script in PHP and have a single directory where

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.