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

  • Home
  • SEARCH
  • 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 8923537
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T07:09:01+00:00 2026-06-15T07:09:01+00:00

I really don’t know much in php so my friend helped me to make

  • 0

I really don’t know much in php so my friend helped me to make login page.
However I end up into redirect loop if login information is correct.

Here’s my code:

index.php – Page

<?php
     if (!$_SESSION['ajslkajslkgjals'])
     header('Location: login.php');
?>

login.php – Page

<?php

session_start();
require_once('config.php');

$query   = "SELECT * FROM admins";
$result  =  mysql_query($query);
$num     =  mysql_numrows($result);

mysql_close();

$i = 0;

while ($i < $num) {
    $admin_user = mysql_result($result, $i, "admin_username");
    $admin_pass = mysql_result($result, $i, "admin_password");
    $i++;
}

if(isset($_POST['login-form'])) {
    $admin_username = $_POST['username'];
    $admin_password = $_POST['password'];


    if($admin_username==$admin_user && $admin_password==$admin_pass) {
        $_SESSION['ajslkajslkgjals'] = $admin_user;
        header('Location: index.php');
        exit();

    } else {
        $status = "<script>
                    $.ajax({ 
                        url: '/',
                        data: {action: 'test'},
                        type: 'post',
                        success: function() {
                            notifyBox();
                        }
                    });
                   </script>";

    }
}

if(isset($_SESSION['ajslkajslkgjals'])) {
    header('Location: index.php');
    exit();
}
?>

I will appreciate if anyone could give me some tips of where I made mistake ?
I just don’t get it! Thank you.

  • 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-15T07:09:02+00:00Added an answer on June 15, 2026 at 7:09 am

    At the end of login.php you have a redirect to index.php. In index you don’t start the session so that if always executes the redirect.

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

Sidebar

Related Questions

I really don't know much about Apache, I followed some tutorials and installed the
I really don't know much about attributes in general in C#, I've seen them
I really don't know squat about java memory management, so this is entirely my
I really don't know how to explain what's going on, so I'll just show
I'm new to python so I really don't know the language very well. the
I'm stuck on a problem I really don't know how to solve: I have
I really don't know how is it possible, and I couldn't reproduce the error
I really don't know what's wrong here and why it isn't recreating the new
I really don't know how to say, may be this is why I didn't
I really don't know how to title this question, but I need some help

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.