All pastes #73706 Raw Edit

help me

public text v1 · immutable
#73706 ·published 2006-06-28 04:48 UTC
rendered paste body
if ( !defined('SECTION_MODE') )
{
	define("PHPFOX_PROTECT","section_rate");
	define("PHPFOX_RUNTIME",TRUE);
	define("PHPFOX_DIR","../");
	define("PHPFOX_SCRIPT","rate");
	
	if (!@include_once(PHPFOX_DIR."phpfox_loader.php"))
	{
		die("<b>Fatal Error:</b> Cant Load ". PHPFOX_DIR ."phpfox_loader.php");
	}

	if (@$GLOBALS['phpfox_config']['error_reporting'])
	{
		error_reporting(0);
	}
}

$RATEVAR = array();
$RATEVAR[0] = "";
$RATEVAR[1] = "";

// GET FRAME
$RATEVAR[2] = "";

// PIC COOKIE
$RATEVAR[3] = "";	

// PIC CATAGORY
$RATEVAR[4] = "";

// NAME CATAGORY
$RATEVAR[5] = "";

// ADDS
$RATEVAR[5] = html_adds("");

// HOME LINK
$RATEVAR[6] = "";



if (isset($_COOKIE['PICCAT'])) $RATEVAR[3] = $_COOKIE['PICCAT'];
if (isset($_GET['S'])) $RATEVAR[2] = $_GET['S'];

if (isset($_GET['type'])) $RATEVAR[7] = $_GET['type'];

