Code Duplication    Length = 6-6 lines in 2 locations

ratevideo.php 2 locations

@@ 38-43 (lines=6) @@
35
36
if ($ratinguser !== 0) {
37
    $result = $GLOBALS['xoopsDB']->query('SELECT cid, submitter FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_videos') . ' WHERE lid=' . (int)$lid);
38
    while (false !== (list($cid, $ratinguserDB) = $GLOBALS['xoopsDB']->fetchRow($result))) {
39
        if ($ratinguserDB === $ratinguser) {
40
            $ratemessage = _MD_XOOPSTUBE_CANTVOTEOWN;
41
            redirect_header('singlevideo.php?cid=' . (int)$cid . '&lid=' . (int)$lid, 4, $ratemessage);
42
        }
43
    }
44
    // Check if REG user is trying to vote twice.
45
    $result = $GLOBALS['xoopsDB']->query('SELECT cid, ratinguser FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_votedata') . ' WHERE lid=' . (int)$lid);
46
    while (false !== (list($cid, $ratinguserDB) = $GLOBALS['xoopsDB']->fetchRow($result))) {
@@ 46-51 (lines=6) @@
43
    }
44
    // Check if REG user is trying to vote twice.
45
    $result = $GLOBALS['xoopsDB']->query('SELECT cid, ratinguser FROM ' . $GLOBALS['xoopsDB']->prefix('xoopstube_votedata') . ' WHERE lid=' . (int)$lid);
46
    while (false !== (list($cid, $ratinguserDB) = $GLOBALS['xoopsDB']->fetchRow($result))) {
47
        if ($ratinguserDB === $ratinguser) {
48
            $ratemessage = _MD_XOOPSTUBE_VOTEONCE;
49
            redirect_header('singlevideo.php?cid=' . (int)$cid . '&lid=' . (int)$lid, 4, $ratemessage);
50
        }
51
    }
52
} else {
53
    // Check if ANONYMOUS user is trying to vote more than once per day.
54
    $yesterday = (time() - (86400 * $anonwaitdays));