Skip to content

Instantly share code, notes, and snippets.

@lizheming
Created October 23, 2012 10:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lizheming/3938001 to your computer and use it in GitHub Desktop.
Save lizheming/3938001 to your computer and use it in GitHub Desktop.
PageCookery网站挂件主文件
<?php
header('Content-Type:application/javascript;charset=utf-8');
require_once("global.php");
if (!isset($_GET['mount'])){
$_GET['mount']='10';
}
?>
document.getElementById('pagecookery').innerHTML='<?php
if(ereg("^[0-9]*$",$_GET['mount'])){
$sql='SELECT * FROM entry ORDER BY time DESC LIMIT '.$_GET['mount'];
$entry = $db->query($sql)->result_array();
echo '<style type="text/css">#pagecookery img {display:none;}</style><ul>';
foreach($entry as $item){
echo '<li>';
echo '<span clss="entry">' . get_username_by_id($item['userid']) . '</span>';
echo ':';
echo Format::ParseBBCode( htmlspecialchars($item['content'],ENT_QUOTES));
echo '<a href="' . BASE_URL .'?act=view&id=' . $item['id'] . '" target="_blank"><span class="time">' . Format::Time($item['time']) . '</span></a>';
echo '</li>';
}
echo '</ul>';
}else{
echo '这里没有你要的东西呢';
}
?>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment