Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12

Thread: PHP Redirect doesn't work - UPDATE: Safety of @extract($_POST);

  1. #11
    Join Date
    Jul 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks for the reply, djr33. So is the code as I have it now safe or do I have to change something about it. I mean, I get what you just explained, but I do not think that I can apply it yet to my own code.
    What I have now is
    Code:
    <?php
    	@extract($_POST);
    	$quickarchive_date = stripslashes($quickarchive_date);
    	$quickarchive_categories = stripslashes($quickarchive_categories);
    	if ( $quickarchive_categories == "C" && $quickarchive_date == "#" ) {
    		$url = "http://www.mysite.com/weblog/archive_2/";
    	} elseif ( $quickarchive_categories != "C" && $quickarchive_date == "#" ) {
    			$url = "http://www.mysite.com/weblog/archive_2/".$quickarchive_categories."/" ;
    	} else {
    		$url = "http://www.mysite.com/weblog/archive_2/".$quickarchive_categories."/".$quickarchive_date ;
    	}
    	header("HTTP/1.1 301 Moved Permanently"); 
    	header("Location: $url");
            exit;
    ?>

  2. #12
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    What are you using from the post data?
    Remove @extract(... and replace any references to these newly created variables with $_POST['thatname'] instead.
    That's about it.
    In that case, it seems safe enough, probably.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •