本文介绍在Apache中实现用户身份验证的方法,讨论如何在MySQL数据库中保存验证信息,然后通过mod_auth_mysql模块实现身份验证。
一、概述
前文讨论了在身份验证中使用数据库的方法,具体介绍了mod_auth_db模块和DB文件的使用。这里要介绍的是如何使用非常流行的MySQL数据库保存身份验证信息,再通过mod_auth_mysql访问MySQL数据库实现身份验证。
1.1 关于MySQL
MySQL是一种优秀的数据库服务器,具有体积小速度快的特点。MySQL以GPL方式发行,它的主页在http://www.mysql.com/。MySQL缺少某些昂贵的大型数据库所提供的功能,比如存储过程、触发子等等,但它具备了大多数...
方法一: static bool IsNumeric(string str) { if (str==null || str.Length==0) return false; foreach(char c in str) { if (!Char.IsNumber(c)) { return false; } } return true; }方法二:private bool IsNumeric(string s)private bool IsNumeric(string s){char ch0 = '0';char ch9 = '9';for(int i=0; i < s.Length; i++){if ((s[i] < ch0 || s[i] > ch9)){this.lblwarning.Text="此处应输入整数且非负!";return false;}}return true;}方法三:static bool IsNumeric (string str){ System.Text.RegularExpressions.Regex reg1 = new System.Text.RegularExpressions.Regex(@"^[-]?\d+[....
实例代码说一下在JAVA中如何才能验证计算的精度,本来来探讨一下! import java.text.DecimalFormat; import java.math.BigDecimal; public class test{ public static void main(String[]argv){ double a1=1234567890.0000009; double a2=9876543210.0000006; double a3=100.00; double aa=a1*a2+a3; DecimalFormat df = new DecimalFormat("#,##0.0000000000"); System.out.println("double:"); System.out.println( df.format(a1)+"*"+df.format(a2)+"+"+df.format(a3)+"="+df.format(aa) ); BigDecimal n1 = new BigDecimal( String.valueOf(a1) ); BigDecimal n2...
* 名称:用Socket发送电子邮件 * 描述:本类实现了直接使用需要验证的SMTP服务器直接发送邮件,参考文章《用Socket发送电子邮件》作者:limodou * 此文章比较早,他是用不用验证SMTP服务器发送邮件,现在基本上SMTP服务器都需要验证了,所以这个文章里的类 意义也不是很大!同时参考了[RFC 1869]和PHP手册!!和上文还有不同的是我用的不是fsockopen()函数 具体你自己看吧!!我刚刚测试通过了,很爽!! 其实把这个类再改写一下就可以直接发送带附件的邮件了,期待。。。我过几天给大家写出来! 我刚刚调试通过,如果你不恶意去捉弄这个程序,他还是很听话的,过些日子我会对他完善加上发送附件的功能!! 即使你的虚拟主机...
<?phpsession_start();session_register("login_check_number");//昨晚看到了chianren上的验证码效果,就考虑了一下,用PHP的GD库完成了类似功能//先成生背景,再把生成的验证码放上去$img_height=120; //先定义图片的长、宽$img_width=40;if($HTTP_GET_VARS["act"]== "init"){//srand(microtime() * 100000);//PHP420后,srand不是必须的for($Tmpa=0;$Tmpa<4;$Tmpa++){$nmsg.=dechex(rand(0,15));}//by sports98$HTTP_SESSION_VARS[login_check_number] = $nmsg;//$HTTP_SESSION_VARS[login_check_number] = strval(mt_rand("1111","9...
<?phpfunction UPCAbarcode($code) {$lw = 2; $hi = 100;$Lencode = array('0001101','0011001','0010011','0111101','0100011','0110001','0101111','0111011','0110111','0001011');$Rencode = array('1110010','1100110','1101100','1000010','1011100','1001110','1010000','1000100','1001000','1110100');$ends = '101'; $center = '01010';/* UPC-A Must be 11 digits, we compute the checksum. */if ( strlen($code) != 11 ) { die("UPC-A Must be 11 digits."); }/* Compute the EAN-13 Checksum digit */$ncode = '0'.$code;$even = 0; $odd = 0;for ($x=0;$x<12;$x ) {if ($x % 2) { $odd = $n...