Announcement

Collapse
No announcement yet.

How to make these codes working with 2.0 ?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to make these codes working with 2.0 ?

    How to make these code vb2 complient ?
    They work on 1.15, but on 2.0 I get error message:

    Code:
    Warning: MySQL Connection Failed: Access denied for user: '[email protected]' (Using password: NO) in /var/www/test2.php on line 4
    
    Warning: Supplied argument is not a valid MySQL-Link resource in /var/www/test2.php on line 7
    
    Warning: Supplied argument is not a valid MySQL result resource in /var/www/test2.php on line 8
    Greetings to our newest member, !

    PHP Code:
    To show last registered member:
    <?php
    require("/full/path/to/admin/config.php");
    $db=mysql_connect($servername,$dbusername,$dbpassword);
    mysql_select_db($dbname);
    $query "select * from user order by userid desc limit 1";
    $resultlatest mysql_query($query,$db);
    $latest_array mysql_fetch_array($resultlatest);
    echo 
    "<FONT FACE=\"Verdana, Arial, Helvetica, sans-serif\" SIZE=\"2\"><b>Greetings to our newest member, <a href=\"http://www.extremeforums.com/forums/member.php?action=getinfo&userid=$latest_array[userid]\" target=_blank>$latest_array[username]</a> !</b></font>";
    ?>
    PHP Code:
    To show total number of members:
    <?php
    require("/full/path/to/admin/config.php");
    $db=mysql_connect($servername,$dbusername,$dbpassword);
    mysql_select_db($dbname);
    $query "select * from user";
    $resultlatest mysql_query($query,$db);
    $num mysql_num_rows($resultlatest);
    echo 
    "<FONT FACE=\"Verdana, Arial, Helvetica, sans-serif\" SIZE=\"2\">There are currently <b>$num</b> registered members.</font>";
    ?>
    PHP Code:
    To show total posts number:
    <?php
    require("/full/path/to/admin/config.php");
    $db=mysql_connect($servername,$dbusername,$dbpassword);
    mysql_select_db($dbname);
    $query "select * from post";
    $resultlatest mysql_query($query,$db);
    $num mysql_num_rows($resultlatest);
    echo 
    "<FONT FACE=\"Verdana, Arial, Helvetica, sans-serif\" SIZE=\"2\">There are currently <b>$num</b> posts on the forums.</font>";
    ?>
    Thanks,

  • #2
    I just put stuff like this in the vBulletin Admin Directory and don't have problems, as can seen by our active topics at SitePoint.com. Once this is done, we include the file where it is needed.
    Translations provided by Google.

    Wayne Luke
    The Rabid Badger - a vBulletin Cloud demonstration site.
    vBulletin 5 API

    Comment


    • #3
      Well even in the admin directory I got the same result ?!
      Could this be because my forum2 directory is htaccess password protected ??

      Comment


      • #4
        Ok Wluke, could you please paste here the file code that generate the total member on your page ?
        I'd like to have a precise look at it please.
        Also the "there are currently xx members and xx guest" would be cool

        Thanks,

        Comment

        widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
        Working...
        X