// The contents of this file is subject to a license. // Read license.txt and readme.txt for more information. ob_start(); ?> Project JJ Chats - Poll System
\n"; echo "$poll[1]

"; if ($_REQUEST['vote'] && $_REQUEST['username'] && $_REQUEST['password'] && $_REQUEST['email']) { $username = $_REQUEST['username']; $password = $_REQUEST['password']; $vote = $_REQUEST['vote']; $email = $_REQUEST['email']; include("helpers.php"); $valid = 1; $flags = ChatVerifyLogin($username, $password, $chatpath); if ((($flags == -1) || ($flags == 0)) && !CheckFlags("MmZXxzpADRPFfsoiIOCBbralV", $flags) && ($chatpath != "chattrial")) { echo "False login."; exit(); } $result = @mysql_query("SELECT chat,utime,username,password,email,ip,vote,valid FROM $db_table WHERE chat='$chatpath' AND username='$username' AND password='".(md5($password))."'", $handler); $test = mysql_fetch_row($result); @mysql_free_result($result); if ($test[7] == "1") { $result = @mysql_query("UPDATE $db_table SET vote='$vote',utime='".(time())."' WHERE chat='$chatpath' AND username='$username' AND password='".(md5($password))."'", $handler); echo "Vote altered.

"; } else { $result = @mysql_query("SELECT chat,utime,username,password,email,ip,vote,valid FROM $db_table WHERE chat='$chatpath' AND ip='{$_SERVER['REMOTE_ADDR']}'", $handler); $test = mysql_fetch_row($result); @mysql_free_result($result); if ($test[5] != "") $valid = -2; $result = @mysql_query("SELECT chat,utime,username,password,email,ip,vote,valid FROM $db_table WHERE chat='$chatpath' AND username='$username'", $handler); $test = mysql_fetch_row($result); @mysql_free_result($result); if ($test[2] != "") $valid = -3; $result = @mysql_query("SELECT chat,utime,username,password,email,ip,vote,valid FROM $db_table WHERE chat='$chatpath' AND password='".(md5($password))."'", $handler); $test = mysql_fetch_row($result); @mysql_free_result($result); if ($test[3] != "") $valid = -4; $result = @mysql_query("SELECT chat,utime,username,password,email,ip,vote,valid FROM $db_table WHERE chat='$chatpath' AND email='$email'", $handler); $test = mysql_fetch_row($result); @mysql_free_result($result); if ($test[4] != "") $valid = -5; if ($valid == 1) { $result = @mysql_query("INSERT INTO $db_table (chat,utime,username,password,email,ip,vote,valid) VALUES ('$chatpath','".(time())."','$username','".(md5($password))."','$email','{$_SERVER['REMOTE_ADDR']}','$vote','$valid')", $handler); echo "Vote recorded.

"; } else { echo "Vote was invalid.

"; } } } else { echo "

"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
Username
Password
Email
"; echo "
\n"; for ($cc=0;$cc<$poll[2];$cc++) { echo " ".($poll[($cc*2)+3])."
\n"; } echo "\n
\n"; echo "
"; echo ""; echo "All information is recorded in encrypted form (MD5) for securing noone votes twice.
This is completely anonymous.
"; echo "
\n"; } $result = @mysql_query("SELECT chat,utime,username,password,email,ip,vote,valid FROM $db_table WHERE chat='{$_REQUEST['chatpath']}' AND valid='1'", $handler); $vlist = array(); $all=0; while ($test = @mysql_fetch_row($result)) { for ($cc=0;$cc<$poll[2];$cc++) { if ($test[6] == $cc+1) { $vlist[$cc]++; $all++; } } } @mysql_free_result($result); if ($all > 0) { echo "$all votes."; echo "
"; echo "
"; for ($cc=0;$cc<$poll[2];$cc++) { echo "
"; echo "
".(round(($vlist[$cc]/$all)*100, 1))."%
"; echo "
"; echo (($cc+1==$poll[2]) ? "":"
"); } echo "
"; echo "
"; } else echo "No votes so far."; } else { echo "
No poll with ident '{$_REQUEST['chatpath']}' exists.
"; } echo "
\n"; ?>