= LIKE_MAX_LIKES) { die("0\nYou can't like this post anymore."); } $email = "$user_score.$post_likes"; $query = "UPDATE `$board` SET email = '$email' WHERE no = $post_id LIMIT 1"; $res = mysql_board_call($query); if (!$res) { die("0\nDatabase Error (luls1)."); } // --- $skip_boards = array('b', 'qa', 's4s', 'bant', 'vip'); if (in_array($board, $skip_boards)) { return $post_likes; } // Update user score $query = << DATE_SUB(NOW(), INTERVAL $cd SECOND) LIMIT 1 SQL; if ($or_clause) { $res = mysql_global_call($query, $user_id, $ip); } else { $res = mysql_global_call($query, $user_id); } if (!$res) { die("0\nDabase Error (lia0)"); } if (mysql_num_rows($res)) { return true; } // Rangebans if (!$pass_user) { $long_ip = ip2long($ip); if ($long_ip) { if (isIPRangeBanned($long_ip)) { return true; } } } // IP cycling /* $user_mask = explode('.', $ip); $user_mask = ((int)$user_mask[0]) . '.' . ((int)$user_mask[1]); $query = << DATE_SUB(NOW(), INTERVAL 10 MINUTE) SQL; $res = mysql_global_call($query); if (!$res) { die("0\nDabase Error (lia1)"); } $row = mysql_fetch_row($res); if ($row && (int)$row[0] > 10) { return true; } */ // Proxies /* $query = << DATE_SUB(NOW(), INTERVAL 5 MINUTE) SQL; $res = mysql_global_call($query, $target_user_id); if (!$res) { die("0\nDabase Error (lia1)"); } $row = mysql_fetch_row($res); if ($row && (int)$row[0] > 10) { return true; } */ return false; } function like_get_target_user_id($board, $post_id) { // board and post_id params should already be escaped $query = "SELECT host, 4pass_id FROM `$board` WHERE no = $post_id AND resto > 0 AND archived = 0 LIMIT 1"; $res = mysql_board_call($query); if (!$res) { die("0\nDabase Error (lgtu)"); } $row = mysql_fetch_row($res); if (!$row) { return false; } if ($row[1]) { return array($row[1], $row[0]); } else if ($row[0]) { return array($row[0], $row[0]); } return false; } function like_is_duplicate($user_id, $board, $post_id) { // board and post_id params should already be escaped $query = "SELECT id FROM like_user_log WHERE user_id = '%s' AND board = '$board' AND post_id = $post_id LIMIT 1"; $res = mysql_global_call($query, $user_id); if (!$res) { die("0\nDabase Error (lid)"); } return mysql_num_rows($res) === 1; } function like_is_ip_suspicious($ip) { $bot_countries = array( 'AD','AE','AF','AG','AI','AL','AM','AN','AO','AR','AS','AW','AZ', 'BB','BD','BF','BG','BH','BI','BJ','BM','BN','BO','BR','BS','BT','BV','BW','BY','BZ', 'CC','CF','CG','CI','CK','CL','CM','CN','CO','CR','CU','CV','CX','CY','CZ', 'DJ','DM','DO','DZ','EC','EE','EG','EH','ER','ET','FJ','FM','FO', 'GA','GD','GE','GF','GH','GI','GL','GM','GN','GP','GQ','GR','GS','GT','GU','GY', 'HK','HM','HN','HT','HU','HR','ID','IL','IN','IO','IQ','IR','IS','JM','JO','JP', 'KE','KG','KH','KI','KM','KN','KR','KW','KY','KZ', 'LA','LB','LC','LI','LK','LR','LS','LU','LY', 'MA','MD','MG','MH','MK','ML','MM','MN','MO','MP','MQ','MR','MS','MT','MU','MV','MW','MY','MZ','NA', 'NE','NF','NG','NI','NP','NR','NU','NZ','OM','PA','PE','PF','PG','PH','PK','PM','PN','PR','PS','PT','PW', 'QA','RE','RS','RO','RU','RW','SA','SB','SC','SD','SH','SI','SJ','SK','SL','SM','SN','SO','SR','ST','SV','SY','SZ', 'TC','TD','TF','TG','TJ','TM','TN','TO','TP','TR','TT','TV','TW','TZ','UG','UM','UY','UZ', 'VA','VE','VC','VG','VI','VN','VU','WF','WS','YE','YT','ZA','ZM','ZR','ZW' ); if (!isset($_COOKIE['__cfduid'])) { return true; } $country = geoip_country_code_by_addr($ip); if (!$country) { return true; } if (in_array($country, $bot_countries)) { return true; } return false; } function like_is_ip_known($ip) { $query = "SELECT id FROM like_user_log WHERE user_id = '%s' LIMIT 1"; $res = mysql_global_call($query, $ip); if (!$res) { die("0\nDabase Error (lik)"); } return mysql_num_rows($res) === 1; } function like_get_user_score($no_cache = false) { global $captcha_bypass, $passid; // FIXME return 0; static $current_score = -1; if ($current_score !== -1 && $no_cache !== true) { return $current_score; } if ($captcha_bypass && $passid) { $user_id = $passid; } else { $user_id = $_SERVER['REMOTE_ADDR']; } $query = "SELECT user_score FROM like_user_scores WHERE user_id = '%s'"; $res = mysql_global_call($query, $user_id); if (!$res) { return 0; } $row = mysql_fetch_row($res); if ($row) { $current_score = (int)$row[0]; } else { $current_score = 0; } return $current_score; } function like_decrease_user_score($ip, $passid, $multiplier) { if ($passid) { $user_id = $passid; } else { $user_id = $ip; } $query = << 0, 'smiley' => 0, // single emoji 'sad' => 0, // single emoji //'coinflip' => 0, //'dice+1d6' => 0, 'ok' => 0, // single emoji 'animal' => 0, // random animal emoji 'food' => 0, // random food emoji 'check' => 0, 'cross' => 0, //'nofile' => 0, //'card' => 0, // random playing card emoji //'wflag' => 0, //'bflag' => 0, 'like' => 0, // red heart emoji //'rabbit' => 0, // single emoji 'unlove' => 0, // broken heart emoji 'rage' => 0, 'perfect' => 0, //'fortune' => 0, //'dice+1d100' => 0, //'bricks' => 0, 'onsen' => 0, //'party' => 0, // partyhat image //'verified' => 0, //'partyhat' => 0, // partyhat image, adjusted //'pickle' => 0, // pickle rick image //'trash' => 0, // trashcan image 'heart' => 0, // random heart emoji (different colors) //'santa' => 0, // santa hat image 'joy' => 0, // single emoji //'marquee' => 0, 'pig' => 0, // single emoji 'dog' => 0, // single emoji 'cat' => 0, // single emoji 'rainbow' => 0, 'frog' => 0, // single emoji //'dino' => 750, // dinosaur gif from /fit/ //'spooky' => 1000, // random skeleton ); $perks = array(); if ($only_unlocked) { foreach ($req_points as $perk => $score) { if ($current_score >= $score) { $perks[] = $perk; } } } else { foreach ($req_points as $perk => $score) { $perks[$perk] = $current_score >= $score; } } return $perks; } function like_parse_options_field($options) { $show_score = false; $active_perk = null; if (strlen($options) > 100) { return array($show_score, $active_perk); } $user_perks = like_get_perks_state(); $opts = explode(' ', $options); foreach ($opts as $opt) { if ($user_perks[$opt] === true) { if ($opt === 'showscore') { $show_score = true; } else { $active_perk = $opt; break; } } } return array($show_score, $active_perk); } function like_build_perk_html($perk) { $cnt_attrs = ''; switch ($perk) { case 'animal': $ary = array('🐭','🐹','🐰','🐶','🐺','🦊','🐵','🐸','🙈','🙉','🙊','🐯','🦁','🦓','🦒','🐴','🐮','🐷','🐻','🐼','🐲','🦄','🐱','😸','😹','😺','😻','😼','😽','😾','😿','🙀','🐅','🐆','🐘','🦏','🐂','🐃','🐄','🐎','🦌','🐐','🐏','🐑','🐖','🐗','🐪','🐫','🦍','🐉','🦖','🦕','🐈','🐀','🐁','🐇','🐒','🐕','🐩','🐨','🐿','🦔','🦇','🐍','🦅','🦉','🦆','🐓','🐔','🦃','🕊','🐣','🐤','🐥','🐦','🐧','🐋','🐳','🐬','🦈','🐟','🐠','🐡','🐙','🦑','🦐','🦀','🐚','🐌','🐢','🦎','🐊','🏇','🎠','♘','♞','🐽','🐾','👣','🐀','🐃','🐅','🐇','🐉','🐍','🐎','🐐','🐒','🐓','🐕','🐖'); $html = $ary[array_rand($ary)]; break; case 'food': $ary = array('🧀','🥚','🍳','🥞','🍠','🍞','🥐','🥖','🥨','🍔','🍕','🍝','🍟','🍤','🌭','🌮','🌯','🍛','🥙','🥘','🥗','🥪','🥫','🥓','🍖','🍗','🥩','🥢','🥡','🥟','🍚','🍜','🍲','🥠','🍘','🍙','🍣','🍥','🍱','🍡','🍢','🍇','🍈','🍉','🍊','🍋','🍌','🍍','🍎','🍏','🍐','🍑','🍒','🍓','🥝','🥥','🥦','🍄','🍅','🍆','🌶','🥑','🥕','🥒','🥔','🥜','🍰','🎂','🥧','🍨','🍦','🍩','🍪','🍿','🍮','🍯','🍧','🍫','🍬','🍭','🍺','🍻','🍷','🍸','🍹','🍶','🥂','🥃','🍾','☕','🍵','🥛','🍼','🥤','🍴','🍽','🥣','🥄'); $html = $ary[array_rand($ary)]; break; case 'marquee': $ary = array('🦖','⚽','🏀','⚾'); $ico = $ary[array_rand($ary)]; $html = << $ico HTML; break; case 'rainbow': $html = '🌈'; break; case 'wflag': $html = '🏳️'; break; case 'bflag': $html = '🏴'; break; case 'onsen': $html = '♨️'; break; case 'rage': $html = '💢'; break; case 'perfect': $html = '💯'; break; case 'check': $html = '✔️'; break; case 'cross': $html = '❌'; break; case 'heart': $ary = array('❤️','💙','💜','💛','🖤','💚'); $html = $ary[array_rand($ary)]; break; case 'card': $ary = array('♠️','♥️','♦️','♣️'); $html = $ary[array_rand($ary)]; break; case 'like': $html = '❤️'; break; case 'unlove': $html = '💔'; break; case 'smiley': $html = '😃'; break; case 'sad': $html = '🙁'; break; case 'ok': $html = '👌'; break; case 'coinflip': $html = 'Coin Flip: ' . (mt_rand(0, 1) === 1 ? 'Heads' : 'Tails') . ''; break; case 'party': $html = ''; break; case 'partyhat': $cnt_attrs = ' style="position:absolute"'; $html = ''; break; case 'pickle': $html = ''; break; case 'nofile': $html = ''; break; case 'trash': $html = ''; break; case 'bricks': $html = ''; break; case 'pig': $html = '🐷'; break; case 'santa': $html = ''; break; case 'verified': $html = '
'; break; case 'joy': $html = '😂'; break; case 'rabbit': $html = '🐰'; break; case 'frog': $html = '🐸'; break; case 'dog': $html = '🐶'; break; case 'cat': $html = '🐱'; break; case 'dino': $html = ''; break; case 'spooky': $id = mt_rand(1, 23); $html = ''; break; default: return null; break; } return '