时间:2021-07-01 10:21:17 帮助过:14人阅读
dhparams //文件夹 pecl //文件夹 bigint.php compat.php phprpc_date.php dhparams.php phprpc_server.php phprpc_client.php xxtea.php
bigint.php compat.php phprpc_date.php xxtea.php
dhparams dhparams.php phprpc_server.php bigint.php compat.php phprpc_date.php xxtea.php
phprpc_client.php bigint.php compat.php phprpc_date.php xxtea.php
include ('phprpc_server.php');
function islogin($u,$p){
$con = mysql_connect('localhost','root','123') or die('数据库连接失败');
mysql_select_db('newspublish');
mysql_query('SET NAMES utf8');
$p = md5($p);
$sql = "select * from t_user where `username`= '$u' and `password` ='$p'";
//file_put_contents('log.txt',$sql);
$result = mysql_query($sql);
$n = mysql_num_rows($result);
if ($n > 0){
return true;
}
else{
return false;
}
}
function login($u,$p){
if(islogin($u,$p)){
return true;
}
else{
return false;
}
}
//上面的代码,我就不多说了,懂php的,那些都是基础
$server = new PHPRPC_Server();
$server->add('login');//添加允许远程访问的方法
$server->setDebugMode(true);
//开启调试模式,但这个我不知道怎么用,研究出来的话,会更新的
$server->start();//开始
login('lxx','test')){
echo "Login Success!";
}
else{
echo "Login Wrong!";
}
?>