All pastes #561615 Raw Edit

blah

public php v1 · immutable
·published 2007-06-12 14:56 UTC
rendered paste body
<?include_once("config/connection.php");include_once("functions.php");$nomember=false;if($phid){  $recid=$phid;$scroll ="pageScroll();";}$sql="select * from article where articleid=$recid";$res=mysql_query($sql);if($obj=mysql_fetch_object($res)){	$title=$obj->title;	$ic=$obj->picture;	$ic2=$obj->picture2;	$ic3=$obj->url;	$ic4=$obj->url2;	$postabout=$obj->postabout;	$source=$obj->source;	$fullstory=$obj->fullstory;	$postabout=str_replace("\n","<br>",$postabout);	$fullstory=str_replace("\n","<br>",$fullstory);	$numviews=$obj->numviews;	if(!empty($keyword))	{	$postabout=str_replace($keyword,"<span class='searchresults'>$keyword</span>",$postabout);			$fullstory=str_replace($keyword,"<span class='searchresults'>$keyword</span>",$fullstory);	}				$categoryid=$obj->categoryid;	$contr=$obj->contributor;	$user=$obj->username;	if($contr=="")$contr="N/A";	if($user!="") $contr="<a href=\"index.php?cmd=16&username=$user\">".$contr."</a>";	$cookie = $_COOKIE['viewed'];	if(strpos($cookie,"$recid")==false){ mysql_query("update article set numviews=numviews+'1' where articleid='$recid'");	$numviews += 1;}	$date=date("n-d-Y",strtotime($obj->upldate));	setcookie("viewed","$cookie $recid",time()+(3600*24));	$date2 = $obj->upldate;	$seconds = strtotime('now') - strtotime($date2);	$minutes = $seconds / 60;	$hours = $minutes / 60;	if($hours < 24 AND $user == $ses_username)	{		$edit = "y";	}}else{$nomember=true;}?><script language="JavaScript"><?php echo $scroll; ?>function popupWindow(phid){	window.open('emailfriend.php?phid='+phid,'03','top=10,left=10,width=450,height=400,resizable=no,scrollbars=yes,menubar=no');	}function checkifvalid(){if (window.document.myform.password.value==""){alert("Please enter the Password!");window.document.myform.password.focus();return false;}if (window.document.myform.fname.value==""){alert("Please enter the First Name!");window.document.myform.fname.focus();return false;}if (window.document.myform.email.value==""){alert("Please enter the Email!");window.document.myform.email.focus();return false;}if (window.document.myform.age.value==""){alert("Please enter the Age!");window.document.myform.age.focus();return false;}if (isNaN(window.document.myform.age.value)){alert("Age should be a number!");window.document.myform.age.focus();return false;}if (window.document.myform.city.value==""){alert("Please enter the City!");window.document.myform.city.focus();return false;}if (window.document.myform.country.value==""){alert("Please enter the Country!");window.document.myform.country.focus();return false;}if (window.document.myform.about.value==""){alert("Please enter details about yourself!");window.document.myform.about.focus();return false;}}function setVote(numVote){	// alert("test!");	document.myform.vote.value = numVote;	document.myform.submit();}function thumbs(tid,slot){	document.getElementById('thumb').src = 'pics/'+tid;}</script><!-- tinyMCE --><script language="javascript" type="text/javascript" src="/tinymce/tiny_mce.js"></script><script language="javascript" type="text/javascript">	// Notice: The simple theme does not use all options some of them are limited to the advanced theme	tinyMCE.init({			mode : "textareas",	theme : "advanced",	plugins : "spellchecker",		spellchecker_languages : "+English=en",		theme_advanced_buttons1 : "bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright, justifyfull,bullist,numlist,undo,redo,link,unlink,spellchecker",	theme_advanced_buttons2 : "",	theme_advanced_buttons3 : "",	theme_advanced_toolbar_location : "top",	theme_advanced_toolbar_align : "left",	extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]"			});</script><!-- /tinyMCE --><table width="100%" height="10" border="0" cellpadding="0" cellspacing="0" class="mytable">  <tr>    <td>      <div align="center">        <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" class="bg_table">          <form name="myform" action="index.php?cmd=6" method="post" onsubmit="javascript: return checkifvalid();">            <input type="hidden" name="recid" value="<? print $recid; ?>">            <tr class="header">              <td colspan="2"  class="normal" style="background:   url(/images/bg_tbl_ttl.gif) repeat-x;"><div align="center"><b> <? print $title;  ?></b></div></td>            </tr>            <tr>                          </tr>               <? 						  $pic=$recid.'A'.$ic;						  				  ?>            <tr>              <td height="250" colspan="35" align="center"><br>			  <table width="90%" border="0" cellpadding="0" cellspacing="0">              <tr>                <td width="52%" align="center"><?$mmessage=urldecode($mmessage);$mheading=urldecode($mheading);if($mmessage&&$mheading){echo "<div align=\"center\" style=\"font-size:15px; font-family: verdana;\"><strong>$mmessage</strong></div>";}if($ic<>"" OR $ic2<>"" OR $ic3 <>"" OR $ic4<>"")						  {							  if(!empty($ic)){								  $main = $recid.'A'.$ic;							  }							  elseif(!empty($ic2)){								  $main = $recid.'B'.$ic2;							  }							  elseif(!empty($ic3)){								  $main = $recid.'C'.$ic3;							  }							  elseif(!empty($ic4)){								  $main = $recid.'D'.$ic4;							  }?>                  <img id="thumb" src='pics/<? echo $main; ?>' <? $size=@getimagesize('pics/' . $main); if($size[0] > 400) print "width='400'"; ?>><span class="normal"> </span><br>                  <br>                  <?php				if(!empty($ic)) {				echo "<div style=\"display: inline\" id='xA'><a href=\"javascript:thumbs('$pic','A');\"><img src=\"pics/$pic\" id='A' width=50 height=50 style=\"margin-right: 3px;\" border=0></a></div>";				}				if(!empty($ic2)) {				$pic2=$recid.'B'.$ic2;				echo "<div style=\"display: inline\" id='xB'><a href=\"javascript:thumbs('$pic2','B');\"><img src=\"pics/$pic2\" id='B' width=50 height=50 style=\"margin-right: 3px;\" border=0></a></div>";				}				if(!empty($ic3)) {				$pic3=$recid.'C'.$ic3;				echo "<div style=\"display: inline\" id='xC'><a href=\"javascript:thumbs('$pic3','C');\"><img src=\"pics/$pic3\" id='C' width=50 height=50 style=\"margin-right: 3px;\" border=0></a></div>";				}				if(!empty($ic4)) {				$pic4=$recid.'D'.$ic4;				echo "<div style=\"display: inline\" id='xD'><a href=\"javascript:thumbs('$pic4','D');\"><img src=\"pics/$pic4\" id='D' width=50 height=50 style=\"margin-right: 3px;\" border=0></a></div>";				}			?></td>                <td width="48%"><div align="center">                  <table width="250" border="0" align="center" cellpadding="0" cellspacing="0" class="mytable">                    <tr>                      <th bgcolor="#9FC1F8" class="smallblack" scope="col"><img src="images/ad.gif" width="15" height="96"></th>                      <th bgcolor="#FFFFCC" scope="col"><table width="97%" align="center">                          <tr class="header2">                            <?//include("config/connection.php");//include("functions.php");$sql = "SELECT * FROM article WHERE categoryid='53' ORDER BY RAND() LIMIT 1";$obj=mysql_fetch_object(mysql_query($sql));if(strlen($obj->title)>=29) $title=substr($obj->title,0,29)."..."; else $title=$obj->title;if(strlen($obj->fullstory)>=145) $content=substr($obj->fullstory,0,145)."..."; else $content=$obj->fullstory;?>                            <td width="225"><? print "<a href=\"index.php?cmd=6&recid=$obj->articleid\">".$title; ?></td>                          </tr>                          <tr class="normal">                            <td width="225"><? print addWrap(linkify($content)); ?></td>                          </tr>                      </table></th>                    </tr>                  </table>            <br>                  <table width="250" border="0" align="center" cellpadding="0" cellspacing="0" class="mytable">                    <tr bgcolor="#EEEEEE" >                      <td width="15" rowspan="4" class="normal"><img src="images/info.gif" width="15" height="96"> </td>                      <td width="14" rowspan="4" bgcolor="#FFFFCC" class="normal">&nbsp;</td>                      <td width="97" height="21" bgcolor="#FFFFCC" class="normal"><strong>Contributor</strong></td>                      <td width="124" bgcolor="#FFFFCC" class="normal"><?print  $contr;?></td>                    </tr>                    <tr bgcolor="#EEEEEE" >                      <td width="97" height="27" bgcolor="#FFFFCC" class="normal"><strong> Added on:</strong></td>                      <td width="124" bgcolor="#FFFFCC" class="normal"><?print  $date;?></td>                    </tr>                    <tr bgcolor="#EEEEEE" >                      <td height="24" bgcolor="#FFFFCC" class="normal"><strong>Rating</strong></td>                      <td bgcolor="#FFFFCC" class="normal"> <?print getRatings($recid);?> </td>                    </tr>                    <tr bgcolor="#EEEEEE" >                      <td bgcolor="#FFFFCC"  class="normal"><strong>Viewed</strong></td>                      <td bgcolor="#FFFFCC" class="normal"> <?print $numviews;?> times </td>                    </tr>                  </table>                    </div></td>              </tr>            </table></td>            </tr>            <?				  }				  ?>            <tr >                            <td height="30" colspan="2" class="normal"><div align="center">                <?php if(!empty($source)) { echo "<b>Source: </b><a href=\"$source\" target=\"_blank\">$source</a></td><th scope=\"col\"></th></tr>"; }  ?>              </div></td>            </tr>            <tr >              <td height="30" colspan="2" class="normal"><div align="center">                <table height="100%" border="0" align="center" cellpadding="0" cellspacing="0">                  <tr valign="middle" >                    <td width="23" height="2%" ><img src="/images/print.gif" width="23" height="22"></td>                    <td width="106" ><a href="javascript:window.print();">Print This</a></td>                    <td width="23" ><img src="/images/save.gif" width="23" height="22"></td>                    <td width="146" ><a href="index.php?cmd=7&phid=<? print $recid; ?>">Add to Favorites</a></td>                    <td width="23" ><img src="/images/email.gif" width="23" height="22"></td>                    <td width="106" ><a href="javascript:popupWindow(<? print $recid; ?>);">Email This</a></td>                    <td width="23" ><img src="/images/talk.gif" width="23" height="22"></td>                    <td width="105" ><a href="index.php?cmd=12&phid=<? print $recid; ?>">Post Comments </a></td>                  </tr>                </table>              </div></td>            </tr>            <tr >                            <td colspan="2" class="normal"><table width="92%" height="100%" border="0" align="center" class="normal mytable" cellpadding="0" cellspacing="0">                  <tr>                    <th width="30" height="19" bgcolor="#FFFFCC" scope="col"></th>                    <td bgcolor="#FFFFCC" class="normal" scope="col"> <br>                    <? print linkify($fullstory); ?><br>					<?php if($edit == "y") { echo "<a href=\"index.php?cmd=10&recid=$recid\">Edit This Article [24 Hrs]</a>";}				  else {echo "";}				  ?>                    <br>                    <br></td>                    <th width="30" bgcolor="#FFFFCC" scope="col"></th>                  </tr>											                      </table>              </td>            </tr>            <tr >              <td height="25" align="center" class="normal">                <?					  						if((strpos($_COOKIE['ratingcookie'],"*$recid*")===false))						{						?>                <table width="92%" height="45%" cellpadding="0" cellspacing="0" >                  <tr>                    <td><div align="center">                        <table width="400" height="100%" border="0" cellpadding="0" cellspacing="0">                          <tr bgcolor="#FFFFFF"  class="normal" >                            <input type="hidden" name="vote" value="0">                            <td height="30" colspan="3" align="center" class="normal" >                              Was this article worthwhile?                            </td>                          </tr>                          <tr bgcolor="#FFFFFF"  class="normal" >                            <td height="5" align="center" class="normal" ><a href="#" onClick="setVote(1);"><img src="/images/bad.gif" width="34" height="34" border="0"></a></td>                            <td height="5" align="center" class="normal" ><a href="#" onClick="setVote(5);"><img src="/images/ave.gif" width="34" height="34" border="0"></a></td>                            <td height="5" align="center" class="normal" ><a href="#" onClick="setVote(10);"></a><a href="#" onClick="setVote(10);"><img src="/images/good.gif" width="34" height="34"  border="0"></a></td>                          </tr>                          <tr bgcolor="#FFFFFF"  class="normal" >                            <td height="30" align="center" class="normal" ><strong>Not at all </strong></td>                            <td width="30%" height="30" align="center" valign="middle" ><strong>I don't know </strong></td>                            <td width="35%" height="30" align="center" valign="middle" ><strong>Yes it was. </strong></td>                          </tr>                          <tr bgcolor="#FFFFFF"  class="normal" >                            <td height="5" colspan="3" align="center" class="normal" >&nbsp;</td>                          </tr>                          <!--  <tr class="normal"  >                                  <td width="29%" align="center" valign="middle" bgcolor="#EEEEEE" ><B><FONT color=#003366 size=1>                                     <INPUT                         onclick=this.form.submit() type=radio value=0 name=vote>                                  </FONT></B></td>                                  <td width="18%" align="center" valign="middle" bgcolor="#EEEEEE" ><B><FONT color=#003366 size=1>                                     <INPUT                         onclick=this.form.submit() type=radio value=5 name=vote>                                  </FONT></B></td>                                  <td width="18%" align="center" valign="middle" bgcolor="#EEEEEE" ><B><FONT color=#003366 size=1>                                     <INPUT                         onclick=this.form.submit() type=radio value=10 name=vote>                                  </FONT></B></td>                                </tr>-->                        </table>                     </div></td>                  </tr>              </table>                <?					  }					  ?>                </td>            </tr>          </form>        </table>    </div></td>  </tr></table><br><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="mytable">                    <tr>                      <th width="15" bgcolor="#9FC1F8" class="smallblack" scope="col"><img src="/images/ad.gif" width="15" height="96"></th>                      <th width="96" bgcolor="#FFFFCC" scope="col"><?//include("config/connection.php");//include("functions.php");$sql = "SELECT * FROM article WHERE categoryid='53' ORDER BY RAND() LIMIT 1";$obj=mysql_fetch_object(mysql_query($sql));if(strlen($obj->title)>=29) $title=substr($obj->title,0,29)."..."; else $title=$obj->title;if(strlen($obj->fullstory)>=145) $content=substr($obj->fullstory,0,145)."..."; else $content=$obj->fullstory;$size = @getimagesize( "pics/{$obj->articleid}{$obj->picture}" ); if($size[0] > 150){  $size = 150;}else{   $size = $size[0];}echo "<img src=\"pics/{$obj->articleid}{$obj->picture}\" width=\"$size\">";?></th>                      <th bgcolor="#FFFFCC" scope="col"><table width="97%" align="center">                        <tr class="header2">                          <td width="225"><? print "<a href=\"index.php?cmd=6&recid=$obj->articleid\">".$title; ?></td>                        </tr>                        <tr class="normal">                          <td width="225"><? print addWrap(linkify($content)); ?></td>                        </tr>                      </table></th>                    </tr></table>  <br><?	  if(!$start) $start=0;	  $result=mysql_query("select * from articlescomments where approved='Y' and articleid='$recid' limit $start,10");	  if(mysql_num_rows($result))	  {		  ?><table width="100%" height="10" border="0" cellpadding="0" cellspacing="0" class="mytable">  <tr>    <td>      <div align="center">        <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" class="bg_table" style="border: 0;">          <form name="myform2" action="index.php?cmd=5" method="post" onsubmit="javascript: return checkifvalid();">            <tr class="header">              <td height="25" style="background: url(../images/bg_tbl_ttl.gif) repeat-x;"  class="normal" colspan="3" style="padding: 0 0 0 10;">  <b> <strong>Comments Posted</strong></b></td>            </tr>            <? $i = 0;				 $s = "SELECT * FROM memberranks ORDER BY threshold ASC";				$res = mysql_query($s) or die(mysql_error());				$ranks = Array();				$thresholds = Array();				reset($ranks);				while($r = mysql_fetch_object($res))				{					$ranks[] = $r->rank;					$thresholds[] = $r->threshold;				}								  while($obj=mysql_fetch_object($result))				  {				  $username=$obj->byusername;				 // $comment="<a href=\"index.php?cmd=16&username=$username\"><b>$username</b></a> posted on ".date("n-d-Y",strtotime($obj->postdate))."<br><br>$obj->comment<br><br><a href=\"index.php?cmd=12&phid=$recid\" class=\"mytable\">&nbsp;&nbsp;&nbsp;&nbsp;REPLY&nbsp;&nbsp;&nbsp;&nbsp;</a><table width=\"99%\" class=\"mytable2\" ><tr><td></td></tr></table><br>";				  				  $sql = "SELECT * FROM articlesmembers WHERE username='$username'";				  $rs = mysql_query($sql) or die(mysql_error());				  $o = mysql_fetch_object($rs);				  //echo mysql_num_rows($rs);				  												$num = 0;				for($i = 0; $i < count($thresholds); $i++)				{					if($o->postcount >= $thresholds[$i])						{							if($o->postcount < $thresholds[$i+1]);							{								$num = $i;							}						}				}				$posts = $o->postcount;				$rank = $ranks[$num];				  				  ?>            <tr >              <td width="12%" height="25" colspan="1" rowspan="2" class="normal" style="border-bottom: 1px solid #58564C; border-right: 1px solid #58564C; padding: 10px;"> <?php echo $o->postcount; ?> Posts <br />                  <?php echo $rank; ?> <br />                  <img width="100" src="pictures/<?php if($o->picture == ""){echo "nopic.gif";} else {echo $o->picture;} ?>"> <a href="index.php?cmd=16&username=<?php echo $username; ?>"><b><?php echo $username; ?></b></a> </td>              <td width="58%"  class="normal" style="border-bottom: 1px solid #58564C; padding: 0 0 0 10;"> <?php echo date("n-d-Y",strtotime($obj->postdate)); ?> </td>              <td width="30%" class="normal" align="right" style="border-bottom: 1px solid #58564C; padding: 0 10 0 0;"><a href="index.php?cmd=12&phid=<?php echo $recid; ?>" class=\"mytable\">REPLY</a></td>            </tr>            <tr >              <td class="normal" colspan="2" valign="top" style="border-bottom: 1px solid #58564C; padding: 10px;"><?php echo nl2br( stringWrap( linkify( $obj->comment ) ) ); ?><br />                  <br>                  <br>              </td>            </tr>            <?				  $i++;}				  $result=mysql_query("select * from articlescomments where approved='Y' and articleid='$recid'");				  $i=mysql_num_rows($result);				  if($i>10)				  {				  if($start-10<0) $x=0; else $x=$start-10;				  $z=$i-($start+10); if($z>10) $z=10;				  $y=$start+10;				  echo "<tr>					<td width=\"1\" height=\"25\" class=\"normal\">&nbsp;</td>					<td height=\"25\" colspan=\"2\" class=\"normal\">";				  if($start!=0)				    echo "<a href=index.php?cmd=6&recid=$recid&start=$x>Previous 10 comments</a>";				  if($start+11<=$i)				    echo " <a href=index.php?cmd=6&recid=$recid&start=$y>Next $z comments</a>";				  echo "</td></tr>";				  }				  ?>          </form>        </table>    </div></td>  </tr></table><?	  } if($phid) {	  ?><br><table width="100%" height="10" border="0" align="left" cellpadding="0" cellspacing="0" class="mytable">  <tr>    <td valign="top">      <div align="center">        <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" class="bg_table">          <form name="myform" action="index.php?cmd=12" method="post" onsubmit="javascript: return checkifvalid();">            <input type="hidden" name="phid" value="<? print $phid; ?>">            <tr >              <td width="4"  class="header" style="background:   url(/images/bg_tbl_ttl.gif) repeat-x;" >&nbsp;</td>              <td height="20" colspan="2" class="header" style="background:   url(/images/bg_tbl_ttl.gif) repeat-x;" >Post Comment</td>            </tr>            <tr >              <td width="4" height="25" class="normal">&nbsp;&nbsp;</td>              <td width="973" height="19" align="left" class="normal"><br><center>                  <textarea name="comment" cols="100" rows="10" class="customtext" id="comment"></textarea></center>              </td>            </tr>            <tr align="center" >              <td height="25" colspan="3" class="normal">                <input name="image" type="image" onClick="javaScript:document.myform.submit();" src="/images/submit.gif"  border="0"></td>            </tr>          </form>        </table>    </div></td>  </tr></table><br><? } ?>