Changeset 4700

Show
Ignore:
Timestamp:
01/17/06 16:40:54 (2 years ago)
Author:
GamerZ
Message:

Fixed Exploit

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • wp-stats/trunk/readme.txt

    r4573 r4700  
    1414- FIXED: Page Permalink Issues 
    1515- FIXED: Error If User Has Not Posted Comment 
     16- FIXED: Page Navigation if There Are 0 or 1 Page. 
     17- FIXED: Exploit $comment_author 
    1618 
    1719// Version 2.00 (01-01-2006) 
  • wp-stats/trunk/wp-stats.php

    r4573 r4700  
    268268            // Comment Author Link 
    269269            $comment_author_link = urlencode($comment_author); 
     270            // Comment Author SQL 
     271            $comment_author_sql = $wpdb->escape($comment_author); 
    270272            // Total Comments Posted By User 
    271             $totalcomments = $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_author='$comment_author'"); 
     273            $totalcomments = $wpdb->get_var("SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_author='$comment_author_sql'"); 
    272274            // Checking $page and $offset 
    273275            if (empty($page) || $page == 0) { $page = 1; } 
     
    281283            $totalpages = ceil($totalcomments/$perpage); 
    282284            // Getting The Comments 
    283             $gmz_comments =  $wpdb->get_results("SELECT $wpdb->posts.ID, comment_author, comment_date, comment_content, ID, comment_ID, post_date, post_title, post_name FROM $wpdb->comments INNER  JOIN $wpdb->posts ON $wpdb->comments.comment_post_ID = $wpdb->posts.ID WHERE comment_author =  '$comment_author' AND comment_approved = '1' AND post_date < '".current_time('mysql')."' AND (post_status = 'publish' OR post_status = 'static') ORDER  BY comment_post_ID DESC, comment_date DESC  LIMIT $offset, $perpage"); 
     285            $gmz_comments =  $wpdb->get_results("SELECT $wpdb->posts.ID, comment_author, comment_date, comment_content, ID, comment_ID, post_date, post_title, post_name FROM $wpdb->comments INNER  JOIN $wpdb->posts ON $wpdb->comments.comment_post_ID = $wpdb->posts.ID WHERE comment_author =  '$comment_author_sql' AND comment_approved = '1' AND post_date < '".current_time('mysql')."' AND (post_status = 'publish' OR post_status = 'static') ORDER  BY comment_post_ID DESC, comment_date DESC  LIMIT $offset, $perpage"); 
    284286?> 
    285287            <h2 class="pagetitle">Comments Posted By <?php echo $comment_author; ?></h2> 
    286288            <p>Displaying <b><?php echo $displayonpage; ?></b> To <b><?php echo $maxonpage; ?></b> Of <b><?php echo $totalcomments; ?></b> Comments</p> 
    287289            <?php 
     290                  // Get Comments 
    288291                  if($gmz_comments) { 
    289292                        foreach($gmz_comments as $post) { 
     
    306309                              echo "<p>$comment_author has not made any comments yet.</p>"; 
    307310                  } 
     311 
     312                  // If Total Pages Is More Than 1, Display Page Navigation 
     313                  if($totalpages > 1) { 
    308314            ?> 
    309315            <table width="100%" cellspacing="0" cellpadding="0" border="0"> 
     
    344350                                          if ($i >= 1 && $i <= $totalpages) { 
    345351                                                if($i == $page) { 
    346                                                       echo "[$i]"; 
     352                                                      echo " [$i] "; 
    347353                                                } else { 
    348354                                                      echo "<a href=\"wp-stats.php?author=$comment_author_link&amp;page=$i\">$i</a> "; 
     
    360366                        </td> 
    361367                  </tr> 
    362             </table>     
     368            </table> 
     369            <?php 
     370                  } 
     371            ?> 
    363372            <p><b>&laquo;&laquo;</b> <a href="<?php get_settings('home'); ?>wp-stats.php">Back To Stats Page</a></p> 
    364373<?php