How do you validate a url in MVC mod_rewrite format?
Page 1 of 2 12 LastLast
Results 1 to 15 of 19

Thread: How do you validate a url in MVC mod_rewrite format?

  1. #1
    Senior Member
    Join Date
    Sep 2011
    Posts
    258

    How do you validate a url in MVC mod_rewrite format?

    Well I know for typical url that begins with http:// and www., you can use some kind of regular expression to validate the url. For relative paths, this becomes a problem. Fortunately I can still get by with file_exists() when the url refers to image and other media on the server, but there's just simply no way to validate a url in this format:

    PHP Code:
    home/public_html/site/admincp/edit 
    It neither begins with http://, www., nor is actually a file I can check for existence on the server. I have absolutely no idea how to validate a url of this type, can anyone of you please give some advices? Much appreciated.

  2. #2
    Pna lbh ernq guvf¿
    Join Date
    Jul 2004
    Location
    Kansas City area
    Posts
    19,354
    Quote Originally Posted by Lord Yggdrasill View Post
    there's just simply no way to validate a url in this format:

    PHP Code:
    home/public_html/site/admincp/edit 
    Well yeah, you're right. Namely because that isn't a URL.

  3. #3
    Senior Member
    Join Date
    Sep 2011
    Posts
    258
    Quote Originally Posted by bradgrafelman View Post
    Well yeah, you're right. Namely because that isn't a URL.
    Oh my goodness cant you be more of a hypocrite than you already are? Dont even get me started on how you spammed in this thread:
    http://board.phpbuilder.com/showthre...1#post11018755

    You should be shameful about yourself, seriously. If you dont feel like replying to a thread then dont bother, not like anyone has paid you money for making useless posts. This is better off without a reply than with you trolling.

  4. #4
    Pna lbh ernq guvf¿
    Join Date
    Jul 2004
    Location
    Kansas City area
    Posts
    19,354
    Might want to check your attitude and your stupidity. Especially the latter one.

    For example, a quick look at RFC 1738 reveals this:

    Quote Originally Posted by RFC 1738
    2.1. The main parts of URLs

    A full BNF description of the URL syntax is given in Section 5.

    In general, URLs are written as follows:

    <scheme>:<scheme-specific-part>
    This:
    Code:
    home/public_html/site/admincp/edit
    is lacking the "scheme." Therefore:

    Quote Originally Posted by bradgrafelman View Post
    that isn't a URL.

  5. #5
    Senior Member
    Join Date
    Sep 2011
    Posts
    258
    lol first of all how about explaining your nonsense in that earlier thread I made? That one was just totally disgusting, if I were you Id feel shameful of what I said. Me checking my attitude? Why do I bother with that when you were the one who had attitude problem at first?

    And I am NOT posting a thread asking if this is a url. Perhaps it is technically not a url, but it has nothing to do with the topic of finding a way to validate it. You just keep digressing from the topic, what do you accomplish by proving that is not a url anyway? To prove that there's no way to validate it 'cause 'its not a url!' Or just to prove you are such a know-all? lmao.
    Last edited by Lord Yggdrasill; 12-13-2012 at 01:08 AM.

  6. #6
    Pna lbh ernq guvf¿
    Join Date
    Jul 2004
    Location
    Kansas City area
    Posts
    19,354
    Quote Originally Posted by Lord Yggdrasill View Post
    lol first of all how about explaining your nonsense in that earlier thread I made?
    Oh, no, you weren't too far off base there; I couldn't refrain from being sarcastic there. I spent so long not 'trolling the noobs' 'round here that it just slips out once in a while now.

    Quote Originally Posted by Lord Yggdrasill View Post
    if I were you Id feel shameful of what I said.
    Ah, well then it's a good thing that you're you and I'm me; I not only feel no shame, I'm not ashamed at the fact that I'm not ashamed!

    Quote Originally Posted by Lord Yggdrasill View Post
    Me checking my attitude? Why do I bother with that when you were the one who had attitude problem at first?
    Well, see, you're mistaken on that point. I was truly attempting to be helpful when I offered that the example you gave wasn't a URL. You ask us how to go about validating a URL, but then your example isn't a URL. So either you want us to help you validate a URL, or you want us to help you validate... whatever concept you have of what a "URL" is.

    Quote Originally Posted by Lord Yggdrasill View Post
    Perhaps it is technically not a url, but it has nothing to do with the topic of finding a way to validate it.
    It has everything to do with the topic of finding a way to validate "it", because you named this thread "How do you validate a url..." and even started talking about URLs in the body of your post.

    Look at it a different way; if someone posted a thread entitled "How to validate integers" and gave you an example of an 'integer' they were trying to validate as being the word "banana." What would your response be if they asked "... how to validate an integer of this type?"

    Wouldn't you point out the fact that "banana" is not an integer, meaning it's futile trying to validate it as one?

    Quote Originally Posted by Lord Yggdrasill View Post
    You just keep digressing from the topic, what do you accomplish by proving that is not a url anyway?
    Actually, you are the one who keeps digressing from the topic, because you still have yet to more fully (and correctly) describe what it is you're attempting to validate. Once you get over your little temper tantrum here and decide to actually do that, you might also want to explain in what way you're trying to "validate" it. For example, are you just validating the form of (whatever "it" is that we're talking about... or, rather, what I'm trying to talk about)? Or are you also trying to check the actual value for correctness (i.e. it not only fits the form of whatever "it" is, but it is also meaningful in the context of your website/CMS/whatever)?

    Quote Originally Posted by Lord Yggdrasill View Post
    To prove that there's no way to validate it 'cause 'its not a url!' Or just to prove how great a programmer you are compared to everybody else on this forum?
    Eh, the only thing I'm trying to prove at this point is that you do a less than stellar job at explaining your problem, an abysmal job at handling being corrected/informed, and... well, you're actually doing fairly well as far as amusing me with your childishness and ignorance.

    Quote Originally Posted by Lord Yggdrasill View Post
    lmao.
    Indeed! (I'm assuming you're referencing the acronym "laughing my ass off"; just thought I'd explicitly state this, since I personally realize that: a) this isn't a chatroom, and b) I actually did chuckle a bit while reading your replies.)

  7. #7
    Senior Member
    Join Date
    Sep 2011
    Posts
    258
    Alright I am amused at how you spent tens of minutes writing another junk reply, you keep entertaining me with your stupidity. Calling others childish and ignorant, how about a quick reality-check on yourself?

    If you have seen my posts before, I am not the type who refuse to listen to criticisms. I take them with sincerity, especially when it comes down to real constructive ones. The problem with you is that you aint even a critic. You are a flamer, if not just a spammer.

    And okay its not a url, it is not a url! So what? What you were arguing is no different from geeks getting mad at their friends chit-chatting with grammatical errors. Does it really change or prove anything? What people are trying to do is to convey a message, while you miss out what is actually inside that message with your snobbish attitude. It only shows what a know-all you are, and that you just want to start fire on something out of nothing.

    To imagine that you have 18k posts, I must say I aint surprised you made more spams than my total posts on this forum. On this aspect you are a legend, I bow down to you.

  8. #8
    Pna lbh ernq guvf¿
    Join Date
    Jul 2004
    Location
    Kansas City area
    Posts
    19,354
    Quote Originally Posted by Lord Yggdrasill View Post
    Alright I am amused at how you spent tens of minutes writing another junk reply
    Actually, you're incorrect on both counts there. I "spent" most of (however) many minutes it was watching an old NCIS episode; it was only until a commercial break that I actually composed the bulk of my reply. And it wouldn't be "junk" to you if you had actually read the part where I tried to help you (which I've actually done in every reply in this thread). Granted, the helpful bits have been buried since I feel almost obligated to respond to your increasingly immature and/or incorrect remarks.

    Quote Originally Posted by Lord Yggdrasill View Post
    And okay its not a url, it is not a url! So what?
    So why did you miss the entire part of my post where I suggested you explain what it is we're supposed to be helping you with? The fact that I keep trying to help you and you keep responding with nothing but name calling and whatnot almost suggest that you are the childish "flamer, if not just a spammer" here. I challenge you to prove me wrong by actually posting a useful reply for once.

    Quote Originally Posted by Lord Yggdrasill View Post
    I must say I aint surprised you made more spams than my total posts on this forum.
    You may not be surprised, but I sure am! How you were able to review a majority of my posts on this board in such a short period of time astonishes me. Almost as much as the fact that you keep spewing drivel reply after reply rather than providing more information about your problem. Almost.

    Quote Originally Posted by Lord Yggdrasill View Post
    you are a legend, I bow down to you.
    Thanks! When you've finished bowing and have returned to keyboard-height, perhaps you'll finally get back on topic?

  9. #9
    Senior Member
    Join Date
    Sep 2011
    Posts
    258
    Alright you are trying to 'help' me, to help me realize that I havent used Microsoft Frontpage in ages? Or maybe just to help me understand what a spammer you are? On this aspect you already succeeded a long time ago, lol.
    http://board.phpbuilder.com/showthre...1#post11018755

    And your lack of comprehensibility never fails to amuse me. When did I say I actually spent such a great amount of time and trouble going over your 18k of useless posts? Your postcount is available right below your username and join date, thats the only thing I know of. Knowing you, it is just a total waste of time to even go over all your posts to tell the majority of them are spams. Its not that difficult to tell.

    lol you are acting like I was the one digressing from the topic, nice try. Whats the point discussing the topic with you anyway? Your only contribution is to show its not a url and proves why it is not, but who cares? User input data aint url, but there are ways to validate them. Whats important about this thread is how you validate controller mod_rewrite urls(oh okay, I dont have a better word to describe what that thing is), not whether they technically are urls or not.
    Last edited by Lord Yggdrasill; 12-13-2012 at 02:08 AM.

  10. #10
    Pna lbh ernq guvf¿
    Join Date
    Jul 2004
    Location
    Kansas City area
    Posts
    19,354
    Quote Originally Posted by Lord Yggdrasill View Post
    Alright you are trying to 'help' me, to help me realize that I havent used Microsoft Frontpage in ages? Or maybe just to help me understand what a spammer you are? On this aspect you already succeeded a long time ago, lol.
    http://board.phpbuilder.com/showthre...1#post11018755
    Why do you keep referencing that thread? I already admitted I had absolutely no intention of trying to provide a constructive reply in that thread (for a number of reasons - but that's neither here nor there). The horse is dead. Please stop beating it?

    Quote Originally Posted by Lord Yggdrasill View Post
    When did I say I actually spent such a great amount of time and trouble going over your 18k of useless posts?
    It was implied in your previous reply and in that very statement right there. How would you know how many of my posts were "useless" without examining them? Now, you may be assuming that is the case; this I can certainly understand. Based on your ignorant and argumentative responses in this thread, I wouldn't doubt that most of my responses would appear to be useless to you in the same way that a mathematician's explanation of the fundamentals of calculus would be useless to a toddler.

    Quote Originally Posted by Lord Yggdrasill View Post
    you are acting like I was the one digressing from the topic, nice try.
    Wasn't an attempt of any sort - more of a statement of fact. Towards the end of your latest reply you finally attempted to describe more about (what you initially called a URL).

    Quote Originally Posted by Lord Yggdrasill View Post
    Whats the point discussing the topic with you anyway?
    With me personally? Well, little to none at this point; I lost all desire of actually helping you - other than attempting to get you to explain your request in more detail - several replies ago.

    Quote Originally Posted by Lord Yggdrasill View Post
    Your only contribution is to show its not a url and proves why it is not, but who cares? User input data aint url, but there are ways to validate them.
    I agree, but without knowing what the data is versus what it is not then there's not much hope in figuring out which method of validation is applicable. My point in establishing that your example data is not a URL was to try to get you to explain what it is you're wanting to validate (and how/in what way).

  11. #11
    Senior Member traq's Avatar
    Join Date
    Jun 2011
    Location
    so.Cal
    Posts
    949
    Lord Yggdrasill: calm down. yes, brad's right; yes, he was on-topic and being helpful.

    Yes, he was being blunt, but why beat around the bush?

    The reason you're having a hard time validating that particular string as a URL is because it isn't a URL.

    That's the root cause of your problem.

    Trying to fix anything else before straightening that out is a waste of time, which is what his answer implied.

    Straight, concise answers are not disparaging, hypocritical, or rude.
    Unexpected answers are not (necessarily) useless or off-topic.
    Answers where you are left to deduce some of the implications on your own are not spam.
    Last edited by traq; 12-13-2012 at 02:41 AM.

  12. #12
    Senior Member
    Join Date
    Sep 2011
    Posts
    258
    Well still does not explain what he said in that earlier thread I brought up... You have to agree that he was clearly trolling there. And why cant I bring up that thread, without him trolling me in that thread I wouldnt have gotten mad at him here. Its the root of all these meaningless debate.

    Anyway no matter whether it is a url or not, there should be a way to validate it. If you can lemme know what it is, Id appreciate.
    Last edited by Lord Yggdrasill; 12-13-2012 at 03:40 AM.

  13. #13
    PHP Witch laserlight's Avatar
    Join Date
    Apr 2003
    Location
    Singapore
    Posts
    13,461
    Quote Originally Posted by Lord Yggdrasill
    Well still does not explain what he said in that earlier thread I brought up... You have to agree that he was clearly trolling there. And why cant I bring up that thread, without him trolling me in that thread I wouldnt have gotten mad at him here. Its the root of all these meaningless debate.
    Sure, but it is your loss if you want to derail your own thread. Personally, I tend to just forget about these things after awhile as there is no point having a personal vendetta.

    Quote Originally Posted by Lord Yggdrasill
    Anyway no matter whether it is a url or not, there should be a way to validate it. If you can lemme know what it is
    So, what exactly are you trying to validate? That has been the crux of this thread from the beginning. In particular:
    Quote Originally Posted by bradgrafelman
    you might also want to explain in what way you're trying to "validate" it. For example, are you just validating the form of (whatever "it" is that we're talking about... or, rather, what I'm trying to talk about)? Or are you also trying to check the actual value for correctness (i.e. it not only fits the form of whatever "it" is, but it is also meaningful in the context of your website/CMS/whatever)?
    At the very least, start describing what you are trying to validate, e.g., using a regular expression or even BNF notation. It might not be exactly what you want on your first try, but it is a start. I'm also considering the possibility that you are trying to detect such text within some larger text... is that what you are trying to do?
    Use Bazaar for your version control system
    Read the PHP Spellbook
    Learn How To Ask Questions The Smart Way

  14. #14
    Un Re Member cretaceous's Avatar
    Join Date
    Sep 2004
    Location
    London UK
    Posts
    934
    Surely our Lord Yggdrasil is trying to check if each directory, in the path he shows, actually exists

    A simple recursive function should be easy enough using file_exists and is_dir
    The server will return a 404 error if item does not exist prior to running a php script

    I daresay the Lord Y will feel obliged to make it into an OOP class though
    (hence the esteemed Mr BG's dig at using Smarty - a nod to the 'kiss' principle)
    Last edited by cretaceous; 12-13-2012 at 09:02 AM.

  15. #15
    Senior Member traq's Avatar
    Join Date
    Jun 2011
    Location
    so.Cal
    Posts
    949
    He may also be trying to determine if the "path" is a valid URI (maybe an actual directory, maybe not - he was talking about a class for URIs in the form of controller/action/argument in an earlier thread - though his original example does look a lot like a filesystem path fragment).

    In any case, I think we need to hear more from him on the topic, or we won't get anywhere.

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
  •