////////////////////////////////////////////////////////////////////////////// // Program Name : Image Vote - Photo Rating System // // Release Version : 2.0.0 // // Program Author : Ronald James // // Supplied by : Scoons [WTN] // // Nullified by : CyKuH [WTN] // ////////////////////////////////////////////////////////////////////////////// // COPYRIGHT NOTICE // // (c) 2002 Ronald James All Rights Reserved. // // Distributed under the licencing agreement located in wtn_release.nfo // ////////////////////////////////////////////////////////////////////////////// function resizepic($width,$height){ global $max_width,$max_height; if($width>$max_width){ $scale = (float)$max_width/(float)$width; $width = (int) $width*$scale; $height = (int) $height*$scale; } if($height>$max_height){ $scale = (float)$max_height/(float)$height; $width = (int) $width*$scale; $height = (int) $height*$scale; } return array($width,$height); } function logout() { global $f; session_start(); session_destroy(); include_once("std.encryption.class.inc"); $crypt = new Encryption; $f = $crypt->encrypt("wr0n@", $f); //header ("Set-Cookie: logged=$f; expires=Wed, 2-Jan-1987 00:00:00 GMT; path=/;"); //header ("Set-Cookie: modlogin=$f; expires=Wed, 2-Jan-1987 00:00:00 GMT; path=/;"); //header ("Set-Cookie: ivadmin=$f; expires=Wed, 2-Jan-1987 00:00:00 GMT; path=/;"); setcookie("logged", $f, time()-3600); setcookie("modlogin", $f, time()-3600); setcookie("ivadmin", $f, time()-3600); header("Location: http://www.tenorone.com"); exit; } if ((isset($_GET['f'])) && $_GET['f'] == "logout") logout(); require ("config.php"); langindex(); if (!$template) $template = "template1.php"; include_once("std.encryption.class.inc"); $crypt = new Encryption; $cookieinfo = $crypt->decrypt("wr0n@", $HTTP_COOKIE_VARS[logged]); $originalc=$c; // $u (user) $c (category) $f (function) $id ( id #) if(!isset($c)) $c = "all"; if(IsSet($men_x)) $c="men"; if(IsSet($women_x)) $c="women"; $lastpicture=""; // connect to the database until the end mysql_connect($host,$user,$pass); @mysql_select_db($database) or die( "Unable to select database"); // if visitor just voted, update the last image's record first if (!isset($vote)) { if(IsSet($vote1_x)) $vote=1; // support for image inputs if(IsSet($vote2_x)) $vote=2; if(IsSet($vote3_x)) $vote=3; if(IsSet($vote4_x)) $vote=4; if(IsSet($vote5_x)) $vote=5; if(IsSet($vote6_x)) $vote=6; if(IsSet($vote7_x)) $vote=7; if(IsSet($vote8_x)) $vote=8; if(IsSet($vote9_x)) $vote=9; if(IsSet($vote10_x)) $vote=10; } if (isset($vote)) { if ($vote != 99 && $vote > 10) $vote = 10; if($vote == "1") $whatvote = "one"; if($vote == "2") $whatvote ="two"; if($vote == "3") $whatvote ="three"; if($vote == "4") $whatvote ="four"; if($vote == "5") $whatvote ="five"; if($vote == "6") $whatvote ="six"; if($vote == "7") $whatvote ="seven"; if($vote == "8") $whatvote ="eight"; if($vote == "9") $whatvote ="nine"; if($vote == "10") $whatvote ="ten"; // if ($vote < 3) $oldrate+= 2; if ($donerep < 1) $donerep=0; if ($vote == "99") { if ($donerep <= 1) { $result=mysql_query("SELECT reported FROM $imagetable WHERE id = '$imgid'") or die(mysql_error()); $reports=mysql_result($result,0,"reported"); $reports++; mysql_query("UPDATE $imagetable SET reported = '$reports', reason = 'autobroken' WHERE id = '$imgid'") or die(mysql_error()); if ( $reports >= $maxreport) mysql_query("UPDATE $imagetable SET status = 'reported' WHERE id = '$imgid'") or die(mysql_error()); $donerep++; } $vote = "?"; $oldaverage = "?"; $oldtotal = "?"; $image = "broken.gif"; } else { $result=mysql_query("SELECT * FROM $imagetable WHERE id = '$imgid'"); $oldvoter1=mysql_result($result,0,"voter1"); $oldvoter2=mysql_result($result,0,"voter2"); $oldvoter3=mysql_result($result,0,"voter3"); $oldvoter4=mysql_result($result,0,"voter4"); $oldvoter5=mysql_result($result,0,"voter5"); $oldrate=mysql_result($result,0,"rate"); $oldno=mysql_result($result,0,$whatvote); $oldtotal=mysql_result($result,0,"total"); if ($HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"] != "")$ip = $HTTP_SERVER_VARS["HTTP_X_FORWARDED_FOR"]; else $ip = $HTTP_SERVER_VARS["REMOTE_ADDR"]; if (strlen($ip) < 6) $ip = $REMOTE_ADDR; if ($oldvoter1 != $ip && $oldvoter2 != $ip && $oldvoter3 != $ip && $oldvoter4 != $ip && $oldvoter5 != $ip) { if ($vote != 0) $oldtotal++; $oldrate += $vote; $oldno++; $oldaverage = $oldrate/$oldtotal; $oldaverage = sprintf ('%0.1f', $oldaverage); mysql_query("UPDATE $imagetable SET voter1 = '$ip', voter2 = '$oldvoter1', voter3 = '$oldvoter2', voter4 = '$oldvoter3', voter5 = '$oldvoter4' where id = '$imgid'"); mysql_query("UPDATE $imagetable SET rate = '$oldrate', total = '$oldtotal', $whatvote = '$oldno', average = '$oldaverage' where id = '$imgid'"); } else { $oldaverage = $oldrate/$oldtotal; $oldaverage = sprintf ('%0.1f', $oldaverage); } if($oldtotal < $votesneeded) $oldaverage = "?"; $rrate = round ($oldaverage); $rrate--; } $lastpicture="
";
$lastpicture.="
| ".DISPLAY." "; foreach ($categories as $a) { $pickcat .= "$a "; } $pickcat .= " |
| ".VIEWALL; $pickcat .= " |
".NOCOMMENTS."
\n\n"; $samples .= ""; } else { $samples = ""; $bgcolor = "#E0E0E0"; $samples.= "\n"; while ($row = mysql_fetch_array($mailresult)) { $datearray[]=$row["datestamp"]; $comid=$row["id"]; $fromuser=$row["fromuser"]; $datestamp=$row["datestamp"]; $commentrate=$row["subject"]; $body=$row["body"]; $samples.= "$body
\n\n"; //if ( $bgcolor == "#E0E0E0") $bgcolor = "#F2F2F2"; else $bgcolor = "#E0E0E0"; } //$samples.= "".VIEWALLCOMS." | ".POSTCOMMENT."
"; $samples.=""; } } mysql_close (); // done with database? better close it if ($numimages > 1) { $otherpics = "Other pictures for this user ($numimages total):