The MU forums have moved to WordPress.org

A link to a random blog? (48 posts)

  1. dude47
    Member
    Posted 17 years ago #

    any ideas yet on this?

    I need some help to this also? It´s weird.

  2. dude47
    Member
    Posted 17 years ago #

    OK, It works now.

    I just copied everything inside next.php and pasted it to new file and named it next2.php.

  3. yoyopop
    Member
    Posted 17 years ago #

    I was having difficulty getting this one to work but I found this one works really well, just edit the output a bit to get the format you need.

  4. sadwargamer
    Member
    Posted 16 years ago #

    Hi all,

    I was unable to get the Random blog working with both versions of Next.php on my Admin Bar. So i took a look around the web and basically used php.net example with only a few changes.

    Now I am "very" new to PHP and not a programmer of any languages by a long way - but once this is inserted (once for logged in and once for visitors) the it seems to work fine - which meets my simple needs.

    I am no doubt sure that there is much more elegant code out there and I would be more than willing to use that if it works - anyhow thought I would share.


    /* here we go with my own version of a random blog entry! */

    // Formulate Query
    // This is the best way to perform a SQL query
    // For more examples, see mysql_real_escape_string()
    $query = sprintf("SELECT domain FROM wp_blogs ORDER BY RAND( ) LIMIT 1",
    mysql_real_escape_string($domain));
    // Perform Query
    $result = mysql_query($query);

    // Check result
    // This shows the actual query sent to MySQL, and the error. Useful for debugging.
    if (!$result) {
    $message = 'Invalid query: ' . mysql_error() . "\n";
    $message .= 'Whole query: ' . $query;
    die($message);
    }

    // Use result
    // Attempting to print $result won't allow access to information in the resource
    // One of the mysql result functions must be used
    // See also mysql_result(), mysql_fetch_array(), mysql_fetch_row(), etc.

    echo "\n\t

  5. <a href=\"http://";
    while ($row = mysql_fetch_assoc($result)) {
    echo $row['domain'];
    }
    echo "/\">Random Blog
  6. ";
    // Free the resources associated with the result set
    // This is done automatically at the end of the script
    mysql_free_result($result);

    /* end of my randowm blog stuff*/

  • reggordon
    Member
    Posted 16 years ago #

    Thanks for this Dr Mike works great and very handy for me to get about all my blogs and randomly fix what needs fixed (with mu admin bar) I have a blog or 2 that i would like to not show when using the next.php. Would this be possible?

    thanks and im sorry if this is answered elsewhere. I tink ive read everything in this forum the lst 24hrs

  • bwinn
    Member
    Posted 16 years ago #

    any update on this? I am still looking for a random blog plugin that works.

  • dsader
    Member
    Posted 16 years ago #

    This is all that's in my next.php:

    # Using existing login and password
    include('wp-config.php');

    # SQL Query
    $sql="SELECT * FROM wp_blogs WHERE public = '1' AND mature = '0' AND spam = '0' AND deleted = '0' AND blog_id != '1' ORDER BY RAND() LIMIT 1";

    #Get the results
    $result = mysql_query($sql);

    #Get the random domain selected
    $variable = mysql_result($result,0, 'domain') . mysql_result($result,0, 'path');

    #Refresh Blog
    header("Location: http://$variable");

  • bwinn
    Member
    Posted 16 years ago #

    well how many different files are in the random blog plugin? Is there somewhere I can download this? Or is it just next.php?

  • bwinn
    Member
    Posted 16 years ago #

    got it thanks!

  • bwinn
    Member
    Posted 16 years ago #

    i am however, wondering if there is a way i can block certain blogs from showing up in the random blogs... anyone know a good way to do this? thanks!

  • qza
    Member
    Posted 16 years ago #

    Me too. I also don't want postless blogs to appear when someone clicks on next.

  • andrea_r
    Moderator
    Posted 16 years ago #

    Why not add to the SQL to pick from a recently updated blog?

  • bwinn
    Member
    Posted 16 years ago #

    Anyone with any advice on how to block specific blogs from showing up??

  • MazZziKa
    Member
    Posted 16 years ago #

    thx .. work great

  • imgoel
    Member
    Posted 16 years ago #

    @bwinn
    hi, can you provide me the link to the plugin or could u send it to admin @ goelji.com

  • bwinn
    Member
    Posted 16 years ago #

    Well I am not using a plugin... Here's how you do it.

    Create a file, copy and paste the code below and name the file next.php

    # Using existing login and password
    include('wp-config.php');

    # SQL Query
    $sql="SELECT * FROM wp_blogs WHERE public = '1' AND mature = '0' AND spam = '0' AND deleted = '0' AND blog_id != '1' ORDER BY RAND() LIMIT 1";

    #Get the results
    $result = mysql_query($sql);

    #Get the random domain selected
    $variable = mysql_result($result,0, 'domain') . mysql_result($result,0, 'path');

    #Refresh Blog
    header("Location: http://$variable");

    The place the next.php file in your root.

    Then somewhere in your navigation, include the following:

    <link to next.php>Random Blog<close link>

    It's as simple as that, no need for a plugin here.

  • randomWebmaster
    Member
    Posted 15 years ago #

    Actually a new website is here that does what you want, go visit it at http://www.randomblogblog.com and submit your blogs there

    regards
    Random Webmaster

  • boonika
    Member
    Posted 15 years ago #

    @randomWebmaster - An old project of mine but still working but I don't think that's the topic theme here:
    http://boonika.org/

  • 1 2

    About this Topic