Activity Stream
48,167 MEMBERS
6711 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 8 of 8
  1.     
    #1
    Banned
    Website's:
    WarezRelease.org ThatHosting.co

    Default Valid URLs

    Hi, I wanna adda valid url's c heck to my remote uploader.

    I have an idea of how to do it, like

    $url = "http://";

    if ($url) {

    //do this
    }

    but the end user cud add any url atm like warezscene.net/mypic.png or krazywarez.com/mypic.png or xtremeddl.net/mypic.png so i need to find some code for differnt url's.

    any1 help?
    Chris2k Reviewed by Chris2k on . Valid URLs Hi, I wanna adda valid url's c heck to my remote uploader. I have an idea of how to do it, like $url = "http://"; if ($url) { //do this } Rating: 5

  2.   Sponsored Links

  3.     
    #2
    Respected Member
    Website's:
    DL4Everything.com Soft2050.in
    You could use regex to validate urls

    This function from: http://www.blog.highub.com/regular-e...idating-a-url/

    PHP Code: 
    function validateURL($url){$pattern '/^(([\w]+:)?\/\/)?(([\d\w]|%[a-fA-f\d]{2,2})+(:([\d\w]|%[a-fA-f\d]{2,2})+)?@)?([\d\w][-\d\w]{0,253}[\d\w]\.)+[\w]{2,4}(:[\d]+)?(\/([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)*(\?(&?([-+_~.\d\w]|%[a-fA-f\d]{2,2})=?)*)?(#([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)?$/';return preg_match($pattern$url);} 
    And can check if the string starts with www, then add http or if having no www/http then add http

  4.     
    #3
    Banned
    Website's:
    WarezRelease.org ThatHosting.co
    This seems a good yet clean function, however when i input a link i want a windows error msg to pop up if invalid url...

    is it possible and do u no how?

  5.     
    #4
    Respected Member
    Website's:
    DL4Everything.com Soft2050.in
    If in php, you can use this:

    PHP Code: 
    function addnvalidateurls($url){
    // Modified By: Soft2050
    if (!preg_match("@^[hf]tt?ps?://@"$url)) {
            
    $url "http://" $url;
    }
    $pattern '/^(([\w]+:)?\/\/)?(([\d\w]|%[a-fA-f\d]{2,2})+(:([\d\w]|%[a-fA-f\d]{2,2})+)?@)?([\d\w][-\d\w]{0,253}[\d\w]\.)+[\w]{2,4}(:[\d]+)?(\/([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)*(\?(&?([-+_~.\d\w]|%[a-fA-f\d]{2,2})=?)*)?(#([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)?$/';
    return 
    preg_match($pattern$url);

    The above code will check for all things

    It will also add http if not in url and then check whether url is valid or not

    However for displaying a error, you need to use javascript with it

  6.     
    #5
    Banned
    Website's:
    WarezRelease.org ThatHosting.co
    ok thx, where/after what line to add that?

  7.     
    #6
    Respected Member
    Website's:
    DL4Everything.com Soft2050.in
    Check this code:

    PHP Code: 
    <?php
    function addnvalidateurls($url){
    // Modified By: Soft2050
    if (!preg_match("@^[hf]tt?ps?://@"$url)) {
            
    $url "http://" $url;
    }
    $pattern '/^(([\w]+:)?\/\/)?(([\d\w]|%[a-fA-f\d]{2,2})+(:([\d\w]|%[a-fA-f\d]{2,2})+)?@)?([\d\w][-\d\w]{0,253}[\d\w]\.)+[\w]{2,4}(:[\d]+)?(\/([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)*(\?(&amp;?([-+_~.\d\w]|%[a-fA-f\d]{2,2})=?)*)?(#([-+_~.\d\w]|%[a-fA-f\d]{2,2})*)?$/';
    return 
    preg_match($pattern$url);


    $result addnvalidateurls('http://www.google.com');
    echo 
    '<script language="javascript">';
    if (
    $result == 1)
    echo 
    "alert('Yes! The given url is validated')";
    else {
    echo 
    "alert('No! the given url seems to be not working')";
    }
    echo 
    '</script>';
    ?>
    You can add this code before remote uploading the url

    If Url is not valid, then you can break the function to end it

  8.     
    #7
    Banned
    Website's:
    WarezRelease.org ThatHosting.co
    we seem to have a problem, i tried uploading: C:\wamp\www\includes

    and it said its valid lol when its not also i read ccomments on that blog saying it ddidnt work.

  9.     
    #8
    Respected Member
    Website's:
    DL4Everything.com Soft2050.in
    Try this now:

    PHP Code: 
    <?php
    function addnvalidateurls($url){
    // Modified By: Soft2050
    if (!preg_match("@^[hf]tt?ps?://@"$url)) {
            
    $url "http://" $url;
    }
    $pattern '@((https?://)?([-\w]+\.[-\w\.]+)+\w(:\d+)?(/([-\w/_\.]*(\?\S+)?)?)*)@';
    return 
    preg_match($pattern$url);


    $result addnvalidateurls('google.com');
    echo 
    '<script language="javascript">';
    if (
    $result == 1)
    echo 
    "alert('Yes! The given url is validated')";
    else {
    echo 
    "alert('No! the given url seems to be not working')";
    }
    echo 
    '</script>';
    ?>
    Regex Code: http://snipplr.com/view/36992/improv...on-with-regex/

    Or have a search for some premade regex using google or you can code yourself if you are good at it

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. VBSEO Urls
    By viruz99 in forum Technical Help Desk Support
    Replies: 0
    Last Post: 13th Nov 2011, 02:15 PM
  2. Issues with Recaptcha API urls
    By NewEraCracker in forum Feedback and Suggestions
    Replies: 1
    Last Post: 19th May 2011, 02:50 PM
  3. Re-write some URLs
    By Chris2k in forum Web Application/Script Support
    Replies: 4
    Last Post: 27th Mar 2011, 12:59 AM
  4. Blocked URLs
    By Sun!l in forum Legal Issues
    Replies: 2
    Last Post: 28th Feb 2010, 09:54 AM
  5. Legit DepositFiles Valid Accounts 1$ valid for 1 day
    By piratebay in forum Completed Transactions
    Replies: 2
    Last Post: 23rd Oct 2009, 01:56 PM

Tags for this Thread

BE SOCIAL