日期:2014-05-17 浏览次数:20523 次
<?php
function compile_password ($cfg)
{
//var_dump($cfg);
if (isset($cfg['password']))
{
$cfg['md5password'] = md5($cfg['password']);
}
if (empty($cfg['type']))
{
$cfg['type'] = PWD_MD5;
}
switch ($cfg['type'])
{
case PWD_MD5 :
if(!empty($cfg['ec_salt']))
{
return md5($cfg['md5password'].$cfg['ec_salt']);
}
else
{
return $cfg['md5password'];
}
case PWD_PRE_SALT :
if (empty($cfg['salt']))
{
$cfg['salt'] = '';
}
return md5($cfg['salt'] . $cfg['md5password']);
case PWD_SUF_SALT :
if (empty($cfg['salt']))
{
$cfg['salt'] = '';
}
return md5($cfg['md5password'] . $cfg['salt']);
default:
return '';
}
}
$con=mysql_connect("localhost","admin","");
if (!$con){
die('Could not connect: ' . mysql_error());
}
$command=mysql_select_db("yihaichao",$con);
mysql_query('SET NAMES gbk');
if(!$command){
exit('连接数据库失败');
}
if(!isset($_POST['submit'])){
exit('传值失败');
}
$passowrd=$_POST['password'];<