PHPSESSION应用邮件系统实例高洛峰细说PHP
首页 index.php
成都创新互联公司是一家专注于网站设计、成都网站设计与策划设计,颍东网站建设哪家好?成都创新互联公司做网站,专注于网站建设10余年,网设计领域的专业建站公司;建站业务涵盖:颍东等地区。颍东做网站价格咨询:18980820575
退出"; if($_SESSION['allow_1'] ==1 ){ echo '你有1这个权限!
'; } if($_SESSION['allow_2'] ==1 ){ echo '你有2这个权限!
'; } if($_SESSION['allow_3'] ==1 ){ echo '你有2这个权限!
'; } $query = "select id,uid,title,ptime,mbody from email where uid=?"; $stmt = $pdo->prepare($query); $stmt->execute(array($_SESSION['id'])); $data = $stmt->fetchAll(PDO::FETCH_ASSOC); echo "你有".$stmt->rowCount()."封邮件
"; echo '
'.$value['id'].' | '; echo ''.$value['title'].' | '; echo ''.$value['ptime'].' | '; echo ''.$value['mbody'].' | '; echo '
登录页面login.php
prepare($query); $stmt ->execute(array($_POST['username'],$_POST['password'])); if($stmt->rowCount()>0){ //将用户信息一次性放到session中 $_SESSION=$stmt->fetch(PDO::FETCH_ASSOC); //加登录标记 $_SESSION['islogin'] = 1; header("Location:index.php"); } } ?>PHP study 邮件登录系统
数据库连接配置文件conn.inc.php
getMessage(); exit; }
配置文件config.php
数据库设计 user表
create table user( id int(11) not null primary key auto_increment, username varchar(50) not null, password char(32) not null, email varchar(80) not null, allow_1 smallint(6) not null default 0, allow_2 smallint(6) not null default 0, allow_3 smallint(6) not null default 0 ); insert into user(username,password,email,allow_1,allow_2,allow_3) values('xiaowang1','1234','xiaowang@163.com',0,0,0); insert into user(username,password,email,allow_1,allow_2,allow_3) values('xiaowang2','1234','xiaowang@163.com',0,0,0); insert into user(username,password,email,allow_1,allow_2,allow_3) values('xiaowang3','1234','xiaowang@163.com',0,0,0); insert into user(username,password,email,allow_1,allow_2,allow_3) values('xiaowang4','1234','xiaowang@163.com',0,0,0); insert into user(username,password,email,allow_1,allow_2,allow_3) values('xiaowang5','1234','xiaowang@163.com',0,0,0); insert into user(username,password,email,allow_1,allow_2,allow_3) values('xiaowang6','1234','xiaowang@163.com',0,0,0);数据库设计 email表
create table email( id int not null auto_increment , uid int not null default 0, title varchar(80) not null default ' ', ptime int not null default 0, mbody text, primary key(id) ); insert into email(uid,title,ptime,mbody) values(1,'wo',1222333,'I am a boy'); insert into email(uid,title,ptime,mbody) values(1,'wos',1222333,'I am a boy'); insert into email(uid,title,ptime,mbody) values(1,'wo1',1222333,'I am a boy'); insert into email(uid,title,ptime,mbody) values(1,'wo2',1222333,'I am a boy'); insert into email(uid,title,ptime,mbody) values(2,'2wo',1222333,'I am a boy'); insert into email(uid,title,ptime,mbody) values(2,'2wos',1222333,'I am a boy'); insert into email(uid,title,ptime,mbody) values(2,'2wo1',1222333,'I am a boy'); insert into email(uid,title,ptime,mbody) values(2,'2wo2',1222333,'I am a boy'); insert into email(uid,title,ptime,mbody) values(3,'3wo',1222333,'I am a boy'); insert into email(uid,title,ptime,mbody) values(3,'3wos',1222333,'I am a boy'); insert into email(uid,title,ptime,mbody) values(3,'3wo1',1222333,'I am a boy'); insert into email(uid,title,ptime,mbody) values(3,'3wo2',1222333,'I am a boy');
网站名称:PHPSESSION应用邮件系统实例高洛峰细说PHP
文章URL:http://ybzwz.com/article/jsceji.html