if (isset($_GET['action'])) 
{

if ( isset($_GET['user_rating']) )
{

$IMAGE = "";
$TOTALG = "50";
$a = mysql_query("SELECT `user`,`user_rating` FROM `user` WHERE `gender` = '$_GET[user_rating]' ORDER BY `user_rating` DESC LIMIT 0,$TOTALG");
while ($b = mysql_fetch_array($a))
{
	$i++;

	$IMAGE .= '<td style="text-align:left;vertical-align;middle;">'."\n";
	$IMAGE .= '<table style="width:100%;"><tr><td style="width:10%;text-align:center;vertical-align:top;">'."\n";
	$IMAGE .= '<div style="font-size:11pt;"><b>#'.$i.'</b></div></td><td style="width:50%;text-align:center;">'."\n";
	
		if (is_int($i / 2))
		{
			 if ($i != $TOTALG) { $newtr = 'class="border13"'; } else { $newtr = ''; }
		}
		else
		{
			$newtr = '';	
		}

		$IMAGE .= ''.uimage($b['user'],"75","","").'';

		$IMAGE .= '</td><td style="width:40%;vertical-align:top;font-size:8pt;" class="color">'."\n";
		$IMAGE .= '<div style="padding-top:4px;">'.ulink($b['user']).' </div> <br />'."\n";
		$IMAGE .= '<div style="padding-top:4px;font-size:10pt;"><b>Rating</b>: '.$b['user_rating'].' </div>'."\n";
		$IMAGE .= '</td></tr></table>'."\n";
		$IMAGE .= '</td></tr><tr '.$newtr.'>'."\n";
}



$MAINDATA =<<<HTML
<table style="width:100%;" cellpadding="8" cellspacing="0">
<tr>
<td style="width:5%;"></td><td style="width:90%;">
<table style="width:100%;" cellpadding="8" cellspacing="0">
<tr class="border13">
$IMAGE
<td>
</td>
</tr>
</table>
</td><td style="width:5%;">
</td>
</tr>
</table>
HTML;


}
else
{
	$LINKS = array('','','','','');

	$db1 = "";

	if (!empty($_GET['cat']))
	{
		$db1 = "WHERE `gcatagory` = '". $_GET['cat'] ."'";
	}

	$db2 = "rating";
	if ($_GET['source'] == '2' )
	{
		$db2 = "votes";
	}

$newsize = "70";
$minussize = "40";
$IMAGE = "";
$c = '';
$i = "";
$TOTALG = "50";
$a = mysql_query("SELECT * FROM `main` $db1 ORDER BY `$db2` DESC LIMIT 0,$TOTALG");
while ($b = mysql_fetch_array($a))
{
	$i++;
	$tr = "";	
	$i2 = "";
	$css = "";
	$newcss = "";
	if ($i == '3' || $i == '6' || $i == '9' || $i == '12' || $i == '15' || $i == '18' || $i == '21' || $i == '24') 
	{
		if ($NUM1 != '2' && $NUM1 != '3') 
		{
			if ($i == 6) {
				$css = "border13";  
				
			} 
		}

		if ($NUM1 == '3') 
		{
			if ($i == 6 || $i == 12 || $i == 18) {
				$css = "border13";
				
			}	 
		}

		$tr = '</tr><tr class="'.$css.'">';
	}



	$img = "gallery/".$b['img']."/thumb/".$b['id'].".jpg";

	$img2 = "gallery/".$b['img']."/".$b['id'].".jpg";
	
	$ilocation = ''.$VAR[0].'/gallery/'.$b['img'].'/'.$b['id'].'.jpg';

	$extra = $VAR[0]."/".$img2;

	$IMAGE2 = "";

	if (file_exists("".$VAR[5]."/".$img.""))
	{
		$IMAGE2 .= setIMAGE("".$VAR[0]."/$img",1,$extra,$b['width'],$b['height'],$b['id'],"","");
	}
	else
	{
		if (file_exists("".$VAR[5]."/".$img2."")) {

			$IMAGE2 .= setIMAGE("".$VAR[0]."/$img2",1,$extra,$b['width'],$b['height'],$b['id'],"","");
		
		} else {
			
			$IMAGE2 .= '<img src="'.$VAR[0].'/images/noimage.jpg" alt="" width="120" height="90" />';

		}
	}

		$IMAGE .= '<td style="text-align:left;vertical-align;middle;">'."\n";
		$IMAGE .= '<table style="width:100%;"><tr><td style="width:10%;text-align:center;vertical-align:top;">'."\n";
		$IMAGE .= '<div style="font-size:11pt;"><b>#'.$i.'</b></div></td><td style="width:50%;text-align:center;">'."\n";
	
		if (is_int($i / 2))
		{
			 if ($i != $TOTALG) { $newtr = 'class="border13"'; } else { $newtr = ''; }
		}
		else
		{
			$newtr = '';	
		}

		$IMAGE .= '<a href="'.$VAR[0].'/rate/?picture='.$b['id'].'">'.$IMAGE2.'</a>';

		$IMAGE .= '</td><td style="width:40%;vertical-align:top;font-size:8pt;" class="color">'."\n";
		$IMAGE .= '<div style="padding-top:4px;"><b>Rating</b>: '.$b['rating'].' </div>'."\n";
		$IMAGE .= '<div style="padding-top:4px;"><b>Votes</b>: '.$b['votes'].' </div>'."\n";
		$IMAGE .= '<br /><div style="padding-top:4px;"><b>'.$LANG['172'].'</b>: '.ulink($b['user']).' </div>'."\n";
		$IMAGE .= '<br /><div style="padding-top:4px;text-align:right;">[ <a href="'.$VAR[0].'/rate/?picture='.$b['id'].'">RATE NOW</a> ]</div>'."\n";
		$IMAGE .= '</td></tr></table>'."\n";
		$IMAGE .= '</td></tr><tr '.$newtr.'>'."\n";

}


$MAINDATA =<<<HTML
<table style="width:100%;" cellpadding="8" cellspacing="0">
<tr>
<td style="width:5%;"></td><td style="width:90%;">
<!-- START IMAGES -->
<table style="width:100%;" cellpadding="8" cellspacing="0">
<tr class="border13">
$IMAGE
<td>
</td>
</tr>
</table>
<!-- START IMAGES -->
</td><td style="width:5%;">
</td>
</tr>
</table>
HTML;

}

}
else
{



if (isset($_GET['CAT'])) {

		setcookie("PICCAT",$_GET['CAT'],0);
		$RATEVAR[3] = $_GET['CAT'];
		header("Location: ".$VAR[0]."/rate/");
		exit;
	}


if ($RATEVAR[2] == '1') {


echo html_top("");
echo '

<body style="width:100%;border:1px solid #000000" class="altmiddletop">
<script type="text/javascript">
<!--
  if (top.frames.length == 0) {
    document.cookie = "newURL=" + escape(document.URL) + "; path=/;"
    ver = parseInt(navigator.appVersion, 10);
    if ( ((navigator.appName == "Netscape") && (ver >= 3)) ||
         ((navigator.appName == "Microsoft Internet Explorer") && (ver >= 4)) )
      location.replace("'.$VAR[0].'/rate/");
    else
      location = "'.$VAR[0].'/rate/";
    };
//-->
</script>';
	

	if (isset($_POST['rating'])) {


		$f = $SQL("$SL * $FR `rating` $W main = '$_COOKIE[PICRATING]' AND `user` = '$M'");
		$g = $FA($f);
		$j = $SQL("$SL * $FR `main` $W `id` = '$_COOKIE[PICRATING]'");
		$k = $FA($j);
		$k['votes']++;

	
		if ($VAR[4] != $k['user'])
		{
			$INSERT = "`main`,`user`,`rating`,`time`";
			$VALUES = "'$_COOKIE[PICRATING]','$M','$_POST[rating]','$TIME'";
			$SQL("$II `rating` ($INSERT) $V ($VALUES)");
			$e = $SQL("$SL * $FR `rating` $W `main` = '$_COOKIE[PICRATING]'");
			$vote = "0";
			$add = "";
			while ($f = $FA($e))
				{
				if ($f['rating'] != '0.00')
					{ 
					$vote++; 
					}
				$add += $f['rating'];
				}	
			$vote++;
			$add += $_POST['rating'];
			$average = round (($add / $vote),2);
			$SQL("$UD `main` SET `rating` = '$average', `votes` = '$k[votes]' $W `id` = '$_COOKIE[PICRATING]'");
		
		}
	}
		if (isset($_POST['text'])) {

			echo '<script type="text/javascript">parent.window.location.href=\''.$VAR[0].'/rate/?ID='.$_COOKIE['PICRATING'].'#comment\';</script>';
		}

	
	$RATEVAR[4] = "";

	if ($RATEVAR[3] != '')
	{
		$RATEVAR[4] = "WHERE `gcatagory` = '$RATEVAR[3]'";
	}

	if (isset($_GET['picture'])) {

		$a = mysql_query("SELECT * FROM `main` WHERE `id` = '$_GET[picture]'");
		if (!$b = mysql_fetch_array($a))
		{
			echo '<script>parent.window.location.href=\''.$VAR[0].'/rate/\';</script>';
		}
	}
	else
	{

		$a = mysql_query("SELECT * FROM `main` $RATEVAR[4] ORDER BY rand()");
		$b = mysql_fetch_array($a);

	}
		

		setcookie("PICRATING",$b['id'],0);
	
	echo '<div style="text-align:center;font-size:8pt;" class="color">'."\n";
	echo '<table style="margin-right:auto;margin-left:auto;">'."\n";
	echo '<tr>'."\n";
	echo '<td>'."\n";
	echo ''.image("350","350","".$VAR[0]."/gallery/".$b['img']."/".$b['id'].".jpg","").''."\n";
	echo '</td>'."\n";
	echo '</tr>'."\n";
	echo '</table>'."\n";
	echo '<div style="text-align:left;">'."\n";

	$CTOTAL1 = mysql_query("SELECT * FROM `comment` WHERE `main` = '$b[id]' || `cid` = '$b[id]' AND `main` != 'journal'");
	$CTOTAL2 = mysql_num_rows($CTOTAL1);

echo '
<br/><br/><br/><br/><br/><br/><br/><br/><br/>
<table style="width:100%;">
<tr>
<td style="width:20%;text-align:center;">
<a href="javascript:void(0);" onclick="parent.window.location.href=\''.$VAR[0].'/'.$VAR[13].''.$b['user'].'\';">
'.uimage($b['user'],"75",7,"").'
</a>
</td><td style="font-size:8pt;width:50%;" class="color">

<b>'.$LANG['172'].'</b>: 

<span class="link1" style="font-size:7pt;">
<a href="javascript:void(0);" onclick="parent.window.location.href=\''.$VAR[0].'/'.$VAR[13].''.$b['user'].'\';"><b>'.$b['user'].'</b></a>

</span>
<br/>

<b>'.$LANG['173'].'</b>:'.$b['view'].' <br/> <b>'.$LANG['174'].'</b>:'.$b['rating'].' <br/> <b>'.$LANG['175'].'</b>: '.$CTOTAL2.'

</td><td style="font-size:8pt;text-align:center;width:30%;" class="color">

<table style="margin-right:auto;margin-left:auto;">
<tr>
<td class="mainmenu6" onmouseover="this.className=\'mainmenu7\';" onmouseout="this.className=\'mainmenu6\';" onclick="parent.window.location.href=\''.$VAR[0].'/gallery/view/?ID='.$b['id'].'#comment\';">
<a href="javascript:void(0);" onclick="parent.window.location.href=\''.$VAR[0].'/gallery/view/?ID='.$b['id'].'#comment\';">
'.$LANG['176'].'</a>
</td>
</tr>
<tr>
<td class="mainmenu6" onmouseover="this.className=\'mainmenu7\';" onmouseout="this.className=\'mainmenu6\';">
<a href="javascript:void(0);" onclick="parent.window.location.href=\''.$VAR[0].'/user/?P='.$b['user'].'\';">'.$LANG['177'].'</a>
</td>
</tr>
<tr>
<td class="mainmenu6" onmouseover="this.className=\'mainmenu7\';" onmouseout="this.className=\'mainmenu6\';">
<a href="javascript:void(0);" onclick="parent.window.location.href=\''.$VAR[0].'/user/?G='.$b['user'].'\';">'.$LANG['178'].'</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
'."\n";
	echo '</div>'."\n";
	echo '</div>'."\n";

echo html_bottom("");	
exit;
} 



	$split = split(" ","1 2 3 4 5 6 7 8 9 10");
	foreach($split as $no)
	{
		switch ($no):
			case '1': $color = "#9dd8ff"; break;
			case '2': $color = "#b3e6ff"; break;
			case '3': $color = "#caf7ff"; break;	
			case '4': $color = "#e4ffff"; break;
			case '5': $color = "#f7ffff"; break;
			case '6': $color = "#ffe7e6"; break;
			case '7': $color = "#ffbdbc"; break;
			case '8': $color = "#ffa4a5"; break;
			case '9': $color = "#ff5b5c"; break;
			case '10': $color = "#fa2225"; endswitch;
		
		$RATEVAR[0] .= '<input type="submit" name="rating" value="'.$no.'" style="padding-left:5px;padding-right:5px;margin-left:2px;background:'.$color.';cursor:pointer;color:#000;font-weight:bold;" ';
		$RATEVAR[0] .= ' onmouseover="this.style.backgroundColor=\'#c0c0c0\';" onmouseout="this.style.backgroundColor=\''.$color.'\';" />';
	}

	$newpic = "";
	if (isset($_GET['picture'])) $newpic = "&amp;picture=".$_GET['picture']."";

$MAINDATA =<<<HTML
<form method="post" action="$VAR[0]/rate/?S=1" target="iframe1">
<div style="text-align:center;">
<span style="vertical-align:middle;">$RATEVAR[0]</span>
<a href="$VAR[0]/rate/?S=1" target="iframe1">
<img src="$VAR[0]/$VAR[10]/button_fw.gif" style="vertical-align:middle;" onmouseover="showInfo2('$LANG[179]');" onmouseout="return nd();" />

</a> 
</div>
</form>
<div style="text-align:center;">
<iframe src="$VAR[0]/rate/?S=1$newpic" name="iframe1" marginwidth="0" marginheight="0" width="500" height="570" frameborder="0" scrolling="no"></iframe>
</div>
HTML;



}





	$LINKS = array('','','','');

	switch($RATEVAR[3]):

	case 1: $LINKS[0] = "2"; $FAIL = 2; break;
	case 2: $LINKS[1] = "2"; $FAIL = 2; break;
	case 3: $LINKS[2] = "2"; $FAIL = 2; break;
	case 4: $LINKS[3] = "2"; $FAIL = 2; break;
	default: $FAIL = 1; endswitch;

	if ($FAIL == 1) 
	{
		$RATEVAR[6] = "2";
	}


$file = file("".$VAR[5]."/inc/txt/image_cat.txt");
$items = "";
foreach ($file as $item)
{
	$item = trim($item);

	$selected = "";

	if (isset($RATEVAR[3])) { if ($RATEVAR[3] == $item) { $selected = " selected"; }}

	$items .= "<option value=\"".$item."\" ".$selected.">".ucfirst($item)."</option>";
}

	$check_cat = "";

	if ($RATEVAR[3] != '')
	{
		$check_cat = "WHERE `gcatagory` = '$RATEVAR[3]'";
	}

	$check_a = mysql_query("SELECT * FROM `main` $check_cat LIMIT 0,1");
	$check_b = mysql_fetch_array($check_a);

	if ($check_b == 0)
	{
		$MAINDATA  = '
		<div style="padding:30px;font-size:10pt;" class="color">
		Sorry no images have been added to this catagory just yet.
		<div style="padding:15px;">
		[ <a href="'.$VAR[0].'/member/submit/?item=picture&amp;cat='.$RATEVAR[3].'">Upload Your Pic Now</a> ]
		</div>
		</div>
		<br /><br /><br /><br />
		';
	}

$DATA =<<<HTML
<br/>
<table style="width:100%;" cellpadding="0" cellspacing="0">
<tr>
<td style="font-size:8pt;" class="color">

