php基本代码大全_精品文档.txt资料文档下载

上传人:b****2 文档编号:13601401 上传时间:2022-10-12 格式:TXT 页数:14 大小:15.48KB
下载 相关 举报
php基本代码大全_精品文档.txt资料文档下载_第1页
第1页 / 共14页
php基本代码大全_精品文档.txt资料文档下载_第2页
第2页 / 共14页
php基本代码大全_精品文档.txt资料文档下载_第3页
第3页 / 共14页
php基本代码大全_精品文档.txt资料文档下载_第4页
第4页 / 共14页
php基本代码大全_精品文档.txt资料文档下载_第5页
第5页 / 共14页
点击查看更多>>
下载资源
资源描述

php基本代码大全_精品文档.txt资料文档下载

《php基本代码大全_精品文档.txt资料文档下载》由会员分享,可在线阅读,更多相关《php基本代码大全_精品文档.txt资料文档下载(14页珍藏版)》请在冰豆网上搜索。

php基本代码大全_精品文档.txt资料文档下载

$pages;

$startpos=$page*$eachpage;

$sql.="

limit$startpos,$eachpage"

//��ʾ��ҳ

functionshowpage()

global$page,$pages,$prepage,$nextpage,$queryString;

//paramfromgenpagefunction

$shownum=10/2;

$startpage=($page>

=$shownum)?

$page-$shownum:

$endpage=($page+$shownum<

=$pages)?

$page+$shownum:

echo"

��"

.($pages+1)."

ҳ:

if($page>

0)echo"

ahref=$PHP_SELF?

page=0$queryString>

��ҳ<

/a>

if($startpage>

0)

echo"

...<

b>

page="

.($page-$shownum*2)."

$queryString>

/b>

for($i=$startpage;

$i<

=$endpage;

$i++)

{

if($i==$page)echo"

<

["

.($i+1)."

]<

elseecho"

page=$i$queryString>

}

if($endpage<

$pages)

.($page+$shownum*2)."

..."

