Jump to content

wwfc_barmy_army

Members
  • Posts

    320
  • Joined

  • Last visited

    Never

Posts posted by wwfc_barmy_army

  1. Hello.

     

    I have a form for where a domain is submitted. Although i only need the base domain so no subdomains.

     

    I'm guessing it will be some kind of str_replace or preg_match but i'm unsure what it would be.

     

    So if for example mail.google.com was submitted the value i want is google.com, and if google.com is submitted i want google.com.

     

    Thanks for any advice/code.

  2. Hello.

     

    I currently use this to check if they have submitted a valid domain:

     

    preg_match ("/^[a-z0-9][a-z0-9\-]+[a-z0-9](\.[a-z]{2,4})+$/i", $domain)

     

    Works for example google.com but not for example mail.google.com.

     

    So if there an easy way to accept subdomains too?

     

    Thanks.

  3. Hello everyone.

     

    Basically I have this htaccess rule:

     

    RewriteEngine On
    RewriteRule ^([^/]+)?/?$ index.php?do=$1 [L,QSA]

     

    But when i go to any of the following it runs the rule

    -mydomain.com/adirectory

    -mydomain.com/adirectory/

     

    But this loads like it should:

    -mydomain.com/adirectory/index.php

     

    Can i give exceptions to the rule for certain domains so for example

    -mydomain.com/adirectory

    goes to the subdirectory rather than following the htaccess rule?

     

    Thanks.

  4. Hello.

     

    I have this rewrite code now:

     

    RewriteEngine On
    RewriteRule ^(.+)$ index.php?do=$1
    RewriteRule ^(.+)/$ index.php?do=$1

     

    The 'do' variable holds a domain name. So it would be something like:

    http://mydomain.com/domain.com

     

    So domain.com is what I am after.

     

    It goes to index.php ok, no problems there. BUT when i try to get the 'do' variable it says it's 'index.php'.

     

    Any ideas?

     

    Thanks.

  5. Hello.

     

    I'm not sure how to go about this but I am wondering how to use a peice of info (a domain) from the address bar. To explain I will use the example of domaintools.com.

    When you put an address into the text box (in this example google.com) and click submit the address turns to:

    http://whois.domaintools.com/google.com

     

    I am just wondering how you are able to a) load the page even with that domain at the end b) Get that domain as a variable to use from the domain.

     

    Thanks for any advice/code.

     

    (P.s. I am not creating a whois site lol)

  6. I seriously doubt you'll be able to find a good one, much less a free good one.  (Well, you never said free, but just assuming.)

     

    Wouldn't mind if it was paid within reason. Any suggestions would be welcomed. Thanks.

  7. Anyone know where i might be able to find a UK car database list, presumably similar to what people like autotrader.co.uk use?

     

    Not sure which section this belonged in.

     

    Thanks.

  8. Hello.

     

    I'm using this as fuctions for a web scrape:

    http://sourceforge.net/projects/simplehtmldom/

     

    I've figured out everything else but i just have one last thing i'm having trouble with; using $html->plaintext allows me to output all text on the webpage. Although i am looking just to get a certain line;

     

    The source page has a line like the following:

    Password: apassword

     

    this is shown in the $html->plaintext output but seems to be all on one line from what i can tell.

     

    So my question, how can i just get the line that starts with "Password: "?

     

    Thanks for any help/advice/code.

     

  9. Hello.

     

    I'm working on a scraping script and I just need to get this last thing; I need to get the line of text that starts with "Password:".

     

    Can i use this bit of code:

    // extract text from HTML
    echo $html->plaintext;

     

    And use some kind of if statement after? Or is there a better way?

     

    Thanks for any advice/code :)

  10. preg_match is used for regular expressions. If you want to learn more about it, I suggest you just google "create regular expression"

     

    However, instead of looking for a regular expression, you should be able to use strpos, and it should fix your little problem. :)

     

    
    $site = 'http://mysite.com';
    
    foreach($html->find('a') as $e)
    {
    
        if ( strpos($e->href, $site) == true )
        {
        echo $e->href . '<br>';
        }
    
    }
    
    
    

     

     

    Thanks it worked. Couldn't get it to work with 'http://mydomain.com' had to just use 'mydomain.com' any reason for this?

     

    Thanks.

  11. Hello.

     

    I'm trying some PHP scraping, as i've never done anything like this before and i'm still reasonably new to php.

     

    I've got it so it can display all links using this code:

    foreach($html->find('a') as $e) 
        echo $e->href . '<br>';

     

    I want it so it only shows links to a certain domain. Eg. only show links to http://mydomain.com or http://www.mydomain.com.

     

    any ideas how i could do this? Some kind of preg match? ???

     

    Thanks.

     

     

  12. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(count = count +1, reasons = 'ftugsdt

    - dasfdsfsd') WHERE username = 'TUSER' at line 1

     

     

    and if i take the new line out of $newreason:

    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(count = count +1, reasons = 'ftugsdt - sdfgds') WHERE username = 'TUSER'' at line 1

     

    Any ideas?

     

    Thanks.

  13. Hello. I can't figure out what is wrong with my SQL code, but it keeps failing

     

      $query = "UPDATE previous SET (count = count +1, reasons = $newreason) WHERE username = '$username'";
      echo $query;
       mysql_query($query) or die('Error, query failed');

     

    Currently outputting:

    UPDATE previous SET (count = count +1, reasons = ftugsdt

    - sdfgd) WHERE username = 'TUSER'  Error, query failed

     

    Thanks for any help.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.