<table cellpadding="0" cellspacing="0">
<tr>


</td>
<td style="vertical-align:bottom;" onclick="window.location.href='$VAR[0]/rate/';">
<div style="border: 1px solid #000000;" class="item2" onmouseover="this.className='item2';" onmouseout="this.className='item2';">
<a href="$VAR[0]/rate/">MAIN</a>
</div>
</td>

<td class="item3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td style="vertical-align:bottom;" onclick="window.location.href='$VAR[0]/member/submit/?item=picture';">
<div style="border: 1px solid #000000;" class="item" onmouseover="this.className='item2';" onmouseout="this.className='item';">
<a href="$VAR[0]/member/submit/?item=picture">UPLOAD YOUR PICS</a>
</div>
</td>

<td class="item3">&nbsp;</td>
<td style="vertical-align:bottom;" onclick="window.location.href='$VAR[0]/member/item/?edit=picture';">
<div style="border: 1px solid #000000;" class="item" onmouseover="this.className='item2';" onmouseout="this.className='item';">
<a href="$VAR[0]/member/item/?edit=picture">EDIT YOUR PICS</a>
</div>
</td>


<td class="item3">
<div>&nbsp;&nbsp;</div>
</td>

<td class="item3" style="vertical-align:middle;font-size:9pt;">

