• laurionb

    (@laurionb)


    if $lnumber is 0 in update_post_ul_meta (ldclite-function.php) then we hit this code

    $sql=”insert into $table_name(post_id,ul_key,ul_value) values(‘$post_id’,’$up_type’,”.($lnumber+1).”);”;
    if(isset($_COOKIE[‘ul_post_cnt’]))
    {
    $posts=$_COOKIE[‘ul_post_cnt’];
    array_push($posts,$post_id);
    foreach($posts as $key=>$value)
    {
    setcookie(“ul_post_cnt[$key]”,$for_com.$value, time()+1314000);
    }
    }

    If $for_com is non-empty (i.e. it is “c_” because we are voting on a comment) then this prepends an extra “c_” to all the cookies. This will let people vote again. The code should match the replace case and look like this:

    $sql="insert into $table_name(post_id,ul_key,ul_value) values('$post_id','$up_type',".($lnumber+1).");";
    if(isset($_COOKIE['ul_post_cnt']))
    {
        $posts=$_COOKIE['ul_post_cnt'];
        array_push($posts,$for_com.$post_id);
        foreach($posts as $key=>$value)
        {
            setcookie("ul_post_cnt[$key]",$value, time()+1314000);
        }
    }

    (Well actually that code should be refactored into another function to avoid the duplication of code and prevent copy/paste coding errors…)

    https://www.ads-software.com/plugins/like-dislike-counter-for-posts-pages-and-comments/

Viewing 1 replies (of 1 total)
  • I also found this bug and fixed it the following way

    171: if(strpos($value, $post_id) !== false) {
    172:     setcookie("ul_post_cnt[$key]",$for_com.$value, time()+1314000);
    173: } else {
    174:     setcookie("ul_post_cnt[$key]",$value, time()+1314000);
    175: }

    This way people can’t vote again if somebody is commenting again.

Viewing 1 replies (of 1 total)
  • The topic ‘Bug in update_post_ul_meta?’ is closed to new replies.