会员卡积分查询代码
会员卡积分查询代码,本人今天人公司写一个简单的会员查询的系统现在把一部份拿出来了.
<span id="jfcxtitle"></span>
<form action="" method="post" enctype="multipart/form-data" >
<label for="point">输入您的卡号:</label>
<input name="point" type="text" id="point" value="请输入您的卡号" onClick="this.value='';">
<input language="javascript" onclick="if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); " name="submit" id="" type="submit" tabIndex="3" value="确定查询" />
</form><font color=red>
<?php
if( $_POST ){
$value =addslashes(isset($_POST['point'])?$_POST['point']:'');
if( empty($value) || !is_numeric( $value) ){
echo '请入的卡号有误!';
}else{
$sql="select * from gx_integral where inte_card='$value' ";
$result=mysql_query($sql) or die('Database error! plase call us');
if (!mysql_num_rows( $result) ) {
echo '对不起,你输入的卡号不存在,请检查是否正确';
}else{
$rs =mysql_fetch_object( $result );
echo '你的目前的积分为:',$rs['inte_integral'];
mysql_free_result($rs);
}
}
}
?>
</font>
</div>
效果图片,
php 实现文章上一页与下一页 代码,这是我要写一个小作品时用到了,今天把它拿出来各各位分享一下下,记得以前我总想法不明白怎么实现文章上下一页的做法,后来在一个BBS看到了原来是判断当前ID然后order by 或asc就可以简单的实现了.
function nextpage($fid,$tag,$bid){
if('next' ==$tag){
$sql ="select * from gx_news where id<$fid and menu_id='$bid' order by id desc";
}elseif('prev' ==$tag){
$sql ="select * from gx_news where id>$fid and menu_id='$bid' order by id asc";
}
$result =mysql_query($sql);
if(!mysql_num_rows($result) ){
echo('己经没有了!');
}else{
$rs =mysql_fetch_array($result);
echo "<a href=news_page.php?id=".$rs[0].">".$rs['new_title']."</a>";
}
}
好了代码其实很容易的了我也不讲了只是给初学者看看文章上一页与下一页是怎么实现的喽.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=gb2312"/>
<title>最新新闻</title>
<style>
body {
background:#000000;
padding:10px;
font-size:12px;
margin:10px;
text-align:center;
}
#main {
background:#8B9C0D;
width:900px;
margin:0px auto;
}
.mleft,.mmid,.mright {
float:left;
}
.mleft,.mright {
background:#ABCDEF;
width:300px;
float:left;
}
.mmid {
background:#FECDBA;
width:300px;
float:left;
}
#footer {
background:#EB5566;
height:80px;
margin:0px auto;
width:900px;
}
a {
display:block;
text-align:left;
}
a:hover {
font-size:13px;
color:#FF0000;
}
a:visited {
color:#000000;
background:#FFC080;
}
</style>
</head>
<body>
<div id="main">
<div class="mleft">
<?php
$str = file_get_contents("http://news.163.com/rank/");
preg_match_all("#<div class="s3"><h6>(.*)</h6></div>#i",$str,$match);
for($i=0; $i<count($match[0]); $i++)
{
echo "tttt".preg_replace("#(<div.*h6>)(.*)(</h6></div>)#i","\2",$match[0][$i])."n";
}
?>
</div>
<div class="mmid">
<?php
$str = file_get_contents("http://news.sina.com.cn/hotnews/");
preg_match_all("#<span style='padding-left:6px'>(.*)</span></td>#i",$str,$match);
for($i=0;$i<count($match[0]);$i++)
{
echo "tttt".preg_replace("#<span style='padding-left:6px'>(.*)</span></td>#i","\1",$match[0][$i])."n";
}
?>
</div>
<div class="mright">
<?php
$str = file_get_contents("http://news.qq.com/paihang.htm");
preg_match_all("#<td align="left" class="left">(.*)</td>#i",$str,$match);
for($i=0;$i<count($match[0]);$i++)
{
echo "tttt".preg_replace("#<td align="left" class="left">(.*)</td>#i","\1",$match[0][$i])."n";
}
?>
</div>
</div>
<div id="footer"></div>
</body>
</html>
php给文章加关键字连接,像163文章内容自动加链接效果
<?php
$keys =array(
array('网页特效','/js_a/js.html'),
array('seo','/seo/seo.html'),
array('php','/phper/php.html'),
array('jsp','/jsp/jsp.html'),
array('asp','/asp/asp.html'),
array('ps','/fw/photo.html'),
array('photoshop','/fw/photo.html'),
array('javascript','/js_a/js.html'),
array('.net','/net/net.html'),
array('非主流','/fw/photo.html'),
array('网络','/mon/mon.html'),
array('css','/cssdiv/css.html'),
array('平面设计','/fw/photo.html'),
array('网站','/person/'),
array('网页制作','/wy/yw.html'),
array('搜索引擎','/seo/seo.html'),
array('优化','/seo/seo.html'),
array('动画','/flash_a/flash.html'),
array('数据库','/database/database.html'),
array('挣钱','/mon/mon.html'),
array('运营','/mon/mon.html')
);
$str ="今天是2008年8月5号,我的网站出现的问题这对seo有很多的问题,seo就是搜索引擎优化了,以前学php好啊现在觉得jsp好,css+div,网页,网页设计,网页制作,网页学习,网页教学,Photoshop,Flash,HTML,CSS,Dreamweaver,Fireworks,ASP,PHP,JSP,ASP.NET,网站建设,网站开发,网页特效,平面设计,个人网站,网页素材";
echo $str,"<br>";
foreach($keys as $nkeys){
//print_r($nkeys);echo"<br>";
//foreach( $nkeys as $join) {
//echo($join),"<br>";
if(strpos($str,$nkeys[0]) ){
$str =str_replace($nkeys[0],"<a href=http://111cn.net".$nkeys[1]." target=_blank >".$nkeys[0]."</a>",$str);
}
//}
}
echo $str;
?>
<?php
/***
分页类
20080505
***/
require_once('mysql.php');//mysql.php文件在上一篇日志
class page{
private $url;
private $pagesize;
private $sql;
private $getpage;
//参数:sql语句,每页记录数,传递链接(例如"index.php?"或者"index.php?sort=1&"等)
function __construct($sql,$pagesize,$url) {
$this->url = $url;
$this->pagesize = $pagesize;
$this->sql = $sql;
$this->getpage = $_GET["page"];
if(!$this->getpage) {
$this->getpage=1;
}
}
//取记录总数
function getcount() {
return mysql_num_rows(mysql_query($this->sql));
}
//格式化sql语句
function pagesql() {
$nowpage = $this->getpage;
$limitNumber= $this->pagesize;
if($nowpage<1) {
$nowpage=1;
}
return $this->sql." limit ".($nowpage-1)*$limitNumber.",".$limitNumber;
}
//显示分页,参数:显示数字链接个数,开始步进的页
function show($page = 5,$offset = 2){
$mpurl = $this->url;
$curr_page = $this->getpage;
$perpage = $this->pagesize;
$num=$this->getcount();//总记录数
$multipage = "";
if ($num > $perpage){
$pages = ceil($num / $perpage);
$from = $curr_page - $offset;
$to = $curr_page + $page - $offset - 1;
if ($page > $pages){
$from = 1;
$to = $pages;
}else{
if ($from < 1){
$to = $curr_page + 1-$from;
$from = 1;
if (($to - $from) < $page && ($to - $from) < $pages){
$to = $page;
}
}elseif ($to > $pages){
$from = $curr_page - $pages + $to;
$to = $pages;
if (($to - $from) < $page && ($to - $from) < $pages){
$from = $pages - $page + 1;
}
}
}
$multipage .="
<script language=\"javascript\">
function gotoPage(value)
{
value = parseInt(value);
if(isNaN(value))
value = 0;
if(value<1)
value = 1;
if(value>".$pages.")
value = ".$pages.";
window.location.href = \"".$mpurl."page=\"+value;
}
</script>";
$multipage .= "<div class=\"p_bar\">";
$multipage .= "<a class=\"p_total\"> ".$num." </a>\n";
$multipage .= "<a class=\"p_pages\"> ".$curr_page."/".$pages." </a>\n";
if ($curr_page - $offset > 1){
$multipage .= "<a class=\"p_redirect\" href=\"".$mpurl."page=1\" title='首页'>«</a>\n";
}
for ($i = $from; $i <= $to; $i++){
if ($i != $curr_page){
$multipage .= "<a class=\"p_num\" href=\"".$mpurl."page=".$i."\" title='第".$i."页'>".$i."</a>\n";
}else{
$multipage .= "<a class=\"p_curpage\">".$i."</a>\n";
}
}
if ($curr_page + $offset < $pages){
$multipage .= "<a class=\"p_redirect\" href=\"".$mpurl."page=$pages\" title='尾页'>»</a>\n";
}
$multipage .= "<input class=\"p_input\" title=\"输入页数,按回车跳转\" name=\"pageGo\" id=\"pageGo\" onKeydown=\"if(event.keyCode == 13) {gotoPage(this.value);return false;}\">\n";
//$multipage .= "<a class=\"p_total\">".$perpage."条/页</a>\n";
$multipage .= "</div>";
}
return $multipage;
}
}
?>
相关文章
- 这篇文章主要介绍了Mybatis Plus select 实现只查询部分字段的操作,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教...2021-09-01
- 有一种方法,可以不打开网站而直接查看到这个网站的源代码.. 这样可以有效地防止误入恶意网站... 在浏览器地址栏输入: view-source:http://...2016-09-20
- <?php require('path.inc.php'); header('content-Type: text/html; charset=utf-8'); $borough_id = intval($_GET['id']); if(!$borough_id){ echo ' ...2016-11-25
- 本文实例讲述了JS+CSS实现分类动态选择及移动功能效果代码。分享给大家供大家参考,具体如下:这是一个类似选项卡功能的选择插件,与普通的TAb区别是加入了动画效果,多用于商品类网站,用作商品分类功能,不过其它网站也可以用,...2015-10-21
- 本文实例讲述了JS实现自定义简单网页软键盘效果。分享给大家供大家参考,具体如下:这是一款自定义的简单点的网页软键盘,没有使用任何控件,仅是为了练习JavaScript编写水平,安全性方面没有过多考虑,有顾虑的可以不用,目的是学...2015-11-08
- 本文实例讲述了JS基于Mootools实现的个性菜单效果代码。分享给大家供大家参考,具体如下:这里演示基于Mootools做的带动画的垂直型菜单,是一个初学者写的,用来学习Mootools的使用有帮助,下载时请注意要将外部引用的mootools...2015-10-23
- php 取除连续空格与换行代码,这些我们都用到str_replace与正则函数 第一种: $content=str_replace("n","",$content); echo $content; 第二种: $content=preg_replac...2016-11-25
MyBatisPlus-QueryWrapper多条件查询及修改方式
这篇文章主要介绍了MyBatisPlus-QueryWrapper多条件查询及修改方式,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教...2022-06-27- php简单用户登陆程序代码 这些教程很对初学者来讲是很有用的哦,这款就下面这一点点代码了哦。 <center> <p> </p> <p> </p> <form name="form1...2016-11-25
- 公司一些wordpress网站由于下载的插件存在恶意代码,导致整个服务器所有网站PHP文件都存在恶意代码,就写了个简单的脚本清除。恶意代码示例...2015-10-23
- 这篇文章主要介绍了Oracle使用like查询时对下划线的处理方法,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下...2021-03-16
- 其实挺简单的就是if(navigator.userAgent.indexOf('UCBrowser') > -1) {alert("uc浏览器");}else{//不是uc浏览器执行的操作}如果想测试某个浏览器的特征可以通过如下方法获取JS获取浏览器信息 浏览器代码名称:navigator...2015-11-08
- 这篇文章主要介绍了解决mybatis-plus 查询耗时慢的问题,具有很好的参考价值,希望对大家有所帮助。如有错误或未考虑完全的地方,望不吝赐教...2021-07-04
- 本文实例讲述了JS实现双击屏幕滚动效果代码。分享给大家供大家参考,具体如下:这里演示双击滚屏效果代码的实现方法,不知道有觉得有用处的没,现在网上还有很多还在用这个特效的呢,代码分享给大家吧。运行效果截图如下:在线演...2015-10-30
- 一、日期减去天数等于第二个日期function cc(dd,dadd){//可以加上错误处理var a = new Date(dd)a = a.valueOf()a = a - dadd * 24 * 60 * 60 * 1000a = new Date(a)alert(a.getFullYear() + "年" + (a.getMonth() +...2015-11-08
- 微信支付,即便交了保证金,你还是处理测试阶段,不能正式发布。必须到你通过程序测试提交订单、发货通知等数据到微信的系统中,才能申请发布。然后,因为在微信中是通过JS方式调用API,必须在微信后台设置支付授权目录,而且要到...2014-05-31
- 本文实例讲述了PHP常用的小程序代码段。分享给大家供大家参考,具体如下:1.计算两个时间的相差几天$startdate=strtotime("2009-12-09");$enddate=strtotime("2009-12-05");上面的php时间日期函数strtotime已经把字符串...2015-11-24
- 小编分享了一段简单的php中文转拼音的实现代码,代码简单易懂,适合初学php的同学参考学习。 代码如下 复制代码 <?phpfunction Pinyin($_String...2017-07-06
php导出csv格式数据并将数字转换成文本的思路以及代码分享
php导出csv格式数据实现:先定义一个字符串 存储内容,例如 $exportdata = '规则111,规则222,审222,规222,服2222,规则1,规则2,规则3,匹配字符,设置时间,有效期'."/n";然后对需要保存csv的数组进行foreach循环,例如复制代...2014-06-07- ecshop商品无限级分类代码 function cat_options($spec_cat_id, $arr) { static $cat_options = array(); if (isset($cat_options[$spec_cat_id]))...2016-11-25