Closed Thread
Results 1 to 5 of 5

Thread: Need help with proxy script please

  1. #1
    Join Date
    Aug 2006
    Posts
    11,209
    Blog Entries
    6
    Rep Power
    101

    Need help with proxy script please

    I have a proxy script and I want that the user inserts http:// before he surfs, but let's say he doesn't enter it I want it to be added, but if he doesn't I don't want to end up with http://http://www.website.com

    So please can anyone help me? I have a text box in index.html to write the URL and then a php script to surf the website in a frame.

    Can anyone help please?

    Thanks.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    v0id is offline Retired
    Join Date
    Apr 2007
    Posts
    2,937
    Blog Entries
    3
    Rep Power
    42
    What about putting "http://" as standard value in the inputbox? Then the user will probably right the URL after the "http://". It can easily be done by setting a value-attribute at the tag.
    Code:
    <input ... value="http://" />
    Then of course some users will probably remove the "http://", so you still have to find away of checking for "http://". For this you can use the PHP-function strpos. The function will return false if the string didn't got found, and else the position.
    Code:
    $input    = $_GET["input_from_user"];
    $haystack = strtolower($input);
    $needle   = "http://";
    $position = strpos($haystack, $needle);
    
    // Check if "http://" wasn't in the page
    if($position === false)
      $page = "http://" . $haystack;
    else
      $page = $haystack;
    
    // Continue with the job to be done

  4. #3
    Join Date
    Aug 2006
    Posts
    11,209
    Blog Entries
    6
    Rep Power
    101
    I have already done the one with the value, now I will try the other bit of code..
    Will let you know, I'm trying it.

    *EDIT* Wow man, it works perfectly. if no URL is given it always displays that the URL is wrong, Thanks! I had to edit it a little bit, although I don't know any PHP, but I figured it out as I know some programming. Anyways thanks!!
    Last edited by TcM; 05-16-2007 at 07:41 AM.

  5. #4
    v0id is offline Retired
    Join Date
    Apr 2007
    Posts
    2,937
    Blog Entries
    3
    Rep Power
    42
    I'm glad, you could use it.

    To make the validation for the input even more secure, try look into some Regular Expressions. It's a short, clean - but also a bit hard way to validate your input in only a line, or maybe a little more. There's tons of information about Regular Expressions "out there", and also for many different languages.

    A good place to start, would be here:
    Regular-Expressions.info - Regex Tutorial, Examples and Reference - Regexp Patterns

  6. #5
    Join Date
    Aug 2006
    Posts
    11,209
    Blog Entries
    6
    Rep Power
    101
    Quote Originally Posted by v0id View Post
    I'm glad, you could use it.

    To make the validation for the input even more secure, try look into some Regular Expressions. It's a short, clean - but also a bit hard way to validate your input in only a line, or maybe a little more. There's tons of information about Regular Expressions "out there", and also for many different languages.

    A good place to start, would be here:
    Regular-Expressions.info - Regex Tutorial, Examples and Reference - Regexp Patterns
    Well I don't need to verifiy if it is a real URL or not, it's up to the user!!
    Discovered one problem, it clashes with the Google Search of Adwords!! it displays invalid URL!!
    Last edited by TcM; 05-16-2007 at 07:57 AM.

Closed Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Using Proxy Servers With PHP Script
    By rsnider19 in forum PHP Development
    Replies: 0
    Last Post: 04-24-2010, 08:19 AM
  2. Using Proxy Servers With PHP Script
    By rsnider19 in forum PHP Development
    Replies: 0
    Last Post: 04-10-2010, 05:35 PM
  3. Monetizing a Proxy?
    By TcM in forum Marketing
    Replies: 19
    Last Post: 10-16-2009, 01:04 AM
  4. proxy script site
    By midnightrose2008 in forum PHP Development
    Replies: 10
    Last Post: 06-16-2008, 08:15 AM
  5. My Proxy!
    By tyr in forum Website Design
    Replies: 1
    Last Post: 08-04-2007, 01:30 AM

Tags for this Thread

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