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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:05:38+00:00 2026-05-26T04:05:38+00:00

In an article on preventing PHP form resubmissions, I read the following: (Not quoting)

  • 0

In an article on preventing PHP form resubmissions, I read the following:

(Not quoting) This could be the page that receives the form data, for example called “form.php”:

<form action="submit.php">
  <input type="text" name="user" required />
  <input type="password" name="pass" required />
  <input type="submit" value="Log in" />
</form>

The page that would process the POST data would therefore be called “submit.php”. If the login went correctly, this code would run:

header('Location: /login/form.php?success=true');

However, couldn’t a user just navigate to the URL above? Also, what is the purpose of the GET variable? Couldn’t I just have a script at form.php that checks if the user is logged in?

At submit.php, should I save the logged in username as $_SESSION[‘username’], and then check if isset() at form.php? Also, since a URL with “success” in it isn’t really pretty, is it economical to redirect the user once again? Should I use PHP header() or Javascript window.location.href? As you see, I’m sort of confused.

Thanks for any help.

  • 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-26T04:05:39+00:00Added an answer on May 26, 2026 at 4:05 am

    However, couldn’t a user just navigate to the URL above?

    Yes, he can. This will not cause anything bad though.

    Also, what is the purpose of the GET variable?

    To have some flag that represents the fact that the form has been processed successfully and you need to congratulate user.

    Couldn’t I just have a script at form.php that checks if the user is logged in?

    Uhm, you can keep your code in the way you like. There is no any strong requirements

    At submit.php, should I save the logged in username as $_SESSION[‘username’], and then check if isset() at form.php?

    If you need to persist it across the current session – yes, do so.

    Also, since a URL with “success” in it isn’t really pretty, is it economical to redirect the user once again?

    Redirect where. Redirection is pretty cheap thing.

    Should I use PHP header() or Javascript window.location.href?

    You definitely should do that in php, otherwise you’ll get the troubles you’re trying to avoid following PRG-way.

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

Sidebar

Related Questions

This article about php form security: http://nedbatchelder.com/text/stopbots.html ... mentions a spinner as: The spinner
This article states that If your site is run on a shared Web server,
This article on MSDN states that you can use as many try catch blocks
This article says If an object has a finalizer, it is not immediately removed
The article here mentions the use of Data Annotations Model Binder that is available
In his article about preventing multiple instances of an application, Michael Covington presents this
The article states the following: http://msdn.microsoft.com/en-us/library/dd799517.aspx Variance does not apply to delegate combination. That
This article argues that regular expressions cannot match nested structures because regexes are finite
This article seems to suggest that there such things as include templates. I've made
This article explains how Guids are generated. My question is that is there any

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.