5 Replies - 871 Views - Last Post: 29 July 2012 - 06:45 PM Rate Topic: -----

#1 Keylogger  Icon User is offline

  • D.I.C Regular

Reputation: 4
  • View blog
  • Posts: 277
  • Joined: 14-February 11

Blocking urls

Posted 29 July 2012 - 05:14 PM

I need to block people from typing "main.php?form=1" or "main.php?form=2", however I will use this.
I mean, I will use "main.php?form=1" etc, but if people instead of writing in the URL "main.php" write main.php?form=1, I need to prevent a message to appear.

Because, my form calls method="main_xpto.php", and when the "main_xpto.php" do the job, it will redirect to the main.php?form=1 or 2 and it will appear a message. So, if people insert in the URL "main.php?form=1", it will appear the message even if they didn't submit the form.

Any ideas??

Is This A Good Question/Topic? 0
  • +

Replies To: Blocking urls

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 5677
  • View blog
  • Posts: 22,540
  • Joined: 23-August 08

Re: Blocking urls

Posted 29 July 2012 - 05:16 PM

PHP can't stop people from typing anything into the address bar.
Was This Post Helpful? 1
  • +
  • -

#3 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon




Reputation: 9044
  • View blog
  • Posts: 33,561
  • Joined: 27-December 08

Re: Blocking urls

Posted 29 July 2012 - 05:18 PM

Try relying on hidden inputs and $_POST values instead of $_GET values.
Was This Post Helpful? 1
  • +
  • -

#4 Keylogger  Icon User is offline

  • D.I.C Regular

Reputation: 4
  • View blog
  • Posts: 277
  • Joined: 14-February 11

Re: Blocking urls

Posted 29 July 2012 - 05:52 PM

View Postmacosxnerd101, on 29 July 2012 - 05:18 PM, said:

Try relying on hidden inputs and $_POST values instead of $_GET values.

The only $_GET I use is for get the url.

Do you guys have any idea how to do it in other way? What I need is: enter main.php » submit the form » read main_xpto.php » back to main » present a message in the main.

I tried to put the message in the main_xpto.php, but I need to redirect, and I use:
echo "<script type='text/javascript'>window.location='main.php?id=0'</script>";


So the message won't appear. Any suggestions?

This post has been edited by Keylogger: 29 July 2012 - 05:53 PM

Was This Post Helpful? 0
  • +
  • -

#5 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 5677
  • View blog
  • Posts: 22,540
  • Joined: 23-August 08

Re: Blocking urls

Posted 29 July 2012 - 06:02 PM

Save a message in the SESSION in the main_xpto.php script. Add a div to main that prints the content of that message.
Was This Post Helpful? 2
  • +
  • -

#6 Keylogger  Icon User is offline

  • D.I.C Regular

Reputation: 4
  • View blog
  • Posts: 277
  • Joined: 14-February 11

Re: Blocking urls

Posted 29 July 2012 - 06:45 PM

Perfect men. Great solution. Solved, thanks!!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1