⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 01-usingcore.sgml

📁 PHPLOB注释详细版 使用模板技术的好帮手 PHP最有用的东东了
💻 SGML
字号:
<!-- $Id: 01-usingcore.sgml,v 1.1.1.1 2000/04/17 16:39:58 kk Exp $ --><sect1>Using core features of PHPLIB<p>Many applications don't use PHPLIB's advanced features, but   see PHPLIB as a convenient way to protect pages or   functionality with passwords. This section covers such   core functionality usage of PHPLIB.<descrip><tag>Customizing the login screen</tag><p>Edit <tt/loginform.ihtml/ in the include directory to suityour needs.<tag>Customizing the permission levels</tag>Edit <tt/local.inc/ and change the class <tt/Example&lowbar;Perm/ toenumerate your permissions. Your users in <tt/auth&lowbar;user/ musthave one or more comma separated permission names from thatlist. Edit <tt/perminvalid.ihtml/ for a suitable error message.<tag>Creating New Users</tag><p>Use <tt/new&lowbar;user.php3/ from the <tt>pages/admin</tt> directory   of the distribution. If you followed the installation   instructions, it should be available under the   <tt>/admin</tt> URL of your web server.To manually create a user, run <tt/print md5(uniqid("some magicstring")/ to get a user id. <tt/insert into auth&lowbar;user values ("that userid", "username", "password", "permissions");/.<tag>Creating an unprotected session page</tag><p>Begin that page with <tscreen><code>&lt;?php page&lowbar;open(array("sess" =&gt; "Example&lowbar;Session")); ?&gt;</code></tscreen>End that page with <tscreen><code>&lt;?php page&lowbar;close(); ?&gt;</code></tscreen><tag>Creating a protected session page</tag><p>Begin that page with<tscreen><code>&lt;?php  page&lowbar;open(    array("sess" =&gt; "Example&lowbar;Session",          "auth" =&gt; "Example&lowbar;Auth",          "perm" =&gt; "Example&lowbar;Perm"));  $perm->check("desired protection");?&gt;</code></tscreen>and end that page with<tscreen><code>&lt;?php page&lowbar;close(); ?&gt;</code></tscreen><tag>Creating protected functionality</tag><p>Begin that page with<tscreen><code>&lt;?php  page&lowbar;open(    array("sess" =&gt; "Example&lowbar;Session",          "auth" =&gt; "Example&lowbar;Auth",          "perm" =&gt; "Example&lowbar;Perm"));?&gt;</code></tscreen>and end that page with<tscreen><code>&lt;?php page&lowbar;close(); ?&gt;</code></tscreen>Enclose the protected functionality in<tscreen><code>&lt;?php  if ($perm-&gt;have&lowbar;perm("desired protection")):?&gt;Put protected HTML or PHP here&lt;?php  endif?&gt;</code></tscreen><em/Note:/ <tt/desired protection/ is any combination ofpermissions from <tt/Example&lowbar;Perm/. Using the default values fromExample&lowbar;Perm, "<tt/user/", "<tt/user,author/" or "<tt/admin/" are allvalid sample values. A user can access a page, if that user hasall permissions that are being requested in a$perm-&gt;check() or $perm-&gt;have&lowbar;perm() call.<em/Note:/ Users can have multiple permission in their permscolumn of <tt/auth&lowbar;user/. A user with perms"<tt/user,author,editor/" can access all pages requesting anycombination of these permissions.<em/Note:/ Don't use spaces. "<tt/user,author,editor/" works."<tt/user, author, editor/" does not.<em/Note:/ If <tt/$auth-&gt;auth["uid"]/ is set on a protectedpage <em/and/ if <tt/(time &lt; auth-&gt;auth["exp"])/, then andonly then the authentication is valid. You may then use<tt/$auth-&gt;auth["uname"]/ as the user name,<tt/$auth-&gt;auth["uid"]/ as a unique user id and<tt/$auth-&gt;auth["perm"]/ for the current permissions of thatuser. Actually, you never want to touch<tt/$auth-&gt;auth["perm"]/ manually, but use<tt/$perm-&gt;have&lowbar;perm("...")/ for that.<tag>Getting a grip on PHPLIB</tag><p>Read on. Then read the source. Read it again -Session-&gt;serialize() and Auth-&gt;start() are ugly. Get a CVSaccount. Contribute. Become famous. Buy a ferrari.<em/Note:/ You want to understand what registered variables are.You want to understand in what order form variables and sessionvariables are imported into your page. You want to understandhow to copy values from form values into session values withoutkilling yourself. You do not want to make form variablespersistent, ever. Then you will live happily thereafter...</descrip>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -