www.webdeveloper.com
Results 1 to 3 of 3

Thread: [RESOLVED] What's wrong with this line of PHP?

  1. #1
    Join Date
    Mar 2010
    Posts
    701

    resolved [RESOLVED] What's wrong with this line of PHP?

    PHP Code:
    $url str_replace(str_replace(' ','%20',stripslashes(trim($_POST['url'])))); 
    There was an error with my script. I debugged and the error lies in the line above. What's wrong with it?

  2. #2
    Join Date
    Jan 2006
    Location
    MN
    Posts
    440
    I looks like you have one too many str_replace functions entered


    PHP Code:
    $url str_replace(' ','%20',stripslashes(trim($_POST['url']))); 
    But you might want this function instead;

    PHP Code:
    $url urlencode($_POST['url']; 
    Or are your wanting to decode then it should be

    PHP Code:
    $url urldecode($_POST['url']; 
    Last edited by Dasher; 12-02-2010 at 06:36 PM.

  3. #3
    Join Date
    Mar 2010
    Posts
    701
    Sorry, careless mistakes

    I just want to provide some basic PHP injection prevention before using Regex to check it. $_POST['url'] is user submitted

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles