本篇实现发表博客。
八、发表博客(1)、界面实现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%" cellpadding="0" cellspacing="0"> <tr> <td height="451" align="center" valign="top"> <!-- 发表文章 --> <table width="640" cellpadding="0" cellspacing="0"> <tr> <td width="613" height="223" align="center"> <br><span style="white-space:pre"> </span><table width="500" border="0" cellpadding="0" cellspacing="0"> <tr> <td> <span style="white-space:pre"> </span> <form method="post" action="check_file.php?flag=<?php%20echo%20%24flag;%20if(%24flag)%7Becho%20">"><span style="white-space:pre"> </span> <table width="630" border="1" cellpadding="3" cellspacing="1" bordercolor="#D6E7A5"> <tr> <td class="i_table" colspan="2"> <span class="tableBorder_LTR">添加博客文章</span> </td> </tr> <tr> <td valign="top" align="right" width="14%">博客主题:<br> </td> <td width="86%"><input name="txt_title" type="text" id="txt_title" size="68" value="<?php if($flag){echo $title;}?>"></td> </tr> <tr> <td align="right" width="14%">文字编辑区:</td> <td width="86%"> <img src="images/UBB/B.gif" style="max-width:90%" style="max-width:90%" onclick="bold()" alt="PHP经典项目案例-(一)博客管理系统5" > <img src="images/UBB/I.gif" style="max-width:90%" style="max-width:90%" onclick="italicize()" alt="PHP经典项目案例-(一)博客管理系统5" > <img src="images/UBB/U.gif" style="max-width:90%" style="max-width:90%" onclick="underline()" alt="PHP经典项目案例-(一)博客管理系统5" ><span style="white-space:pre"> </span> 字体 <select name="font" class="wenbenkuang" id="font" onchange="showfont(this.options[this.selectedIndex].value)"> <option value="宋体" selected>宋体</option> <option value="黑体">黑体</option> <option value="隶书">隶书</option> <option value="楷体">楷体</option> </select> 字号<span class="pt9"> <select name="size" class="wenbenkuang" onchange="showsize(this.options[this.selectedIndex].value)"> <option value="1">1</option> <option value="2">2</option> <option value="3" selected>3</option> <option value="4">4</option> <option value="5">5</option> <option value="6">6</option> <option value="7">7</option> </select> 颜色 <select onchange="showcolor(this.options[this.selectedIndex].value)" name="color" size="1" class="wenbenkuang" id="select"> <option selected>默认颜色</option> <option style="color:#FF0000" value="#FF0000">红色热情</option> <option style="color:#0000FF" value="#0000ff">蓝色开朗</option> <option style="color:#ff00ff" value="#ff00ff">桃色浪漫</option> <option style="color:#009900" value="#009900">绿色青春</option> <option style="color:#009999" value="#009999">青色清爽</option> <option style="color:#990099" value="#990099">紫色拘谨</option> <option style="color:#990000" value="#990000">暗夜兴奋</option> <option style="color:#000099" value="#000099">深蓝忧郁</option> <option style="color:#999900" value="#999900">卡其制服</option> <option style="color:#ff9900" value="#ff9900">镏金岁月</option> <option style="color:#0099ff" value="#0099ff">湖波荡漾</option> <option style="color:#9900ff" value="#9900ff">发亮蓝紫</option> <option style="color:#ff0099" value="#ff0099">爱的暗示</option> <option style="color:#006600" value="#006600">墨绿深沉</option> <option style="color:#999999" value="#999999">烟雨蒙蒙</option> </select></span> </td> </tr> <tr> <td align="right" width="14%">文章内容:</td> <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="75" rows="20" 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="提交" onclick="return check();"> <input name="btn_cx" type="reset" id="btn_cx" value="重写"> </td> </tr> </table> <span style="white-space:pre"> </span> </form> <span style="white-space:pre"> </span> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </td> </tr>
(2)后台添加到数据库实现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('操作成功!');</script>"; echo "<script>window.location.href='myfiles.php';</script>"; }else{ echo "<script>alert('对不起失败了!');</script>"; echo "<script> history.go(-1);</script>"; }?>

Laravel simplifies handling temporary session data using its intuitive flash methods. This is perfect for displaying brief messages, alerts, or notifications within your application. Data persists only for the subsequent request by default: $request-

The PHP Client URL (cURL) extension is a powerful tool for developers, enabling seamless interaction with remote servers and REST APIs. By leveraging libcurl, a well-respected multi-protocol file transfer library, PHP cURL facilitates efficient execution of various network protocols, including HTTP, HTTPS, and FTP. This extension offers granular control over HTTP requests, supports multiple concurrent operations, and provides built-in security features.

Laravel provides concise HTTP response simulation syntax, simplifying HTTP interaction testing. This approach significantly reduces code redundancy while making your test simulation more intuitive. The basic implementation provides a variety of response type shortcuts: use Illuminate\Support\Facades\Http; Http::fake([ 'google.com' => 'Hello World', 'github.com' => ['foo' => 'bar'], 'forge.laravel.com' =>

Do you want to provide real-time, instant solutions to your customers' most pressing problems? Live chat lets you have real-time conversations with customers and resolve their problems instantly. It allows you to provide faster service to your custom

Article discusses late static binding (LSB) in PHP, introduced in PHP 5.3, allowing runtime resolution of static method calls for more flexible inheritance.Main issue: LSB vs. traditional polymorphism; LSB's practical applications and potential perfo

PHP logging is essential for monitoring and debugging web applications, as well as capturing critical events, errors, and runtime behavior. It provides valuable insights into system performance, helps identify issues, and supports faster troubleshoot

Laravel's service container and service providers are fundamental to its architecture. This article explores service containers, details service provider creation, registration, and demonstrates practical usage with examples. We'll begin with an ove

The article discusses adding custom functionality to frameworks, focusing on understanding architecture, identifying extension points, and best practices for integration and debugging.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Dreamweaver Mac version
Visual web development tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

SublimeText3 Chinese version
Chinese version, very easy to use

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),
