Solved

Php get the last url

Posted on 2006-10-31
2
1,347 Views
Last Modified: 2006-11-18
Hey.

Is there a way to get the last url in php.

Example:
I pass data trough a form but i what to make shure that the form post comes from my site and not a other site.
So that the pre url can be validated
0
Comment
Question by:macbox
2 Comments
 
LVL 19

Accepted Solution

by:
VoteyDisciple earned 500 total points
ID: 17842552
The $_SERVER['HTTP_REFERER'] variable will do that.

HOWEVER!  (and it's a big "however") that particular variable comes from the browser's HTTP request.  There's no guarantee it will exist (the browser may not send it), and there's nothing at all to keep a malicious user from faking it.

If you're just hoping to cut down on spam or something of that nature then it may do the trick.  If you're after a real security measure, this isn't it.
0
 
LVL 8

Expert Comment

by:adg080898
ID: 17846032
Is the user logged in? What I mean is, do you have a way to identify the user?

I am going to assume that you have some sort of database record for the user.

I suggest you have a field in your user record that stores a random string. When you generate the form page, generate a long (longer is stronger security, 32 characters is very strong) random string of characters and store that string in their user database record. Also, put a hidden field in the form with the value matching their random string.

Then, where you handle the form submission, compare the hidden field's value to the one generated when the form was displayed.

This way, the only way for the post to work is to know the value of the hidden field. This way, you can verify that the user really used your form.
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

RIA (Rich Internet Application) tools are interactive internet applications which have many of the characteristics of desktop applications. The RIA tools typically deliver output either by the way of a site-specific browser or via browser plug-in. T…
This article will show, step by step, how to integrate R code into a R Sweave document
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

744 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

14 Experts available now in Live!

Get 1:1 Help Now