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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T14:33:48+00:00 2026-06-10T14:33:48+00:00

I’ve put together a login script, and by put together I mean I copy

  • 0

I’ve put together a login script, and by put together I mean I copy and pasted bits and pieces of code from forums and got it working from trial and error.

So far the script is working fine, when logging in there is no issue at all, the only problem comes from when you try to login without filling in any of the fields, it gives me some strange error and redirects me to a blank page with

Object Moved

This document may be found here

It’s not a huge issue as I don’t see why people would try and login with blank fields anyway, but it’s something I’d like to know how to solve for future reference.

Below is the login portion of my code:

<?php
session_start();

$data=array("user1"=>array("url"=>"page1.php","password"=>"12345"),
            "user2"=>array("url"=>"page2.php","password"=>"12345"),
        "user3"=>array("url"=>"page3.php","password"=>"12345")
        );

if(isset($_POST['username']) && isset($_POST['password'])) {

    $user = strtolower($_POST['username']);
    $pass = strtolower($_POST['password']);

    if($data[$user]['password'] == $pass) {     
       $_SESSION['username'] = $user . " " . $pass;
       header('Location: ' . $data[$user]['url']);
    } else {
        echo '<script type="text/javascript">window.onload = function() { document.getElementById("loginError").innerHTML = "' . "Invalid login details. Please try again." . '"; }</script>';
        logIn();
    }
} else {
    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-10T14:33:49+00:00Added an answer on June 10, 2026 at 2:33 pm

    Ensure or change that the `header(‘Location: ‘ . $data[$user][‘url’]); is an absolute path when redirecting and not a relative path. See the related post as proof for my answer PHP on IIS7 – Receiving "Object Moved" html page instead of actually redirecting.

    To fix that blank password issue change the check to the following:

    if(isset($_POST['username']) && !empty($_POST['username']) && 
        isset($_POST['password']) && !empty($_POST['password']) ) { 
        //Do code here
    }
    else
    {
       logIn(); 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a text area in my form which accepts all possible characters from
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

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.