📄 del_news.php
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="comp3.css" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="description" content="This page is the homepage for Loughbourgh University Undergraduate courses in Computer Science" />
<meta name="keywords" content="computer, computer science, artificial intelligence, e-business, information, technology, management, foundation, mathematics, maths, home" />
<title>Computer Science Depatment</title>
<style type="text/css">
<!--
.style1 {font-size: xx-small}
-->
</style>
<script type = "text/javascript">
var xhr;
var url;
function del_news(request) {
if(window.XMLHttpRequest){
xhr = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
xhr = new ActiveXObject("Microsoft.XMLHTTP");
}
if (xhr != null){
url = "delNews.php";
url = url + "?q=" +request;
xhr.onreadystatechange = state_Change;
xhr.open("GET",url,true);
xhr.send(null);
}
else {
alert("Problem occur when access on XMLHttpRequest");
return;
}
}
function state_Change(){
if (xhr.readyState == 4) {
document.getElementById("news_list").innerHTML = xhr.responseText;
}
}
function verify(req) {
msg = "Are you sure that you want to DELETE the news from database?";
var r = confirm(msg);
if (r==true){
return del_news(req);
}else{
return false;
}
}
</script>
<?php
session_start();
?>
</head>
<body>
<?php
if(isset($_GET['page'])){
$page=$_GET['page'];
}else{
$page='home';
}
?>
<div id="logo"></div>
<div id="logo2"></div>
<div id="logo3"></div>
<div id="button">
<ul>
<li><a href="index3.php?page=home">Home</a></li>
<li><a href="department.php">The Department</a></li>
<li><a href="courses.php">Courses</a></li>
<li><a href='index3.php?page=money'>Financial Help</a></li>
<li><a href='index3.php?page=staff'>Staff</a></li>
<li><a href="faq.php">FAQ</a></li>
<li><a href="search.php">Search</a></li>
<li><a href='index3.php?page=contact'>Contact Us</a></li>
<li><a href="map.html">Site Map</a></li>
</ul>
</div>
<div id="content">
<div STYLE="word-wrap: break-word; overflow:visible;">
<?php
if($_SESSION['admin']=="OK")
{
echo "<ul>
<li> Module database
<ul>
<li> <a href='staff_functions.php?page=addmodule'>Add new module</a></li><br />
<li> <a href='edit_modules.php'>Edit module</a></li><br />
<li> <a href='del_modules.php'>Delete module</a></li><br />
</ul>
</li>
<li> Course database
<ul>
<li> <a href='staff_functions.php?page=addcourse'>Add new course</a></li><br />
<li> <a href='edit_courses.php'>Edit course</a></li><br />
<li> <a href='del_courses.php'>Delete course</a></li><br />
</ul>
</li>
<li> News database
<ul>
<li> <a href='staff_functions.php?page=addnews'>Add news</a></li><br />
<li> <a href='edit_news.php'>Edit news</a></li><br />
<li> <a href='del_news.php'>Delete news</a></li><br />
</ul>
</li>
<li> Comment database
<ul>
<li> <a href='comment_index.php'>View Comments</a></li><br />
</ul>
</li>
</ul>";
include("database_access.php");
$query = "SELECT * FROM news";
$result = mysql_query($query) or die("Could not execute query.");
//echo "<form name=\"module_list\" onsubmit=\"return del_modules('".$row['unique_code']."')\" method=\"get\"><table border='1'>
echo "<form name=\"news_list\" method=\"GET\"><table border='1'>
<tr>
<th>Headline</th>
<th>Story</th>
<th>Date Published</th>
<th>Picture</th>
</tr>";
while($row = mysql_fetch_array($result)){
echo "<tr>";
echo "<td>" . $row['headline'] . "</td>";
echo "<td>" . $row['story'] . "</td>";
echo "<td>" . $row['date_published'] . "</td>";
echo "<td>" . $row['picture']."</td>";
echo "<td><button name=\"".$row['id']."\" onclick=\"return verify('".$row['id']."')\">Delete</button></td>";
//echo "<td><input type = \"submit\" name=\"".$row['unique_code']."\" value=\"Delete this module\"></td>";
echo "</tr>";
}
echo "</table></form>";
}
else{
echo "<p>You do not have permission to view this page</p>";
}
?>
<table width="100%" border="0">
<tr>
<td colspan="2" bgcolor="#CCCCCC"> </td>
</tr>
<tr>
<td width="53%" bgcolor="#FFFFFF"><div align="center" class="style3">
<div align="left"> © Loughborough University 2008</div>
</div></td>
<td width="47%" bgcolor="#FFFFFF"><div align="center"><span class="style3"><a href = "admin_login.htm">Staff</a></span></div></td>
</tr>
</table>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -