⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 edit_news.php

📁 自制国外大学学校计算机学院网站
💻 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 edit_the_news(request) {
	if(window.XMLHttpRequest){
		xhr = new XMLHttpRequest();
	}
	else if (window.ActiveXObject) {
		xhr = new ActiveXObject("Microsoft.XMLHTTP");
	}
	if (xhr != null){
		url = "editNews.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_detail").innerHTML = xhr.responseText;		
	}
}

//////////////////////////////////////////////////////////////////////////////////////////////
var xhr2; 
var url2;
function save_edit(requests) {
	if(window.XMLHttpRequest){
		xhr2 = new XMLHttpRequest();
	}
	else if (window.ActiveXObject) {
		xhr2 = new ActiveXObject("Microsoft.XMLHTTP");
	}
	if (xhr2 != null){
		url2 = "saveNewsEdit.php";
		url2 = url2 +"?"+requests;	
		xhr2.onreadystatechange = state_Changes;
		xhr2.open("GET",url2,true);
		xhr2.send(null);
		
	}
	else { 
		alert("Problem occur when access on XMLHttpRequest");
		return;
	}
}
	
function state_Changes(){
	if (xhr2.readyState == 4) {
		document.getElementById("news_details").innerHTML = xhr2.responseText;		
	}
}

function verify(req) {
	msg = "Are you sure that you want to SAVE the changes to database?";
	var r = confirm(msg);
	if (r==true){
		return save_edit(req);
	}else{
		return false;
	}
	return false;
}

function requested_info(num) {
    var requested = "headline="+document.getElementById("headline"+num).value
	+"&story="+document.getElementById("story"+num).value
	+"&date_published="+document.getElementById("date_published"+num).value
	+"&id="+document.getElementById("id"+num).value
	+"&picture="+document.getElementById("picture"+num).value;
	return verify(requested);
 }
 
</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.");
	$num_rows=mysql_num_rows($result);
	echo "<form method=\"GET\">";
	echo "<select onchange=\"edit_the_news(this.options[this.selectedIndex].value)\"><br />";
	echo "<option> Select the news </option>";
	for($i=0;$i<$num_rows;$i++){
		$row=mysql_fetch_array($result);
		$headline[]=$row['headline'];
		echo "<option value=\"".$headline[$i]."\">".$headline[$i]."</option><br />";
	}
	echo "</select></form>";
}else{
 echo "<p>You do not have permission to view this page</p>";
 }
?>

<p>
<div id="news_detail"></div>
<br />
<div id="news_details"></div>
</p>

<table width="100%" border="0">
  <tr>
    <td colspan="2" bgcolor="#CCCCCC">&nbsp;</td>
  </tr>
  <tr>
    <td width="53%" bgcolor="#FFFFFF"><div align="center" class="style3">
      <div align="left"> &copy; 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 + -