1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Finding users by reg.date

Discussion in 'XenForo Questions and Support' started by Garamond, Sep 23, 2011.

  1. Garamond

    Garamond Well-Known Member

    How do I find which users registered at a specific date?
     
  2. ragtek

    ragtek Guest

    There's no way for this in xf, so IMO you'll need to use phpmyadmin / or an add-on

    OR, in acp => search user => Visited since date:xxx
     
  3. Floris

    Floris Guest

    Code:
    SELECT * FROM `xf_user` WHERE `register_date`= 1286344241
    
    random number = timestamp of the date you're looking for.

    output: http://xenfans.com/_heyho/
    input:
    PHP:
    <?php // nice and dirty code

    mysql_connect("localhost""dbuser""dbpass") or die(mysql_error()); // connect to database
    mysql_select_db("dbname") or die(mysql_error()); // select database

    $timestamp '1286344241';

    $page_query mysql_query("SELECT * FROM xf_user WHERE register_date = $timestamp") or die(mysql_error());

    // using while in case we wanna do more stuff or have to handle more results (unlikely since we're dealing with timstamps though)
    while ($row mysql_fetch_assoc($page_query)) {
    $username $row['username'];
    }

    $datetime date("Y-m-d H:i:s"$timestamp);

    echo 
    "timestamp $timestamp = date: $datetime and it seems that it's $username";
     
    Garamond likes this.
  4. ragtek

    ragtek Guest

    or

    SELECT * FROM xf_user WHERE register_date
    BETWEEN UNIX_TIMESTAMP('2010-01-01 00:00:00') AND UNIX_TIMESTAMP('2001-01-02 00:00:00')

    (it's easier to read & understand, or?;)
     
    Garamond likes this.
  5. Floris

    Floris Guest

    Not just easier ragtek, it means you can ignore "time" since it's very very precise and super hard to 'guess'.
    Adding a form with input fields to let you find in between dates + output multiple results == very handy.
     
  6. Garamond

    Garamond Well-Known Member

    Thanks guys :)
     

Share This Page