php学习笔记(12):PHP+MYSQL留言板(下
1、提交表单Javascript验证
<form action="" method="post" name="myform" onsubmit="return CheckPost();">
SCRIPT language=javascript>
function CheckPost()
{
if (myform.user.value=="")
{
alert("请填写用户");
myform.user.focus();
return false;
}
if (myform.title.value.length<5)
{
alert("标题不能少于5个字符");
myform.title.focus();
……
}
2、str_replace替换函数
替换的值,被替换的内容);
function htmtocode($content) {
$content = str_replace("\n", "<br>", str_replace(" ", " ", $content));
return $content;
}
3、htmlspecialchars 格式化html
主要功能是将HTML格式化,防止在输出html时被浏览器执行
htmlspecialchars(所要格式化对象,定义单双引号,编码)
4、md5加密函数
md5( 加密对象 )
hearder.php:
<?php
/*
* Created on 2010-1-5
* Author :CHAUVET
* Function:被包含在其他页面的头部页面,演示include()
*/
function ReplaceSomeWords($words){
$words=str_replace("\n","<br/>",str_replace(" "," ",$words));
return $words;
}
?>
<a href="add.php" mce_href="add.php">添加页面</a>|<a href="list.php" mce_href="list.php">查看页面</a>|<a href="add.php" mce_href="add.php">登陆页面</a><br/>
<hr/>
add.php:
<html>
<head>
<title>添加页面</title>
<style type="text/css">
body{font-size:12px;text-align:center;}
#capation{font-size:24px;font-famliy:"华文新魏";}
</style>
<script type="text/javascript">
function ClearInputWords(){
document.myForm[0].value="";
document.myForm[1].value="";
document.myForm[2].value="请在此输入您的留言!";
}
function CheckInput(){
&nb
相关文档:
checkcode.php
====================
<?php
session_start();
$funcs = array('imagecreatetruecolor','imagecolorallocate','imagefill','imageline','imagedestroy','imagecolorallocatealpha','imageellipse','imagepng');
if(!function_exists('ob_gzhandler'))
ob_clean();
//crea ......
1.SET GLOBAL event_scheduler = ON;
2.show processlist;
3.创建一个表 test 主要字段 no,name,sex,age
4.对该表插如几条数据
5.创建存储过程add_age
drop procedure if exists add_age;
delimiter|
create procedure add_age()
begin
start transaction;
update eventtest set age = age +1;
&n ......
地址: http://imysql.cn/taxonomy/term/1?page=1
[InnoDB系列] -- innodb表如何更快得到count(*)结果:http://imysql.cn/2008_06_24_speedup_innodb_count
[InnoDB系列系列] -- 大数据量的导出导入方法比较:
http://imysql.cn/2007_10_15_large_innodb_table_export_import
[MySQL优化案例]系列 -- DISABLE/ENABLE K ......
一:asp.net怎么连接mysql数据库
下载mysql connection的东西
http://dev.mysql.com/downloads/connector/net/6.2.html
有3个download选第一个下载
Windows (x86, 32-bit), ZIP Archive
mysql-connector-net-6.2.2-noinstall.zip ......