各位大拿们,小的刚从前端转为后台,目前正在做一个小的会员系统。
要求实现:注册、登录、修改个人信息、退出等功能。
目前对编程思路的思考不是很了解,本人想做到php和html文件分离。在不用smarty的情况下能在html页面调用php页面的变量。请大拿们赐教.....php编程php面相对象php与html分离
要求实现:注册、登录、修改个人信息、退出等功能。
目前对编程思路的思考不是很了解,本人想做到php和html文件分离。在不用smarty的情况下能在html页面调用php页面的变量。请大拿们赐教.....php编程php面相对象php与html分离
所以你直接用后者写好 html 后,include 进来就可以了
<?phpclass adminForm{
//私有的用户和密码
private $user;
private $pass; //登录方法
public function admin( array $arry ){
$this->user=$arry['user'];
$this->pass=$arry['pass'];
$this->verify($this->user,$this->pass);
} //用户验证方法
public function verify($v1,$v2){
$link=mysql_connect("localhost","root","123456");
mysql_select_db("vip",$link);
mysql_query("set name 'utf8'");
$sql="select * from users where username='".$v1."'";
$result=mysql_query($sql);
if(mysql_num_rows($result)<1){
return $this->alert('用户不存在');
}else{
$info=mysql_fetch_array($result,MYSQL_ASSOC);
if($info['password']!=$v2){
return $this->alert('密码错误');
}else{
session_start();
$_SESSION['user']=$v1;
return $this->goto();
}
}
mysql_close($link);
}
//跳转方法
public function goto(){
$this->alert('登录成功');
header("location: /home.php");
}
//弹出信息方法
public function alert( $str ){
header("Content-type:text/html;charset=utf-8");
echo "<script type=\"text/javascript\">alert('{$str}');</script>";
die;
}}
?>