public static function getColor() { global $conn; $sql = "SELECT * FROM `games` WHERE `game_id` = '" . $_SESSION["game_id"] . "' AND CHAR_LENGTH(`colors`)>3"; $result = $conn->query($sql); if ($result) { $row = $result->fetch_assoc(); if ($row) { //die ($sql); $colors = $row["colors"]; $allColors = explode(",", $colors); $theColor = $allColors[rand(0, sizeof($allColors) - 1)]; $colors = str_replace($theColor, "", $colors); $colors = str_replace(",,", ",", $colors); if (substr($colors, strlen($colors) - 1) == ",") { $colors = substr($colors, 0, strlen($colors) - 1); } if (substr($colors, 0, 1) == ",") { $colors = substr($colors, 1); } //now update games if (strlen($theColor) < 2) { $theColor = get_random_color(); } $sql = "UPDATE `games` SET `colors`='{$colors}' WHERE `game_id` = '" . $_SESSION["game_id"] . "'"; $result = $conn->query($sql); //die ($sql); return $theColor; } } return get_random_color(); }
function get_chat_color($user_level) { $color = ""; switch ($user_level) { // Admin case 3: $color = "#DF5A49"; break; // Mod // Mod case 2: $color = "#E27A3F"; break; // Other // Other default: $color = get_random_color(); } return $color; }
$image = imagecreatetruecolor($width, $height); $bg = imagecolorallocate($image, 0, 0, 0); for ($i = 0; $i < $factor_x * $factor_y; $i++) { $propobj = $properties[$i]; // choose a color for the ellipse $col_ellipse = imagecolorallocate($image, $propobj->red, $propobj->green, $propobj->blue); // draw the white ellipse imagefilledellipse($image, $propobj->x, $propobj->y, $elipsesize, $elipsesize, $col_ellipse); } $checkchar = ''; for ($i = 0; $i < $charcount; $i++) { $colnum = rand(1, 2); $textcol = new stdClass(); $textcol->red = get_random_color(${'col_text' . $colnum}[0], ${'col_text' . $colnum}[1]); $textcol->green = get_random_color(${'col_text' . $colnum}[0], ${'col_text' . $colnum}[1]); $textcol->blue = get_random_color(${'col_text' . $colnum}[0], ${'col_text' . $colnum}[1]); $color_text = imagecolorallocate($image, $textcol->red, $textcol->green, $textcol->blue); $angle_text = rand(-20, 20); $left_text = $i * $charwidth; $text = $nums[$i]; $checkchar .= $text; imagettftext($image, 30, $angle_text, $left_text, 35, $color_text, $fontfile, $text); } $SESSION->feedback->item->captcha->checkchar = $checkchar; // output the picture header("Content-type: image/png"); imagepng($image); function get_random_color($val1 = 0, $val2 = 255) { $min = $val1 < $val2 ? $val1 : $val2; $max = $val1 > $val2 ? $val1 : $val2;
$visitors_online = new usersOnline(); echo $visitors_online->count_users(); ?> <strong>Members Online:</strong> <?php $time = time() - $active_length; $query = yasDB_select("SELECT count(memberid) as count from membersonline WHERE `timeactive`>= {$time}"); $query2 = yasDB_select("SELECT memberid FROM membersonline"); $row = $query->fetch_array(MYSQLI_ASSOC); $row2 = $query2->fetch_array(MYSQLI_ASSOC); if ($row['count'] > 0) { foreach ($row2 as $member) { $result = yasDB_select("SELECT username FROM user WHERE id = '{$member}'"); $name = $result->fetch_array(MYSQLI_NUM); echo '<a href="' . $setting['siteurl'] . 'showmember/ ' . $member . '.html" style="color:' . get_random_color() . '"> ' . $name[0] . '</a>'; } } ?> <strong>Game Stats:</strong> <strong>Game Plays Today:</strong> <strong>Total Game Plays:</strong> <strong>Total Games:</strong> <?php $stats = yasDB_select("SELECT * from stats where id=2"); $dayplays = $stats->fetch_array(MYSQLI_ASSOC); echo $dayplays['numbers']; $stats = yasDB_select("SELECT * from stats where id=1"); $totalplays = $stats->fetch_array(MYSQLI_ASSOC); echo $totalplays['numbers'];
$active_length = 600; // How many seconds to count an user as active until they access another page... 600 = 10 minutes $query = yasDB_select("SELECT count(user.id) as count FROM user "); $row = $query->fetch_array(MYSQLI_ASSOC); $query->close(); echo ' <b>Members - </b>' . $row['count'] . '<br>'; $time = time() - $active_length; $query = yasDB_select("SELECT user.name AS name, user.id AS id FROM user, membersonline WHERE membersonline.memberid = user.id AND timeactive >= '{$time}'"); $online = $query->num_rows; echo '<b>Members Online- </b>' . $online . '<br>'; if ($online > 0) { while ($row = $query->fetch_array(MYSQLI_ASSOC)) { if ($setting['seo'] == 'yes') { echo '<a href="' . $setting['siteurl'] . 'showmember/' . $row['id'] . '.html" style="color:' . get_random_color() . '">' . $row['name'] . '</a> '; } else { echo '<a href="' . $setting['siteurl'] . 'index.php?act=showmember&id=' . $row['id'] . '"style="color:' . get_random_color() . '">' . $row['name'] . '</a> '; } } } $query->close(); unset($row); echo '<b><br/>New Members: </b><br/>'; $query = yasDB_select("SELECT * FROM user ORDER BY id DESC LIMIT 4"); while ($row = $query->fetch_array(MYSQLI_ASSOC)) { $id = $row['id']; $username = $row['username']; if ($row['useavatar'] == '1') { $avatarimage = $setting['siteurl'] . 'avatars/' . $row['avatarfile']; } else { $avatarimage = $setting['siteurl'] . 'avatars/useruploads/noavatar.jpg'; }