Results 1 to 5 of 5

Thread: random video fuction made me crazy

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2009
    Posts
    71

    Default

    Hi,

    If you want to remove random videos, please do the following steps

    Find and remove

    1.htaccess
    Code:
    RewriteRule ^random/(.*) video.php?category=random&page=$1
    2.video.php

    FIND

    PHP Code:
    $category_all = array(
        
    'random',
        
    'recent',
        
    'viewed',
        
    'discussed',
        
    'favorites',
        
    'rated',
        
    'featured'
    ); 
    REPLACE WITH

    PHP Code:
    $category_all = array(
        
    'recent',
        
    'viewed',
        
    'discussed',
        
    'favorites',
        
    'rated',
        
    'featured'
    ); 
    FIND AND REMOVE

    PHP Code:
    else if ($category == 'random')
        {
            
    $view['html_title'] = 'Random Videos';
            
    $view['display_order'] = 'Random';
            
    $sql "SELECT * FROM `videos` WHERE
                   `video_type`='public' AND
                   `video_active`='1' AND
                   `video_approve`='1'
                    
    $channel_sql
                    
    $sql_adult_filter
                    ORDER BY rand()
                    LIMIT 
    $start_from$config[num_watch_videos]";
        } 
    3.templates/menu_watch.tpl

    FIND AND REMOVE

    Code:
    <li><a href="{$base_url}/{if $smarty.request.viewtype eq "detailed"}detailed/{/if}random/">Random</a></li>
    Thanks

    Buyscripts Team

  2. #2
    Join Date
    Sep 2010
    Location
    Pokhara Nepal
    Posts
    49

    Default i got second message from my hosting, could you please help me?

    Quote Originally Posted by vshare View Post
    Hi,

    If you want to remove random videos, please do the following steps

    Find and remove

    1.htaccess
    Code:
    RewriteRule ^random/(.*) video.php?category=random&page=$1
    2.video.php

    FIND

    PHP Code:
    $category_all = array(
        
    'random',
        
    'recent',
        
    'viewed',
        
    'discussed',
        
    'favorites',
        
    'rated',
        
    'featured'
    ); 
    REPLACE WITH

    PHP Code:
    $category_all = array(
        
    'recent',
        
    'viewed',
        
    'discussed',
        
    'favorites',
        
    'rated',
        
    'featured'
    ); 
    FIND AND REMOVE

    PHP Code:
    else if ($category == 'random')
        {
            
    $view['html_title'] = 'Random Videos';
            
    $view['display_order'] = 'Random';
            
    $sql "SELECT * FROM `videos` WHERE
                   `video_type`='public' AND
                   `video_active`='1' AND
                   `video_approve`='1'
                    
    $channel_sql
                    
    $sql_adult_filter
                    ORDER BY rand()
                    LIMIT 
    $start_from$config[num_watch_videos]";
        } 
    3.templates/menu_watch.tpl

    FIND AND REMOVE

    Code:
    <li><a href="{$base_url}/{if $smarty.request.viewtype eq "detailed"}detailed/{/if}random/">Random</a></li>
    Thanks

    Buyscripts Team
    I got another message from my hosting and i want to ractify the situation could you please help me?
    here is the message i got;
    Hello,
    I wrote you 1 month ago about your database "clovidz" and your use of
    "order by rand()". I haven't head a response from you, and this morning
    the mysql server had high load due to these queries still causing issues.
    The below queries are taking 200 to 300+ seconds to run, processing
    53000 records and must randomize a large amount of data to return the 20
    records. Due to no response about the slow queries using more than your
    fair share of the mysql server, I am moving your databases to a MySQL VPS
    until this issue is fixed. You can write me at [email protected] when
    this has been removed from your site, and I can move you back to shared
    hosting. The first week of MySQL VPS is free, so if you can fix it
    within the first week, no charges will be placed on your account.
    # Query_time: 395.613946 Lock_time: 0.050090 Rows_sent: 20
    Rows_examined: 53224
    use clovidz;
    SELECT * FROM `videos` WHERE
    `video_type`='public' AND
    `video_active`='1' AND
    `video_approve`='1'
    ORDER BY rand()
    LIMIT 13900, 20;
    # Query_time: 586.654760 Lock_time: 0.008073 Rows_sent: 20
    Rows_examined: 49704
    use clovidz;
    SELECT * FROM `videos` WHERE
    `video_type`='public' AND
    `video_active`='1' AND
    `video_approve`='1'
    ORDER BY rand()
    LIMIT 10380, 20;
    # Query_time: 528.365574 Lock_time: 0.000146 Rows_sent: 20
    Rows_examined: 55844
    use clovidz;
    SELECT * FROM `videos` WHERE
    `video_type`='public' AND
    `video_active`='1' AND
    `video_approve`='1'
    ORDER BY rand()
    LIMIT 16520, 20;
    Thanks!
    Justin K
    Nepal's Largest video community portal. share wisely at WWW.CLONEVIDEOS.COM

  3. #3

    Default

    Hi,

    To solve issues by mysql rand() function, do the following.


    Open video.php

    find:
    Code:
    $sql = "SELECT * FROM `videos` WHERE
                   `video_type`='public' AND
                   `video_active`='1' AND
                   `video_approve`='1'
                    $channel_sql
                    ORDER BY rand()
                    LIMIT $start_from, $config[num_watch_videos]";
    replace with:
    Code:
    $rand_start = rand($start_from, $view['total'] - $config['num_watch_videos']);
            $sql = "SELECT * FROM `videos` WHERE
                   `video_type`='public' AND
                   `video_active`='1' AND
                   `video_approve`='1'
                    $channel_sql
                    LIMIT $rand_start, $config[num_watch_videos]";
    If you can't do it, open a support ticket at

    BuyScripts Helpdesk

    with your vshare admin and FTP login details.

    Thanks

    Buyscripts Team

  4. #4
    Join Date
    Sep 2010
    Location
    Pokhara Nepal
    Posts
    49

    Default i did not fine the codes in my video.php file

    i did not find the code that you have mentioned in your earlier message.
    you wrote:

    To solve issues by mysql rand() function, do the following.


    Open video.php

    find:

    Code:
    $sql = "SELECT * FROM `videos` WHERE `video_type`='public' AND `video_active`='1' AND `video_approve`='1' $channel_sql ORDER BY rand() LIMIT $start_from, $config[num_watch_videos]";
    replace with:

    Code:
    $rand_start = rand($start_from, $view['total'] - $config['num_watch_videos']); $sql = "SELECT * FROM `videos` WHERE `video_type`='public' AND `video_active`='1' AND `video_approve`='1' $channel_sql LIMIT $rand_start, $config[num_watch_videos]";
    If you can't do it, open a support ticket at

    could you please check. i have just created a support ticket for you with my login details.
    Nepal's Largest video community portal. share wisely at WWW.CLONEVIDEOS.COM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •