Help with syntax - if domain name exists

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • affiliateian@gmail.com

    Help with syntax - if domain name exists

    I am pretty new to php. Can anyone tell me what the proper syntax is
    for checking a particular domain from a web form? For instance, I am
    looking for an if statement that accomplishes this:

    if ($domain=*.mydo main.com)

    For some reason, can't get the proper syntax so that sciprt will take.
    Thoughts?

  • C.

    #2
    Re: Help with syntax - if domain name exists


    affiliateian@gm ail.com wrote:
    I am pretty new to php. Can anyone tell me what the proper syntax is
    for checking a particular domain from a web form? For instance, I am
    looking for an if statement that accomplishes this:
    >
    if ($domain=*.mydo main.com)
    >
    For some reason, can't get the proper syntax so that sciprt will take.
    try:

    if (fnmatch("*,myd omain.com", $domain)) {

    C.

    Comment

    • Colin Fine

      #3
      Re: Help with syntax - if domain name exists

      C. wrote:
      affiliateian@gm ail.com wrote:
      >I am pretty new to php. Can anyone tell me what the proper syntax is
      >for checking a particular domain from a web form? For instance, I am
      >looking for an if statement that accomplishes this:
      >>
      >if ($domain=*.mydo main.com)
      >>
      >For some reason, can't get the proper syntax so that sciprt will take.
      >
      try:
      >
      if (fnmatch("*,myd omain.com", $domain)) {
      >
      C.
      >
      That should read

      if (fnmatch("*.myd omain.com", $domain)) {


      Note that php.net says:

      "For now this function is not available on Windows or other non-POSIX
      compliant systems."

      so if you're on such a system, you may need a more general solution:

      if (preg_match('/\.mydomain.com$/', $domain)) {

      which will match any string ending ".mydomain.com" .

      Colin

      Comment

      • affiliateian@gmail.com

        #4
        Re: Help with syntax - if domain name exists

        Colin Fine wrote:
        if (fnmatch("*.myd omain.com", $domain)) {
        That worked. 5 star rating for your post!

        Thanks again!

        Comment

        Working...