用php登录系统 [英] Login system with php

查看:59
本文介绍了用php登录系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


i必须做一个使用php / mysql的新闻系统。


i需要3个帐号:
* a''读者''谁不需要登录阅读新闻

*一个'作家'谁可以在待处理的新闻表中写新闻

* a''主持人''验证待处理的新闻,并使其成为常规新闻,

可从网站查看(由''读者'')br />

这是一个小型网站,所以我不能使用SSL;我使用php会话。


现在,我从mysql用户的角度来处理帐户,这意味着,b $ b意味着一个读者 '可以访问网站的所有管理部分,但是当尝试通过sql查询读/写时会出现
ger错误。


我想知道是否有些人可以给我一个拒绝访问

管理页面的技巧。 Rigth现在,我虽然关于这些:

*通过解码mydql权限? (如何)

*通过仅进行测试查询? (我觉得很糟糕,特别是对于写对吧)


任何想法都非常偏见,thx :)


-

TheDD

解决方案

我不知道你的意思是什么,但为什么不能'只是有一张桌子

像这样:

CREATE TABLE用户(

id int(100)NOT NULL AUTO_INCREMENT,

name varchar(200)NOT NULL default '''',

传递文本NOT NULL默认'''',

user_type varchar(1)NOT NULL默认'''',

UNIQUE(姓名),

PRIMARY KEY(id)

)TYPE = MyISAM;


然后你说一些想法喜欢:


user_type =


sql_info [user_type];

if(

Hello every body,

i have to do a news system wich use php/mysql.

i need 3 accounts:
* a ''reader'' who doesn''t need to log in to read the news
* a ''writer'' who can write news in a pending news table
* a ''moderator'' which validate a pending news, and make it a regular news,
viewable from the site (by the ''reader'')

This is a small web site, so i can''t use SSL; and i use php sessions.

Right now, i deal with account from a mysql users point of view, which
means, that a ''reader'' can access all the admin part of the site, but will
ger errors when trying to read/write by sql query.

I was wondering if somedody could give me a trick to deny access to the
admin pages. Rigth now, i though about these:
* by decoding mydql rights? (how)
* by doing only-to-test query? (bad i think, especially for write right)

any idea greatly apreciated, thx :)

--
TheDD

解决方案

I don''t excatly know what u mean but why won''t u njust have some table
like this:
CREATE TABLE Users(
id int( 100 ) NOT NULL AUTO_INCREMENT ,
name varchar(200) NOT NULL default '''',
pass text NOT NULL default '''',
user_type varchar( 1 ) NOT NULL default '''',
UNIQUE (name),
PRIMARY KEY ( id )
) TYPE=MyISAM;

and then u say somethink like:


user_type =


sql_info[user_type];
if(


这篇关于用php登录系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