Ask for advice. write the message board code for php.
Source: Internet
Author: User
Ask for advice. I have just started to learn php and write code as a message board for php, who can help me see why there are no "reply" or "delete" options on the written page ???
Session_start ();
$ Lydb = new LyDB ();
If (isset ($ _ POST ["type"]) {
If ($ _ POST ["type"] = "insert "){
If (Authority: check_insert () = true ){
$ Lydb-> insert ($ _ POST ["nickname"], "style/avatar /". $ _ POST ["avatar"], $ _ POST ["message"]);
Header ("Location: indexy. php ");
Exit ();
}
}
Else if ($ _ POST ["type"] = "login "){
If (isset ($ _ POST ["username"]) & isset ($ _ POST ["password"]) {
$ Dd = User: validate ($ _ POST ["username"], $ _ POST ["password"]);
If ($ dd = true ){
$ _ SESSION ["username"] =$ _ POST ["username"];
Header ("Location: indexy. php ");
Exit ();
}
Else {
}
}
}
Else if ($ _ POST ["type"] = "reply "){
$ Id = $ _ POST ["id"];
$ Reply = $ _ POST ["reply"];
$ Lydb-> reply ($ id, $ reply );
Header ("Location: indexy. php ");
Exit ();
}
}
Else if (isset ($ _ GET ["type"]) {
If ($ _ GET ["type"] = "delete" & isset ($ _ GET ["id"]) {
If (Authority: check_delete () = true ){
$ Lydb-> delete_by_id ($ _ GET ["id"]);
Header ("Location: indexy. php ");
Exit ();
}
}
Else if ($ _ GET ["type"] = "logout "){
Session_destroy ();
Header ("Location: indexy. php ");
Exit ();
}
}
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.