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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T12:25:49+00:00 2026-05-20T12:25:49+00:00

I’m following a php video tutorial (it’s not online sorry) from Lynda.com and used

  • 0

I’m following a php video tutorial (it’s not online sorry) from Lynda.com and used the following code, but I got the following error

Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects.

could this be a problem with my code. i.e. the fact that the code has two redirect_to in the first 10 or 15 lines, or is it talking about something else?

<?php require_once("../../includes/initialize.php"); ?>

<? if(!$session->is_logged_in()){
    redirect_to("login.php"); } ?>

<?php
$logfile = SITE_ROOT.DS.'logs'.DS.'log.txt';
if($_GET['clear'] == 'true') {
 file_put_contents($logfile, '');
 //add the first log entry
 log_action('Logs Cleared', "by User ID {$session->user_id}");
 //redirect to this same page so that the URL won't 
 //have "clear=true" anymore
 redirect_to('logfile.php');
}
?>

<?php include_layout_templates('admin_header.php');?>

<a href="index.php">&laquo; Back</a><br/>

<br/>

<h2>Log File</h2>

<p><a href="logfile.php?clear=true">Clear log file</a></p>

<?php
if (file_exists($logfile) && is_readable($logfile) && 
    $handle = fopen($logfile, 'r')) {//read
    echo "<ul class=\"logentries\">";
    while(!feof($handle)) {
    $entry = fgets($handle);
    if(trim($entry) != "") {
    echo "<li>{$entry}</li>";
    }
    }
    echo "</ul>";
    fclose($handle);
    } else {
    echo "Could not read from {$logfile}.";
    }

?>



//Remember to give your form's submit tag a name="submit" attribute
if (isset($_POST['submit'])) {//Form has been submitted.

$username = trim($_POST['username']);
$password = trim($_POST['password']);

//Check database to see if username/password exist

$found_user = User::authenticate($username, $password);

if ($found_user) {
    $session->login($found_user);
    log_action('Login', "{$found_user->username} loggined in.");
    redirect_to("index.php");
} else {
    //username/password combo was not found in the database
    $message = "Username/password combination incorrect.";
} 
} else {//Form has not been submitted.
    $username = "";
    $password = "";
    }
?>
<?php include_layout_template('admin_header.php'); ?>
        <h2>Staff Login</h2>
        <?php echo output_message($message); ?>

        <form action="login.php" method="post">
            <table>
                <tr>
                    <td>Username:</td>
                    <td>
                        <input type="text" name="username" maxlength="30" value="<?php
                        echo htmlentities($username); ?>" />
                    </td>
                </tr>
                <tr>
                    <td>Password:</td>
                    <td>
                        <input type="password" name="password" maxlength="30" value="<?php
                        echo htmlentities($password); ?>" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2">
                        <input type="submit" name="submit" value="login" />
                    </td>
                </tr>
            </table>
        </form>
        <?php include_layout_template('admin_footer.php'); ?>
  • 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-20T12:25:50+00:00Added an answer on May 20, 2026 at 12:25 pm

    You have an endless loop of redirecting.

    “login.php” redirects to “login.php” if you’re not logged in. “login.php” redirects to “login.php” if you’re not logged in. “login.php” redirects to “login.php” if you’re not logged in. “login.php” redirects to “login.php” if you’re not logged in. etc.

    You should probably make the redirect happen only when the current page is not “login.php”; i.e. remove that logic from this page.

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

Sidebar

Related Questions

I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I used javascript for loading a picture on my website depending on which small
this is what i have right now Drawing an RSS feed into the php,

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.