Solved

Problem with redirection after form POST

Posted on 2008-10-09
4
1,404 Views
Last Modified: 2013-11-21
Hi,
i am writing small application where i have a simple login form. it accepts POST data and if login is uaccuesful, it redirects the user to another page.

The problem is that on Nokia series 40 default browser it started to get warning when i use redirection just after using POST submition. I get following warning:
"Data you are sending will be redirected to another server. Continue?"

It is very annoying as it happens many times in the app and users instead of focusing on the content, they just need to confirm the redirection many times.

The strange bit is that i started to get this warning week ago, probably during some changes in the header(i guess). So this code worked ok on the same phones/browsers without any warning.

For the sake of simplicity i have removed db check in the following example that causes these warnings.
<?php
    if(!empty($_POST)) {
                  header("location:menu.php");
    }              
?><!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>UDN</title>
</head>
<body>
<h1>Index2</h1>
    <form action="index2.php" method="post">
        Username<br />
        <input name="usr" type="text" size="10"/><br />
        Password<br />
        <input name="psw" type="password" size="10"/><br />
        <input type="submit" value="Login"/>
    </form>
</body>
</html>


Warning are not shown if i use "get" instead of "post" method in the <form> tag, but i need POST cause GET is limited on 255 chars.

Can someone please help me and tell me what to change to get rid of these warnings?

Thanks in advance
0
Comment
Question by:starbones
  • 2
  • 2
4 Comments
 

Expert Comment

by:jbu2010
ID: 22682289
How about just a simple meta refresh?

echo "<meta http-equiv='refresh' content='0;url=anotherpage.php'>"
0
 

Expert Comment

by:jbu2010
ID: 22682367
Also, you do not want to send a username and password via GET.
0
 

Author Comment

by:starbones
ID: 22682394
yes, sending username and password using GET looks silly :)
well, i dont want to download a page then send another request for redirection. I know i did this on the server end, so it is possible, just dont know what i did to break it.
0
 

Accepted Solution

by:
starbones earned 0 total points
ID: 23167629
it was php returning wrong redirection code. i solved with manualy setting 303:

header('HTTP/1.1 303 See Other');
header("Location:odberi_grupa.php");
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
I annotated my article on ransomware somewhat extensively, but I keep adding new references and wanted to put a link to the reference library.  Despite all the reference tools I have on hand, it was not easy to find a way to do this easily. I finall…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now