PHP + dBm logging program (2)

Source: Internet
Author: User

3. Delete member del. php3
<?
Require ("common. php3 ");
$ Id = chop ($ id );
If (! Isset ($ id) error ("Enter the user ID to delete! ");
Elseif ($ PWD <> $ adminpass) error ("the administrator password is incorrect! ");
Else {
$ DATA = dbmopen ("class", "W ");
Dbmdelete ($ data, $ id );
Dbmclose ($ data );
$ DATA = dbmopen ("password", "W ");
Dbmdelete ($ data, $ id );
Dbmclose ($ data );
Header ("Location: Index. php3 ");
}
?>

4. Public file common. php3
<?
$ Adminpass = "test ";
Function error ($ MSG ){
?>
<HTML> <LINK rel = "stylesheet" href = "style.css"> <title> upload record error </title> <HTML> <Tr> <TD width = "100%"> <Table border = "0" width = "100%" bgcolor = "#000000" cellspacing = "0" cellpadding = "0">
<Tr> <TD width = "100%"> <Table border = "0" cellspacing = "1" width = "100%" align = left Height = "320">
<Tr> <TD width = "100%" bgcolor = "# ffb500" align = Center Height = "31"> <font color = "#804000"> <span style = "font -Size: 11pt "> upload record error </span> </font> </TD>
</Tr> <TD width = "100%" align = left Height = "247" bgcolor = "# f7f7f7"> <span style = "font-size: 11pt "> <p align =" center ">
Error cause: <font color = "# ff0000"> <? Echo $ MSG;?> </Font> </P> <p align = "center"> <a href = "javascript: history. go (-1); "> <font color =" #000000 "> click here to return to the previous page to check whether your input is correct </font> </a> </P>
<P align = "center"> [<a href = "javascript: history. go (-1 ); "> back to previous page </a>] </P> </span> </TD> </tr> <TD width =" 100% "bgcolor =" # ffb500 "Height =" 30 "> <p align =" right "> <Span
Style = "font-size: 9pt "> <font color =" #804000 "> copyright 200x y10k </font> <font face =" Arial "color =" #804000 ">. allrights reserved. </font> </span> </TD>
</Tr> </table> </TD> </tr> </table> </center> </body>
<?
}
?>

5. log on to the login. php3 file.
<?
Require ("common. php3 ");
If ($ submit ){
$ Id = chop ($ id );
If ($ id = "") error ("Enter your user name! ");
Else {
$ DBm = dbmopen ("password", "R ");
If (! Dbmexists ($ dBm, $ id) error ("this user name is not available! ");
Else {
$ Pass = dbmfetch ($ dBm, $ id );
If ($ pass = $ password ){
Setcookie ("login", $ id, time () + 31536000 );
Header ("Location: Index. php3 ");
} Else error ("Your password is incorrect! If you forget your password, use the forgot password function! ");
}
Dbmclose ($ dBm );
}
} Else {
?>
<HTML>
<Head>
<Title> Shenzhen high school 2000 High School (12) Class Transcript: Copyright: Xin Miao @ Shenzhen high school 2000 (12) class </title>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">
<Style type = "text/CSS">
<! --
Body {Background: buttonface; Border: 0 ;}
# Titlebar {text-align: left;
Width: 300;
Height: 20px;
Border: 0px solid Navy; Background: Navy; color: White; font-family: verdana; font-size: 12px;
Font-weight: bold;
Padding: 3;
Padding-left: 15;
Z-index: 2 ;}
# Box {width: 300;
Border: 15px solid Navy; border-top: 0; Background: white; color: black; font-family: verdana; font-size: 12px;
Padding: 5;
Z-index: 1 ;}
Table {width: 240; margin: 10px; margin-top: 20px ;}
TD {color: black; font-family: verdana; font-size: 12px ;}
. Textinput {Background: white; color: black;
Width: 160px;
Border-top: 1px solid gray;
Border-left: 1px solid gray;
Border-Right: 1px solid # eeeeee;
Border-bottom: 1px solid # eeeeee;
}
. Button {font-family: verdana; font-size: 12px; Background: Navy; color: White; border-width: 1px ;}
. Pos {width: 100%; Height: 100%; text-align: center ;}
-->
</Style>
</Head>

<Body bgcolor = "# ffffff" scroll = "no">
<Table class = "POS">
<Tr>
<TD>
<Div id = "titlebar"> transcript of the 12th High School (12) of Shenzhen middle school </div>
<Div id = "box">
<Form action = "login. php3">
& Lt; table width = "348" & gt;
<Tr>
<TD colspan = "2"> <label for = "userindium" accesskey = "U"> <u> U </u> sername: </label>
<Input type = "text" name = "ID" class = "textinput" id = "userindium">
</TD>
</Tr>
<Tr>
<TD colspan = "2"> <label for = "pwdinp" accesskey = "p"> <u> P </u> assword: </label>
<Input type = "password" name = "password" class = "textinput" id = "pwdinp">
</TD>
</Tr>
<Tr>
<TD style = "text-align: Right">
<Div align = "Left" >>> <a href = "forgetpwd. php3"> click here if you forget your password </a> </div>
</TD>
<TD style = "text-align: Right">
<Input type = "Submit" value = "login" class = "button" name = "Submit">

<Input type = "button" value = "register" class = "button" onclick = "window. Open ('reg. php3 ')" name = "button2">
</TD>
</Tr>
</Table>
</Form>
</Div>
</TD>
</Tr>
</Table>
</Body>
</Html>
<?
}
?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.