<form method="get" action="$VAR[0]/rate/" style="margin:0px;">
&nbsp;&nbsp;
<b><span style="font-size:12pt;">C</span>ATEGORY:</b>
<select name="CAT" style="width:150px;" onchange="javascript:submit();">
<option value="">Select</option>
$items
</select> 
&nbsp;&nbsp;
</form>

</td>

<td class="item3">
<div>&nbsp;&nbsp;</div>
</td>
</tr>
</table>

</td>
</tr>
</table>



<br />
<table style="width:100%;border:1px solid #000000" class="altmiddletop" cellpadding="5" cellspacing="12">
<tr>
<td style="font-size:8pt;width:75%;vertical-align:top;" class="color">

$MAINDATA 

</td><td style="font-size:8pt;width:25%; vertical-align:top;" class="color">

<table style="width:100%;border:1px solid #000000" cellspacing="0" cellpadding="0">
<tr>
<td style="font-size:7pt;" class="middletop">

<table style="width:100%;" class="titletop" cellspacing="0" cellpadding="4">
<tr>
<td style="font-size:8pt;">
<img src="$VAR[0]/images/spacer.gif" class="sqr1" style="vertical-align:middle;" alt="" width="7" height="7" />
<span style="vertical-align:middle;">
<b>TOP IMAGE LISTING</b></span>
</td>
</tr>
</table>

<div style="padding:5px;font-size:9pt;">


<div style="vertical-align:middle;padding-bottom:8px;"> <a href="$VAR[0]/rate/?action=view&amp;cat=$RATEVAR[3]&amp;source=1">Top Rated</a> </div>
<div style="vertical-align:middle;padding-bottom:8px;"> <a href="$VAR[0]/rate/?action=view&amp;cat=$RATEVAR[3]&amp;source=2">Most Viewed</a> </div>

</div>


</td>
</tr>
</table>
<br/ >
<br/ >

<table style="width:100%;border:1px solid #000000" style="width:100%;" cellspacing="0" cellpadding="0">
<tr>
<td style="font-size:7pt;" class="middletop">

<table style="width:100%;" class="titletop" cellspacing="0" cellpadding="4">
<tr>
<td style="font-size:8pt;">
<img src="$VAR[0]/images/spacer.gif" class="sqr1" style="vertical-align:middle;" alt="" width="7" height="7" />
<span style="vertical-align:middle;">
<b>TOP USER RATINGS</b></span>
</td>
</tr>
</table>

<div style="padding:5px;font-size:9pt;">


<div style="vertical-align:middle;padding-bottom:8px;"> <a href="$VAR[0]/rate/?action=view&amp;user_rating=female">Female</a> </div>
<div style="vertical-align:middle;padding-bottom:8px;"> <a href="$VAR[0]/rate/?action=view&amp;user_rating=male">Male</a> </div>

</div>


</td>
</tr>
</table>


$RATEVAR[5]

</td>
</tr>
</table>

<br/><br/>

HTML;
	

#####################################
html_main($DATA,"","");
#####################################
?>