if($page<

page=$pages$queryString>

βҳ<

//��ʾ������ķ�ҳ

functionshowpage1()

$fenlei=$_GET["

fenleiid"

fenleiid=$fenlei&

2����������

��һ��

genpage($sql);

//ֻ��Ҫ�������������һ�о�ok��

�ڶ���

showpage();

//��ʾҳ

mysql_close();

4���������˰���

phprequire_once('

conn.php'

?

5����ν�һ����¼

д�����ݿ⣬Ȼ����ʾ����תҳ��

$ly_title=$_POST["

ly_title"

$ly_content=$_POST["

ly_content"

$ly_time=$_POST["

ly_time"

$ly_author=$_POST["

ly_author"

$ly_email=$_POST["

ly_email"

insertintoliuyan(ly_title,ly_content,ly_time,ly_author,ly_email)values('

.$ly_title."

'

'

.$ly_content."

.$ly_time."

.$ly_author."

.$ly_email."

)"

mysql_query($sql,$connec);

echo("

scripttype='

text/javascript'

alert('

��ӳɹ���'

location.href='

index.php'

/script>

6�������Ի��򣬲

�����ҳ����ת

7����Ϣ�鿴ҳ�棨��������ȡ���ݿ⣩

1)��������ȡ���ݿ�

select*fromliuyanwherely_id=$_GET[id]"

$rs=mysql_fetch_array($conn);

2����ij���ֶ����

=$rs[ly_title]?

3���ر����ݿ�

8�������ݿ���ijһ����¼

���и��²

�����������ʾ��ת

updateliuyansetly_title='

$ly_title'

ly_content='

$ly_content'

ly_time='

$ly_time'

ly_author='

$ly_author'

ly_email='

$ly_email'

wherely_id=$_GET[id]"

���³

ɹ���'

../index.php'

9�����ɾ�����ݿ��е�һ����¼

deletefromliuyanwherely_id=$_GET[id]"

ɾ���ɹ���'

10����ν��л�Ա��¼

��֤

session_start();

$username=$_POST["

username"

$password=$_POST["

password"

select*fromadminwhereusername='

.$username."

&

&

password='

.$password."

$result=mysql_query($sql,$connec);

if($row=mysql_fetch_array($result)){

session_register("

admin"

$admin=$username;

��¼

�ɹ���'

admin.php'

else

��������û

���������������������룡'

login.php'

11����ζ�SESSION���м��飨��̨���ҳ���������

if(!

isset($_SESSION["

])){

header("

location:

login.php"

exit;

12����֤�û

����������Ƿ���д��javascript��

SCRIPTlanguage=javascript>

!

--

functionconfirmlogin()

if(document.frmmain.username.value.length<

4||document.frmmain.username.value=="

document.frmmain.username.focus();

document.frmmain.username.select;

window.alert("

����������û

���!

returnfalse;

if(document.frmmain.password.value.length<

4)

document.frmmain.password.focus();

document.frmmain.password.select;

�������������!

returntrue;

//-->

/SCRIPT>

13����PHP�е��ñ

༭���ķ���

1�����༭���ļ��з��ú

�̨�����ļ����ڡ�

2�������������������������

inputname="

content"

type="

hidden"

value='

IFRAMEID="

eWebEditor1"

src="

eWebEditorPHP38/ewebeditor.htm?

id=content&

style=coolblue"

frameborder="

0"

scrolling="

no"

width="

550"

height="

350"

/IFRAME>

ע��eWebEditorPHP38�༭���ļ��е����ơ�

id=content��content���������������

14��ѭ��������ܹ�ʵ�ַ��У�

1�����Ȳ���һ��һ�б��

$i=1;

table>

<

tr>

<

td>

��ѭ���������������

/td>

if($i%2==0){

echo"

/tr>

}

$i++;

?

/table>

15���������б�������(�������޸�ʱĬ��ѡ��)

selectname="

select*fromfenleibiao"

while($rs1=mysql_fetch_array($conn)){

optionvalue="

=$rs1["

]?

if($rs["

]==$rs1["

]){

echo"

selected"

;

flname"

/option>

<

php>

<

/select>

16����ȡ�ַ����Ⱥ���

strlen($c)>

12

17������һ���ַ���ȡ����

�÷

���<

=substrgb($rs["

title"

],10)?

functionsubstrgb($in,$num){

$pos=0;

$out="

while($c=substr($in,$pos,1)){

if($c=="

\n"

)break;

if(ord($c)>

128){

$out.=$c;

$pos++;

$c=substr($in,$pos,1);

$out.=$c;

}else{

$pos++;

if($pos>

=$num)break;

if($out!

=$in)$out=$out."

..."

return$out;

18���ж��Ƿ�������

is_numeric(qq)

19��PHP�����л�ȡ��ǰ����

$ptime=date("

y-m-d"

20���û

�ע��ʱ��ʹ�õ

�PHP��֤����

if($admin=="

or(strlen($admin)>

16)or(strlen($admin)<

2)){

echo"

SCRIPTlanguage=JavaScript>

alert('

�������û

���(���ܴ���16С��2)'

echo"

this.location.href='

vbscript:

history.back()'

if($password=="

orstrlen($password)>

16orstrlen($password)<

6){

���볤��Ϊ6-16���ַ�'

){

ȷ�����벻��Ϊ��'

}else{

if($password!

=$password1){

�����ȷ�����벻һ��'

if($wt="

�������ⲻ��Ϊ��'

if($da="

����𰸲

�����'

if($qq!

="

if(!

is_numeric($qq)){

QQ�������������'

if($youbian=="

orstrlen($youbian)!

=6){

����ȷ�����ʱ�'

if($youbian!

is_numeric($youbian)){

�ʱ����������'

if($dizhi="

סַ����Ϊ��'

if($mail=="

E-mail����Ϊ�գ�'

}

if($textarea=="

����˵������Ϊ�գ�'

orstrlen(textarea)>

150){

����˵��Ϊ150���ַ�'

echo"

24������������ݽ����жϣ��Ӷ�����������

if($rs["

active"

]==1){

fontcolor='

#ff0000'

����<

/font>

}else{

����"

25.�ַ���ȡ����

=substr("

$rs[zixun_biaoti]"

0,28

)?

26.��Ů�����ѡ��ѡ���

inputtype="

radio"

name="

hy_zhuangtai"

value="

phpif($rs["

hy_zhungtai"

]==="

){echo"

checked"

}?

��

Ů"

Ů

27.��ѡ������ѡ���

phpif($rs['

hy_zhuangtai'

]=='

����'

){?

<

ahref="

Userzt.php?

action=yes&

id=<

phpecho$rs['

hy_id'

php}

else{

action=no"

php}?

����saveҳ��

../../conn.php'

$hy_id=$_GET['

id'

$action=$_GET['

action'

if($action=='

yes'

){

updatehybiaosethy_zhuangtai='

wherehy_id='

$id'

$query=mysql_query($sql,$connec);

UserManage.php'

else{

28.������ֹ���,�򽫹

����IJ��ֱ��ʡ�Ժ���ʾ

DIVSTYLE="

width:

120px;

height:

50px;

border:

0pxsolidblue;

overflow:

hidden;

text-overflow:

ellipsis"

NOBR>

���DZ�����һ�����֣��ܳ��������һ����ʾ����.<

/NOBR>

/DIV>

29.

��ֹ���ƣ�����϶�ѡȡ

bodyondragstart=window.event.returnValue=falseoncontextmenu=window.event.returnValue=falseonselectstart=event.returnValue=false>

30.����С���ֵı仯

scripttype="

text/javascript"

functiondoZoom(size)

{document.getElementById('

zoom'

).style.fontSize=size+'

px'

spanid="

zoom"

��Ҫָ����С������<

/span>

javascript:

doZoom(16)"

��<

doZoom(14)"

doZoom(12)"

С<

30.

��ӵ��ղؼк���Ϊ��ҳ

ahref=#onclick="

this.style.behavior='

url(#default#homepage)'

this.setHomePage('

window.external.AddFavorite('

31.

����ʾ��ҳ������޸�ʱ��

scriptlanguage=JavaScript>

document.write("

������ʱ��:

+document.lastModified+"

32.

���յ���ʱ

ScriptLanguage="

JavaScript"

����vartimedate=newDate("

October1,2002"

����vartimes="

�����"

����varnow=newDate();

����vardate=timedate.getTime()-now.getTime();

����vartime=Math.floor(date/(1000*60*60*24));

����if(time>

=0)

����document.write("

������"

+times+"

����:

+time+"

/Script>

33.

�򿪴

��ڼ����

scriptlanguage="

--Begin

self.moveTo(0,0)

self.resizeTo(screen.availWidth,screen.availHeight)

//End-->

34.

���뱳������

bgsoundsrc="

mid/windblue[1].mid"

loop="

-1"

ֻ������IE

embedsrc="

music.mid"

autostart="

true"

hidden="

��Netscape,IE������

35.

����

marqueedirection=upheight=146onmouseout=start()onmouseover=stop()scrollAmount=2>

������Ϣ

/marquee>

36.

��ֹ���������ʱ��ҳ���������õ

�ҳ�׶�

���롰javascript:

void(null)������ԭ���ġ�#�����

37.

���ܵ��Ҽ�������CTRL+A�����ܸ�����!

bodyoncontextmenu="

window.event.returnValue=false"

onkeypress="

onkeydown="

onkeyup="

ondragstart="

onselectstart="

event.returnValue=false"

/body>

����任����ͼ��һ������ˢ���������Ч��

����image=newArray(4);

//����imageΪͼƬ����������

����image[0]='

tu0.gif'

//����ͼ���·

��

����image[1]='

tu1.gif'

����image[2]='

tu2.gif'

����image[3]='

tu3.gif'

����image[4]='

tu4.gif'

����number=Math.floor(Math.random()*image.length);

����document.write("

BODYBACKGROUND="

+image[number]+"

38.

���������������

style="

cursor:

hand"

39.

��ιرղ�

divid="

Layer1"

/div>

#"

onClick="

Layer1.style.display='

none'

�رղ�<

40.

ahref=javascript:

close()>

[�رմ���]<

41.

�������ֱ���Ϊ��ɫ

divstyle="

300px;

padding:

20px;

hidden;

word-wrap:

break-word;

word-break:

break:

all;

font-size:

12px;

line-height:

18px;

background-color:

#eeeeee;

fontdisabled>

��ô

�����Ұ���ȥ�˰ɣ�<

br>

�㲻��������<

42.

�����������

tablewidth="

100%"

onclick="

window.open('

'

_blank'

style="

CURSOR:

tdheight="

100"

bgcolor="

f4f4f4"

43.

����&

�رմ���

���ˣ�javascript:

history.back

(1)

�رգ�javascript:

window.close();

44.

������ֹ���,�򽫹

45.

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > PPT模板 > 节日庆典

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1