<?php // // plock.net // Copyright (c) 1999-2008 Justin Plock. All Rights Reserved. // http://plock.net // // $Id: index.php 2188 2008-12-17 18:49:57Z jplock $
require './connect.inc';
require INCLUDE_DIR.'/header.php'; /*if (!isset($_GET['hostname'])) { $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']); } else { $hostname = $_GET['hostname']; } if (preg_match('/rh([a-z][a-z])?\.psu\.edu/i', $hostname) || !empty($_GET['userid'])) { if (preg_match('/^([^\.]+)\./', $hostname, $user) || !empty($_GET['userid'])) { $ph = fsockopen('ldap.aset.psu.edu', 105); if ($ph) { stream_set_blocking($ph, false); if (empty($_GET['userid'])) { $userid = $user[1]; } else { $userid = $_GET['userid']; } fputs($ph, "query userid=$userid return name\r\n"); while (!feof($ph)) { $line = fgets($ph, 255); $line = preg_replace('/\s\s+/i', ' ', $line); if (preg_match('/^-515:|^-507:|^-515:|^-598:|^590/', $line)) { break; } if (preg_match('/^50[12]:(.*)/', $line)) { break; } if (preg_match("/^\-200:1: name: ([^\n]*)/", $line, $match)) { list($first_name, $middle_name, $last_name) = explode(' ', $match[1]); echo '<bgsound src="http://192.20.225.55/tts/cgi-bin/nph-talk?voice=mike&txt=hello+'.$first_name.'+'.$last_name.'+welcome+to+plock+dot+net&speakButton=1&audio=.wav" loop="0" delay="0"/>'; break; } if (preg_match('/^200:/', $line)) { break; } } fclose($ph); } } }*/ print_header('Welcome to plock.net'); ?> <table width="100%" border="0" cellspacing="0" cellpadding="2"> <tr valign="top" bgcolor="#FFFFFF"><td width="100%"> <?php if (!empty($_GET['page'])) { $page = (int)$_GET['page']; } else { $page = 1; }
$db->query("SELECT COUNT(*) AS count FROM `news` WHERE approved='Y' AND is_hidden=0 AND site_id='".SITE_ID."'"); if ($db->next_record()) { $totalresults = $db->Record['count']; } $db2 = new DB_Sql(); $db->query("SELECT n.*, UNIX_TIMESTAMP(n.timestamp) AS date, nt.topic AS category, u.username FROM `news` n LEFT JOIN `news_topics` nt ON n.category=nt.id LEFT JOIN `users` u ON n.user_id=u.id WHERE n.approved='Y' AND n.is_hidden=0 AND n.site_id='".SITE_ID."' ORDER BY n.locked DESC, date DESC LIMIT ".(($page - 1) * $scheme['news_num']).','.$scheme['news_num']); if ($totalresults > 0) { while ($db->next_record()) { $text = stripslashes($db->Record['summary']); if ($db->Record['htmltext'] == 'text') { $text = nl2br($text); } $text = str_replace('F1-QUOTE', START_QUOTE, $text); $text = str_replace('F2-QUOTE', END_QUOTE, $text); echo '<p><img src="/images/bullet.gif" alt="" width="13" height="11" border="0"/><a href="/news/post/'.$db->Record['id'].'/" class="topic">'.$db->Record['topic'].'</a><br/>'; echo 'Contributed by <a href="/bio.php?id='.$db->Record['user_id'].'">'.$db->Record['username'].'</a> on '.date($scheme['newstime_format'], $db->Record['date'] + TIME_OFFSET).'</p>'; echo '<p>'.$text.'</p>'; echo '<p align="right">( <a href="/news/post/'.$db->Record['id'].'/" class="more">'.$db->Record['views'].' view'; if ($db->Record['views'] != 1) { echo 's'; } if ($db->Record['allow_comment'] == 'Y') { $db2->query("SELECT COUNT(*) AS count FROM `news_comments` WHERE news_id='".$db->Record['id']."' AND site_id='".SITE_ID."'"); if ($db2->next_record()) { echo ' | '.$db2->Record['count'].' comment'; if ($db2->Record['count'] != 1) { echo 's'; } } } echo '</a> )</p><hr width="100%" size="1"/>'; } $num_pages = ceil($totalresults / $scheme['news_num']); if ($num_pages > 1) { echo '<p align="center">'; if ($page > 1) { echo '< <a href="'.$_SERVER['PHP_SELF'].'?page='.($page - 1).'" class="more">Previous Page</a> | '; } echo '<a href="/news/" class="more">News Archive</a>'; if ($page != $num_pages) { echo ' | <a href="'.$_SERVER['PHP_SELF'].'?page='.($page + 1).'" class="more">Next Page</a> >'; } echo '</p>'; } $db->query("SELECT n.topic, nc.ip, nc.news_id, nc.id as comment_id, nc.text, nc.account_id, a.username FROM `news_comments` nc LEFT JOIN `account` a ON nc.account_id=a.id LEFT JOIN `news` n ON nc.news_id=n.id WHERE nc.site_id='".SITE_ID."' AND a.username!='' ORDER BY nc.timestamp DESC LIMIT ".$scheme['commenthighlight_num']); if ($db->num_rows() > 0) { echo '<table border="0" cellspacing="0" cellpadding="2" align="center" bgcolor="#004080" width="80%">'; echo '<tr><td colspan="3"><font class="quote"><b>Last '.$scheme['commenthighlight_num'].' Comments</b></font></td></tr>'; while ($db->next_record()) { echo '<tr valign="top"><td nowrap="nowrap"><font class="quote">By: <a href="/accounts/profile.php?name='.rawurlencode($db->Record['username']).'" class="nav">'.$db->Record['username'].'</a></font></td><td><font class="quote"><a href="/news/comment/'.$db->Record['comment_id'].'/" class="nav">'; $text = ereg_replace('[bi-s]\[([^\]]*)\][bi-s]', '\\1', $db->Record['text']); $text = ereg_replace('[rgb]\{([^\}]*)\}[rgb]', '\\1', $text); if (strlen($text) > $scheme['commenttopic_num']) { $text = substr($text, 0, $scheme['commenttopic_num']).'...'; } $text = str_replace('[[', '<', $text); $text = str_replace(']]', '>', $text); echo $text.'</a></font></td><td><font class="quote">@ <a href="/news/post/'.$db->Record['news_id'].'/" class="nav">'.$db->Record['topic'].'</a></font></td></tr>'; } echo '</table>'; } } ?> </td><td width="150"> <table width="100%" border="0" cellspacing="5" cellpadding="5"> <tr bgcolor="#004080"><td><font class="quote"> <?php $db->query("SELECT id, small_image, text FROM `potd` WHERE current='Y' AND site_id='".SITE_ID."'"); if ($db->next_record()) { echo '<a href="/potd/potd.php?potd_id='.$db->Record['id'].'"><img src="'.$db->Record['small_image'].'" alt="" width="150" border="0"/></a><br/>'.$db->Record['text']; $db2->query("SELECT COUNT(*) AS count FROM `potd_comments` WHERE potd_id='".$db->Record['id']."' AND site_id='".SITE_ID."'"); $db2->next_record(); $totalcomments = $db2->Record['count']; echo '<br/>[ <a href="/potd/potd.php?potd_id='.$db->Record['id'].'" class="nav">'.$totalcomments.' Comments</a> | <a href="/potd/" class="nav">POTDs</a> ]'; } ?> </font></td></tr> <tr bgcolor="#004080"><td><font class="quote"> <?php $db->query("SELECT * FROM `poll` WHERE current='Y' AND site_id='".SITE_ID."'"); if ($db->next_record()) { $db2->query("SELECT * FROM `poll_votes` WHERE ip='".$_SERVER['REMOTE_ADDR']."' AND poll_id='".$db->Record['id']."' AND site_id='".SITE_ID."'"); if ($db2->num_rows() > 0) { $db2->query("SELECT COUNT(*) AS total FROM `poll_votes` WHERE poll_id='".$db->Record['id']."' AND site_id='".SITE_ID."'"); $db2->next_record(); $totalvotes = (int)$db2->Record['total']; $db2->query("SELECT COUNT(*) AS comments FROM `poll_comments` WHERE poll_id='".$db->Record['id']."' AND site_id='".SITE_ID."'"); $db2->next_record(); $totalcomments = (int)$db2->Record['comments']; $db2->query("SELECT choice, COUNT(*) AS number FROM `poll_votes` WHERE poll_id='".$db->Record['id']."' AND site_id='".SITE_ID."' GROUP BY choice"); while ($db2->next_record()) { $votes[$db2->Record['choice']] = $db2->Record['number']; } echo '<strong>'.$db->Record['question'].'</strong><br/><br/>'; for ($i = 1; $i < 13; $i++) { if ($db->Record['choice'.$i] != '') { if ($votes[$i] == '') { $votes[$i] = '0'; } echo $db->Record['choice'.$i].' ('.round(($votes[$i] / $totalvotes) * 100).'%)<br/>'; echo '<img src="/images/whitebar.gif" alt="'.$votes[$i].' Vote(s)" width="'.round($votes[$i] / $totalvotes * 125).'" height="8" border="0"/><br/>'; } } echo '<br/>Total Votes: '.$totalvotes.'<br/>'; echo '[ <a href="/polls/poll.php?poll_id='.$db->Record['id'].'" class="nav">'.$totalcomments.' Comments</a> | <a href="/polls/" class="nav">Polls</a> ]'; } else { ?> <form action="/polls/submit_vote.php" method="post"> <input type="hidden" name="poll_id" value="<?php echo $db->Record['id']?>"/> <input type="hidden" name="desturl" value="/polls/poll.php?poll_id=<?php echo $db->Record['id']?>&polls=1"/> <?php echo '<strong>'.$db->Record['question'].'</strong><br/>'; for ($i = 1; $i < 13; $i++) { if ($db->Record['choice'.$i] != '') { echo '<input type="radio" name="choice_id" value="'.$i.'"/>'.$db->Record['choice'.$i].'<br/>'; } } ?> <br/><input type="submit" value="Vote"> [ <a href="/polls/poll.php?poll_id=<?php echo $db->Record['id']?>&polls=1" class="nav">Results</a> | <a href="/polls/" class="nav">Polls</a> ] </form> <?php } } ?> </font></td></tr> <tr bgcolor="#004080"><td><font class="quote"> <strong>Broken Dreams</strong>:<br/> <?php $db->query("SELECT u.username, h.user_id, UNIX_TIMESTAMP(h.timestamp) AS date, h.text FROM `highlight` h LEFT JOIN `users` u ON h.user_id=u.id WHERE h.site_id='".SITE_ID."' ORDER BY h.timestamp DESC LIMIT ".$scheme['highlight_num']); while ($db->next_record()) { $image = date('mdy', $db->Record['date'] + TIME_OFFSET).'_screen.jpg'; if (file_exists(HIGHLIGHTIMAGE_DIR.'/'.$image)) { echo '<a href="/highlight/images/'.$image.'_screen.jpg">'.date($scheme['highlighttime_format'], $db->Record['date'] + TIME_OFFSET).'</a>'; } else { echo date($scheme['highlighttime_format'], $db->Record['date'] + TIME_OFFSET); } echo ' - '.stripslashes($db->Record['text']).'<br/>'; echo '- <a href="/bio.php?id='.$db->Record['user_id'].'" class="nav">'.$db->Record['username'].'</a>'; } ?> [ <a href="/highlight/" class="nav">Archive</a> ]</font</td></tr>
<tr bgcolor="#004080"><td> <font class="quote"><strong>Countdowns</strong>:</font><br/> <?php $cur_time = time(); $countdowns = array(); $countdowns['Chuck\'s Wedding'] = mktime(0, 0, 0, 5, 23, 2009); $countdowns['ruiZ\'s Wedding'] = mktime(0, 0, 0, 6, 27, 2009); $countdowns['Our Wedding'] = mktime(13, 0, 0, 5, 15, 2010); ?> <table border="0" cellspacing="0" cellpadding="0"> <?php foreach ($countdowns as $event=>$end_time) { if ($end_time > $cur_time-86400) { ?> <tr valign="top"> <td><font class="quote"><?php echo $event?>:</font></td><td align="right" nowrap="nowrap"><font class="quote"><?php $days = ($end_time-$cur_time) / 86400; if ($days > 0) { $days = ceil($days); echo $days; if ($days == 1) { echo ' day!'; } else { echo ' days'; } } else { echo 'TODAY!!'; } ?></font></td> </tr> <?php } } ?> </table> </td></tr> </table>
<!-- Start of Flickr Badge --> <style type="text/css"> #flickr_badge_source_txt {padding:0; font: 11px Arial, Helvetica, Sans serif; color:#666666;} #flickr_badge_icon {display:block !important; margin:0 !important; border: 1px solid rgb(0, 0, 0) !important;} #flickr_icon_td {padding:0 5px 0 0 !important;} .flickr_badge_image {text-align:center !important;} .flickr_badge_image img {border: 1px solid black !important;} #flickr_badge_uber_wrapper {width:150px;} #flickr_www {display:block; text-align:center; padding:0 10px 0 10px !important; font: 11px Arial, Helvetica, Sans serif !important; color:#3993ff !important;} #flickr_badge_uber_wrapper a:hover, #flickr_badge_uber_wrapper a:link, #flickr_badge_uber_wrapper a:active, #flickr_badge_uber_wrapper a:visited {text-decoration:none !important; background:inherit !important;color:#3993ff;} #flickr_badge_wrapper {background-color:#ffffff;border: solid 1px #000000} #flickr_badge_source {padding:0 !important; font: 11px Arial, Helvetica, Sans serif !important; color:#666666 !important;} </style> <table id="flickr_badge_uber_wrapper" cellpadding="0" cellspacing="10" border="0"><tr><td><a href="http://www.flickr.com" id="flickr_www">www.<strong style="color:#3993ff">flick<span style="color:#ff1c92">r</span></strong>.com</a><table cellpadding="0" cellspacing="10" border="0" id="flickr_badge_wrapper"> <script type="text/javascript" src="http://www.flickr.com/badge_code_v2.gne?show_name=1&count=5&display=latest&size=t&layout=v&source=user&user=89187803%40N00"></script> <tr> <td id="flickr_badge_source" valign="center" align="center"> <table cellpadding="0" cellspacing="0" border="0"><tr> <td width="10" id="flickr_icon_td"><a href="http://www.flickr.com/photos/jplock/" rel="me"><img id="flickr_badge_icon" alt="bigkong's photos" src="http://static.flickr.com/5/buddyicons/89187803@N00.jpg?1109641599" align="left" width="48" height="48"></a></td> <td id="flickr_badge_source_txt"><nobr>More of</nobr> <a href="http://www.flickr.com/photos/jplock/" rel="me">jplock's photos</a></td> </tr></table> </td> </tr> </table> </td></tr></table> <!-- End of Flickr Badge -->
</td></tr></table> <?php print_footer(); require INCLUDE_DIR.'/footer.html';
|
|