Help Me! PHP issue!

Discussion in 'PHP' started by alvarez16, Jan 5, 2007.

  1. #1
    I want to make a script that will visit my forums and view each thread once so it will boost up the view count, how can I do that?

    Basically a script that will visit the a url such as: http://forums.digitalpoint.com/showthread.php?t=211864, then /showthread.php?t=211865, and so on.

    This is what I have so far:


    What other way can I do this?

    Thanks
     
    alvarez16, Jan 5, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    
    UPDATE vb_thread SET views = (views + 1)
    
    Code (sql):
     
    nico_swd, Jan 5, 2007 IP
  3. venetsian

    venetsian Well-Known Member

    Messages:
    1,105
    Likes Received:
    61
    Best Answers:
    0
    Trophy Points:
    168
    #3
    Cheating .. Cool.

    The sql query is the best solution
     
    venetsian, Jan 5, 2007 IP
  4. alvarez16

    alvarez16 Well-Known Member

    Messages:
    1,315
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    150
    #4
    Yes, but I need a script that will load the page over and over.

    Thanks
     
    alvarez16, Jan 5, 2007 IP
  5. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #5
    Why? Do you want to increase the views slowly?

    You can do something like this.


    
    
    // Keep the script running in the background, even if browser window has been closed.
    ignore_user_abort();
    set_time_limit(0);
    
    for ($i = 0; $i < 1000; $i++)
    {
          mysql_query('UPDATE vb_thread SET views = (views + 1)');
     
          sleep(60); // Wait a minute and run update again.
    }
    
    PHP:
    This would increase the views to the current views plus 1000, one by one each minute.
     
    nico_swd, Jan 5, 2007 IP
  6. Barti1987

    Barti1987 Well-Known Member

    Messages:
    2,703
    Likes Received:
    115
    Best Answers:
    0
    Trophy Points:
    185
    #6
    
    <?php
    $start_thread = '0';
    $end_thread = '3000000';
    
    if($_GET['do'] == NULL){ $do = $start_thread;}else{$do = $_GET['do'];}
    
    $next_do = $do+1;
    if($next_do > $end_thread){ die ('Done');}
    ?>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Refresh" content="0; url=<?=$_SERVER['PHP_SELF'].'?do='.$next_do;?>">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    </head>
    <body>
    <div align="center"><iframe src="http://forums.com/showthread.php?t=<?=$do;?>" frameborder="1" width="400" height="400"></iframe></div>
    </body>
    </html>
    
    
    PHP:
    Peace,
     
    Barti1987, Jan 5, 2007 IP