The implementation of this blog post.
Viii. published blog (1), interface implementation file.php
<tr> <TD colspan=3 valign= "Baseline" style= "Background-image:url (images/bg.jpg); Vertical-align:middle; height:450px; Text-align:center "> <table width=" 100% "height=" 100% " border=" 0 "cellpadding=" 0 "cellspacing = "0" > <tr> <TD height= "451" align= "center" valign= "Top" > & nbsp <!--post--> <table width= "640" border= "0" cellpadding= "0" cellsp acing= "0" > <tr> <TD width= "613" height= "22 3 "align=" center "><br><span style=" White-space:pre "></span><table width=" $ "border=" 0 " cellpadding= "0" cellspacing= "0" > <tr> <td><span style= "White-space:pre" ></span> <form name= "MyForm" method= "POST" ActioN= "check_file.php?flag=<?php Echo $flag; if ($flag) {echo "&id=". $_get[' file_id ');}? > "><span style=" White-space:pre "></span> <table width=" 630 "border=" 1 "cellpadding = "3" cellspacing= "1" bordercolor= "#D6E7A5" > <tr> &N Bsp <TD class= "i_table" colspan= "2" > <span class= "tableborder_ltr" > Add blog post </span ></td> </tr> <TR>&N Bsp <TD valign= "top" align= "right" width= "14%" > Blog theme: <br></td > <TD width= "86%" ><input name= "Txt_title" type= "text" I D= "Txt_title" size= "value=" <?php if ($flag) {echo $title;}? > ></td> </tr> <tr> <TD align= "right" width= "14%" > Text editing area: </td>& nbsp <TD width= "86%" > &N Bsp <span style= "White-space:pre" ></span> & nbsp fonts <select name= "Font" class= "Wenbenk Uang "id=" Font "onchange=" Showfont (this.options[this.selectedindex].value) "> <option value= "Arial" selected> the body </option> <option value= "blackbody" > Blackbody </option> &NB Sp <option value= "Official script" > script </option> &NB Sp <option value= "italics" > italics </option> &NB Sp </select> &N Bsp <span class= "Pt9" >  ; <select name=size class= "Wenbenkuang" onchange= "showsize (this.options[this.selectedindex].value) "> &NBSP; <option value=1>1</option> & nbsp <option value=2>2</option> & nbsp <option value=3 selected>3</option> &NBSP ; <option value=4>4</option> & nbsp <option value= "5" >5</option> &NBSP ; <option value= "6" >6</option> &NBSP ; <option value= "7" >7</option> &NBSP ; </select> &NBsp color & nbsp <select onchange= "Showcolor (this.options[this.selectedindex].value)" Name= " Color "size=" 1 "class=" Wenbenkuang "id=" select "> nbsp <option selected> default colors </option> &NB Sp <option style= "color: #FF0000" value= "#FF0000" > Red Passion </option> <option style= "color: #0000FF" value= "#0000ff" > Blue Bright </option> <option s tyle= "COLOR: #ff00ff" value= "#ff00ff" > Peach romance </option> <option style= "color: #009900" value= "#009900" > Green Youth </option> <option style= "color: #009999" value= "#009999" > Cyan refreshing </ option> <option style= "Col Or: #990099 "value=" #990099 "> Purple formal </option> and nbsp <option style= "color: #990000" value= "#990000" > Night excitement </option> <option style= "color: #000099" value= "#000099" > Blue Blues &L t;/option> <option style= " Color: #999900 "value=" #999900 "> Khaki uniform </option> & nbsp <option style= "ColOr: #ff9900 "value=" #ff9900 "> Gold-filled years </option> and nbsp <option style= "color: #0099ff" value= "#0099ff" > Lake Ripples </option> <option style= "color: #9900ff" value= "#9900ff" > Shiny Blue Violet &L t;/option> <option style= " Color: #ff0099 "value=" #ff0099 "> Love hint </option> & nbsp <option style= "color: #006600" value= "#006600" > Dark green deep </option> <option style= "color: #999999" value= "#999999" > Misty Rain </option> </select></span>& nbsp </td> </tr> &L t;tr> <TD align= "right" width= "14%" > article content: </td>& nbsp <TD width= "86%" ><span style= "White-space:pre" ></span > <div class= "file" ><span style= "White-space:pre" ></span> <span style= " White-space:pre "></span><textarea name=" file "cols=" page "rows=" "id=" File "style=" Border:0px;width : 520px; " ><?php if ($flag) {echo $content;}? ></textarea><span style= "White-space:pre" ></span> </div> <span Style= "White-space:pre" ></span> </td> </tr> <TR align= "center" > <TD colspan="2" ><input name= "BTN_TJ" type= "Submit" id= "BTN_TJ" value= "Submit" onclick= "return check ();" > &NB Sp <input name= "BTN_CX" type= "reset" id= "btn_cx" value= "rewrite" > &nb Sp </td> </tr> &N Bsp </table><span style= "White-space:pre" ></span></form><span style= " White-space:pre ></span></td> </tr> & nbsp </table> </td> </TR>&N Bsp </table> </td> </tr> </table> </td> </tr>
When editing an article, each option uses the JS implementation: Ubbcode.js
Helpstat = False;basic = False;function AddText (newcode) {document.all ("file"). Value+=newcode}function showsize (size) {if (helpstat) {alert ("Text size tag \ n" Sets the text size. \ n Variable range 1-6.\n 1 is minimum 6 for maximum. \ n Usage: <size= "+size+" > This is "+size+" text </size> ") ;} else if (Basic) {addtxt= "<font size=" +size+ "></font>"; AddText (addtxt);} else {txt=prompt ("size" +size, "text"), if (txt!=null) {addtxt= "<font size=" +size+ ">" +txt; AddText (Addtxt); addtxt= "</font>"; AddText (addtxt);} }}function Bold () {if (Helpstat) {alert ("bold mark \ n makes text bold. \ n Usage: <b> This is bold text </b>");} else if (Basic) {addtxt= "< B></b> "; AddText (addtxt);} else {txt=prompt ("The text will be thicker.", "Please enter the text to be bold here!") "); if (txt!=null) {addtxt= "<b>" +txt; AddText (Addtxt); addtxt= "</b>"; AddText (addtxt);} }}function italicize () {if (Helpstat) {alert ("italic" Mark \ n makes the text font italic. \ n Usage: <i> This is italic </i> ");} else if (Basic) { addtxt= "<i></i>"; AddText (addtxt);} else { Txt=prompt ("Text will be italic", "Please enter the text you want to tilt here!") "); if (txt!=null) {addtxt= "<i>" +txt; AddText (Addtxt); addtxt= "</i>"; AddText (addtxt);} }}function Showcolor (color) {if (Helpstat) {alert ("colour tag \ n" Sets the text color.) Any color names can be used. \ n usage: <color= "+color+" > Color to be changed to "+color+" text </color> ");} else if (Basic) {addtxt= "<font color=" +color+ "></font>"; AddText (addtxt);} else {txt=prompt ("The Color chosen is:" +color, "Enter the text you want to change the color here! "), if (txt!=null) {addtxt=" <font color= "+color+" > "+txt; AddText (Addtxt); addtxt= "</font>"; AddText (addtxt);} }}function Showfont (font) {if (Helpstat) {alert ("Font tag \ n" Sets the font for text. \ n Usage: <font= "+font+" > Change text font to "+font+" </font > ");} else if (Basic) {addtxt= "<font face=" +font+ "></font>"; AddText (addtxt);} else {txt=prompt ("text to set font" +font, "Enter the text you want to change the font here! "), if (txt!=null) {addtxt=" <font face= "+font+" > "+txt; AddText (Addtxt); addtxt= "</font>"; AddText (addtxt);} }}function Underline() {if (Helpstat) {alert ("underline" to underline text. \ n Usage: <u> to underline text </u> ");} else if (Basic) {addtxt=" <u></ U> "; AddText (addtxt);} else {txt=prompt ("underlined text.", "text"); if (txt!=null) {addtxt= "<u>" +txt; AddText (Addtxt); addtxt= "</u>"; AddText (addtxt);} }}
(2) Add background to database implementation check_file.php
<?php session_start (); Require_once ' conn/sqlhelper.class.php '; $flag = $_get[' flag ']; if ($flag!=2) { $txt _title = $_post[' Txt_title ']; $file = $_post[' file ']; $author = $_session[' username '); $date = Date ("y-m-d h:i:s"); } $sqlHelper = new SqlHelper (); if ($flag ==0) { $sql = "INSERT into tb_article (Title,content,author,now) VALUES (' $txt _title ', ' $file ', ' $author ', ' $date ') "; } $res = $sqlHelper->execute_dml ($sql); if ($res ==1) { echo "<script>alert (' Operation succeeded! ');</script> "; echo "<script>window.location.href= ' myfiles.php ';</script>"; } else{ echo "<script>alert (' Sorry for failure! ');</script> "; echo "<script> history.go ( -1);</script>"; }? >
PHP Classic Project Case-(a) blog management system 5