逍遥派的顶级武功之一,与天山六阳掌、天山折梅手和小无相功齐名,可以吸取他人的内力以供己用,是迅速提升功力的捷径,内力既厚,天下武功无不为我所用,犹如北冥,大舟小舟无不载,大鱼小鱼无不容。“北冥有鱼,其名为鲲,鲲之大,不知其几千里也……”,能够容纳几千里的大鱼必定是非常广阔的海洋,因而北冥神功正是寓含了广大恢宏之意,也体现了神功的威力。
view plaincopy to clipboardprint? <?php //====================================ad.php======================================== //定义使用js显示 define('SHOWJS', 1); //引入需要用的的文件 require './include/common.inc.php'; require MOD_ROOT.'/include/global.func.php'; //将id转为Int形式 $placeid = intval($id); //定义查询语句 $query ="SELECT * FROM ".TABLE_ADS." AS a LEFT JOIN ".TABLE_ADS_PLACE." AS p ON (a.placeid=p.placeid) WHERE a.placeid=".$placeid." AND a.fromdate<=UNIX_TIMESTAMP() AND a.todate>=UNIX_TIMESTAMP() AND p.passed=1 AND a.passed=1 AND a.checked=1 ORDER BY a.addtime"; //进行数据库查询,使用缓存,大小为10240 $ads = $db->get_one($query, "CAHCE", 10240); //如果没有相应的广告,则退出,添加内容为空 if(!$ads) exit('document.write("")'); //如果存在该广告,则对其进行更新 $db->query("UPDATE ".TABLE_ADS." SET views=views+1 WHERE adsid=".$ads['adsid']); //模块的全局定义函数,将广告内容转换为html格式的代码,该函数位置为:../global.func.php $content = ads_content($ads); //确定模板文件的名字 $templateid = $ads['templateid'] ? $ads['templateid'] : 'ads'; //加载模板文件,并将其显示 include template('ads', $templateid); //将文件内容从缓存中输出 phpcache(); ?> <?php //==========================================add.php======================================== /** * 增加广告的php代码文件 */ //引入所需文件 require './include/common.inc.php'; //检查用户是否已经登录,如果没有登录则将其重定向到相应的页面 //showmessage()函数所在位置:/include/global.func.php if(!$_userid) showmessage($LANG['please_login_or_register'], $MODULE['member']['linkurl'].'login.php?forward='.urlencode($PHP_URL)); //取得用户名 $ads['username'] = $_username; //取得广告id $ads['placeid'] = intval($ads['placeid']); //如果id为空,显示非法参数,并将其返回到上一页 if(!$ads['placeid']) showmessage($LANG['invalid_parameters']); //从数据库中选择第一条匹配的广告 $sql = "select * from ".TABLE_ADS_PLACE." where placeid={$ads['placeid']} limit 1"; $result = $db->get_one($sql); //如果没有要选择的广告,显示:操作失败!意外错误,请确认存在此广告位。 if(emptyempty($result)) { showmessage($LANG['opration_failure_or_advertisement _not_exists']); } //如果存在此广告,则将其重新赋给变量$place $place = $result; //如果现金不足,显示:您的资金不足!请补充预留款! if($_money<($place['price']*$ads['longtime'])) showmessage($LANG['not_enough_balance_please_charge'],PHPCMS_PATH."pay/"); //添加广告,如果已经提交 if($submit) { //验证广告的名字是否合法 if(strlen($ads['adsname'])<2 || strlen($ads['adsname'])>30) { showmessage($LANG['invalid_name']); } //读取广告信息,并将其转义 $ads['adsname'] = str_safe($ads['adsname']); $ads['introduce'] = str_safe($ads['introduce']); $ads['alt'] = str_safe($ads['alt']); $ads['linkurl'] = linkurl($ads['linkurl']); $ads['text'] = str_safe($ads['text']); $ads['code'] = str_safe($ads['code']); //验证是否有广告发布日期 if(!$ads['fromdate']) { showmessage($LANG['please_input_the_advertising_day']); } //验证广告期限是否合法 if(!is_numeric($ads['longtime']) && !($ads['longtime'])>0) { showmessage($LANG['invalid_advertising_time']); } else { include_once(PHPCMS_ROOT."/include/date.class.php"); $date = new phpcms_date(); $date->set_date($ads['fromdate']); $date->monthadd($ads['longtime']); $ads['todate'] = $date->get_date(); } /* 根据广告的类型不同,将其添加到数据库 */ if($ads['type']=="image") { if(!strlen($imageurl)) showmessage($LANG['input_advertising_images_url']); $type_sql = ",type='{$ads['type']}',alt='{$ads['alt']}',linkurl='{$ads['linkurl']}',imageurl='{$imageurl}'"; } if($ads['type']=="flash") { if(!$flashurl) showmessage($LANG['please_input_the_flash_url']); $type_sql = ",type='{$ads['type']}',flashurl='{$flashurl}',wmode='".($ads['wmode']=="transparent"?"transparent":"")."'"; } if($ads['type']=="text") { if(!$ads['text']) showmessage($LANG['please_input_the_advertising_content']); $type_sql = ",type='{$ads['type']}',text='{$ads['text']}'"; } if($ads['type']=="code") { if(!$ads['code']) showmessage($LANG['please_input_the_advertising_code']); $type_sql = ",type='{$ads['type']}',code='{$ads['code']}'"; } $sql = "INSERT INTO ".TABLE_ADS." SET adsname='{$ads['adsname']}',introduce='{$ads['introduce']}',addtime='".time()."',placeid='{$ads['placeid']}',username='{$ads['username']}',checked=0,fromdate=".strtotime($ads['fromdate']).",todate=".strtotime($ads['todate']).$type_sql; $result=$db->query($sql); //判断数据是否已经被添加 if($db->affected_rows()>0) { showmessage($LANG['opration_success_waiting_for_check'], $MOD['linkurl']); } else { showmessage($LANG['opration_failure_make_sure_enter_the_correct_content']); } } showmessage($LANG['please_input_content'], $referer); ?> <?php //=======================================admin.inc.php============================================= //检查用户权限 //定义常量,指向模块根目录 //引入模块全局函数文件 defined('IN_PHPCMS') or exit('Access Denied'); define('MOD_ROOT', PHPCMS_ROOT.'/'.$mod); require MOD_ROOT.'/include/global.func.php'; //变量$mod在include中定义为"ads" $module = $mod; //定义菜单数组 $submenu = array( array('<font color="red">'.$LANG['add_advertisement'].'</font>','?mod='.$mod.'&file=adsplace&action=add&catid='.$catid), array($LANG['manage_advertisement'],'?mod='.$mod.'&file=adsplace&action=manage'), array($LANG['manage_the_order_of_advertisement'],'?mod='.$mod.'&file=ads&action=manage'), array($LANG['update_html_and_js'],'?mod='.$mod.'&file=createhtml'), ); //将子菜单添加到主菜单中 $menu = adminmenu($LANG['advertising_management'],$submenu); if( mailto:!@include_once(MOD_ROOT.%20/admin/%20.$file.%20.inc.php)) showmessage($LANG['illegal_operation']); ?> <?php //===============================================ads.php==================================== //很有趣的引入,引入ad.php文件 require './ad.php'; ?> <?php //==============================================clickads.php================================== //引入文件 require './include/common.inc.php'; //将id转换为十进制数字 $id = intval($id); //按id查找广告 $ads = $db->get_one("SELECT adsid,linkurl FROM ".TABLE_ADS." WHERE adsid=$id","CACHE",10240); //如果广告存在,取出他的链接地址 if($ads) { $db->query("UPDATE ".TABLE_ADS." SET hits=hits+1 WHERE adsid=".$ads['adsid']); $url = $ads['linkurl']; } ?> //将文件重定向到广告的地址 <SCRIPT LANGUAGE="JavaScript"> <!-- location.href = "<?=$url?>"; //--> </SCRIPT> <?php //==============================================./index.php=========================================== //引入所需文件 require './include/common.inc.php'; //确定分页标签 $page = isset($page) ? intval($page) : 1; $offset = ($page-1)*$PHPCMS['pagesize']; $r = $db->get_one("SELECT count(*) as num FROM ".TABLE_ADS_PLACE); $pages = phppages($r['num'], $page, $PHPCMS['pagesize']); //初始化 $places = array(); //分页查询数据从数据表中 $query ="SELECT * ". "FROM ".TABLE_ADS_PLACE." as p ". "order by placeid ". "limit $offset,$PHPCMS[pagesize] "; $result = $db->query($query); //将查询结果保存到$places数组中 while($r = $db->fetch_array($result)) { $places[] = $r; } //查询广告的详细信息 foreach ($places as $key=>$place) { $placeid = $place['placeid']; $query ="SELECT count(*) as users,max(todate),a.* ". "FROM ".TABLE_ADS." as a left join ".TABLE_ADS_PLACE." as p on (a.placeid=p.placeid) ". "where a.placeid=".$placeid." and a.todate>UNIX_TIMESTAMP() and p.passed=1 and a.passed=1 GROUP BY p.placeid"; $ads = $db->get_one($query); //如果广告不存在 if(emptyempty($ads)) { $ads['todate'] = "-"; $ads['users'] = "-"; $places[$key]['status'] = "<font color='red'>".$LANG['no_sign']."</font>"; $places[$key]['bgcolor'] = "#FFCC00"; } else { $ads['todate'] = date("Y-m-d", $ads['todate']); $places[$key]['status'] = $LANG['yes_sign']; $places[$key]['bgcolor'] = "#efefef"; } //将广告的信息存入$places数组 $places[$key]['ads'] = $ads; } //加载模板,显示广告列表 include template($mod, 'placelists'); ?> <?php //=====================================================sign.php====================================== //引入所需文件 require './include/common.inc.php'; //检查用户是否已经登录系统,否则显示错误信息,并将其转向到注册页面 if(!$_userid) showmessage($LANG['please_login_or_register'] , $MODULE['member']['linkurl'].'login.php?forward='.urlencode($PHP_URL)); //广告id $placeid = intval($placeid); //查询广告信息 $query ="SELECT max(todate) as todate,p.* ". "FROM ".TABLE_ADS." as a right join ".TABLE_ADS_PLACE." as p on (a.placeid=p.placeid) ". "where p.placeid=".$placeid." and p.passed=1 GROUP BY p.placeid"; $result = $db->get_one($query); //如果不存在查询的广告 if (emptyempty($result)) { showmessage($LANG['opration_failure_or_advertisement _not_exists']); } //将广告的查询结果返回赋值给$place变量 $place = $result; //显示广告时间 $fromdate = ($place['todate'] && $PHP_TIME < $place['todate']) ? date('Y-m-d', $place['todate']) : date('Y-m-d'); $_month = "<SELECT NAME='ads[longtime]'>"; //列出时间列表 for ($i=1;$i<=12;$i++) { $_month .= "<option value='$i'>$i {$LANG['month']}</option>"; } $_month .= "</SELECT>"; //加载模板,显示标签页面 include template($mod, 'sign'); ?> |