PHP + DBM logging program (4) 8. register file reg. php3
Require ("common. php3 ");
Require ("mail. php3 ");
If ($ submit ){
If ($ id = "") error ("Enter your registered username! ");
Elseif (! Eregi ("^ [0-9a-zA_Z] + $", $ id) error ("Your username cannot contain other characters! ");
Elseif ($ password = "") error ("enter your password! ");
Elseif ($ password <> $ password1) error ("your password is incorrect! ");
Elseif ($ name = "") error ("Enter your name! ");
Elseif ($ mail = "") error ("Enter your email address! ");
Else {
$ Dbm = dbmopen ("class", "w ");
If (dbmexists ($ dbm, $ id) error ("this user name has been registered with someone else! ");
Else {
$ Intro = nl2br ($ intro );
$ Data = "$ name |! :! | $ Nickname |! :! | $ Mail |! :! | $ Home |! :! | $ Oicq |! :! | $ Icq |! :! | $ Add |! :! | $ Tel |! :! | $ Birth |! :! | $ Job |! :! | $ Intro |! :! | $ Sex ";
Dbminsert ($ dbm, $ id, $ data );
$ Pwd = dbmopen ("password", "w ");
Dbminsert ($ pwd, $ id, $ password );
}
Dbmclose ($ dbm );
$ Sendmsg = "welcome to register n ";
$ Sendmsg. = "The following is your registration information: n ";
$ Sendmsg. = "user name: $ idn user password; $ passwordn ";
$ Sendmsg. = "= "================== ";
$ Sendmsg. = "registration name: $ namen registration nickname: $ nicknamen registration Email: $ mailn homepage address: $ homen ";
$ Sendmsg. = "your OICQ: $ oicqn your ICQ: $ icqn contact address: $ addn Contact number: $ teln ";
$ Sendmsg. = "your birthday: $ birthn Your Career: $ jobn your gender; $ sexn your profile: n $ intronn ";
$ Sendmsg. = "= "==================== ";
$ Sendmsg. = "welcome to register" Shenzhen high school 2000 High School (12) class transcript ";
$ Sendmsg. = "login address: http://5212.net/class ";
Mail2 ("Welcome to register the transcript of the 2000 Shenzhen high school (12)", $ sendmsg, $ mail );
Header ("Location: index. php3 ");
}
} Else {
?>
Login user registration
}
?>
9. create the database file run. php3
$ Dbm = dbmopen ("class", "c ");
Dbmclose ($ dbm );
$ Dbm = dbmopen ("password", "c ");
Dbmclose ($ dbm );
?>