eshare.stust.edu.tweshare.stust.edu.tw/.../2015_6/2015_6_24ed07cf.docx  · web...

19
1. index 2.login 3.admin

Upload: phungdung

Post on 03-Feb-2018

218 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: eshare.stust.edu.tweshare.stust.edu.tw/.../2015_6/2015_6_24ed07cf.docx  · Web view$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);

1. index

2.login

3.admin

Page 2: eshare.stust.edu.tweshare.stust.edu.tw/.../2015_6/2015_6_24ed07cf.docx  · Web view$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
Page 3: eshare.stust.edu.tweshare.stust.edu.tw/.../2015_6/2015_6_24ed07cf.docx  · Web view$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);

※ admin 程式碼

<?php require_once('Connections/musicfun.php'); ?>

<?php require_once('Connections/musicfun.php'); ?>

<?php

if (!function_exists("GetSQLValueString")) {

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")

{

if (PHP_VERSION < 6) {

$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) :

mysql_escape_string($theValue);

switch ($theType) {

case "text":

$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

break;

case "long":

case "int":

$theValue = ($theValue != "") ? intval($theValue) : "NULL";

break;

case "double":

$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";

break;

case "date":

$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

break;

case "defined":

Page 4: eshare.stust.edu.tweshare.stust.edu.tw/.../2015_6/2015_6_24ed07cf.docx  · Web view$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);

$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;

break;

}

return $theValue;

}

}

if (!function_exists("GetSQLValueString")) {

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")

{

if (PHP_VERSION < 6) {

$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) :

mysql_escape_string($theValue);

switch ($theType) {

case "text":

$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

break;

case "long":

case "int":

$theValue = ($theValue != "") ? intval($theValue) : "NULL";

break;

case "double":

$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";

break;

case "date":

$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

break;

case "defined":

$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;

break;

}

return $theValue;

}

}

$currentPage = $_SERVER["PHP_SELF"];

Page 5: eshare.stust.edu.tweshare.stust.edu.tw/.../2015_6/2015_6_24ed07cf.docx  · Web view$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);

$maxRows_Recordset1 = 15;

$pageNum_Recordset1 = 0;

if (isset($_GET['pageNum_Recordset1'])) {

$pageNum_Recordset1 = $_GET['pageNum_Recordset1'];

}

$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;

mysql_select_db($database_musicfun, $musicfun);

$query_Recordset1 = "SELECT * FROM music";

$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1,

$maxRows_Recordset1);

$Recordset1 = mysql_query($query_limit_Recordset1, $musicfun) or die(mysql_error());

$row_Recordset1 = mysql_fetch_assoc($Recordset1);

if (isset($_GET['totalRows_Recordset1'])) {

$totalRows_Recordset1 = $_GET['totalRows_Recordset1'];

} else {

$all_Recordset1 = mysql_query($query_Recordset1);

$totalRows_Recordset1 = mysql_num_rows($all_Recordset1);

}

$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;

$colname_Recordset2 = "-1";

if (isset($_GET['id'])) {

$colname_Recordset2 = $_GET['id'];

}

mysql_select_db($database_musicfun, $musicfun);

$query_Recordset2 = sprintf("SELECT * FROM music WHERE id = %s",

GetSQLValueString($colname_Recordset2, "int"));

$Recordset2 = mysql_query($query_Recordset2, $musicfun) or die(mysql_error());

$row_Recordset2 = mysql_fetch_assoc($Recordset2);

$totalRows_Recordset2 = mysql_num_rows($Recordset2);

$queryString_Recordset1 = "";

if (!empty($_SERVER['QUERY_STRING'])) {

$params = explode("&", $_SERVER['QUERY_STRING']);

$newParams = array();

foreach ($params as $param) {

if (stristr($param, "pageNum_Recordset1") == false &&

Page 6: eshare.stust.edu.tweshare.stust.edu.tw/.../2015_6/2015_6_24ed07cf.docx  · Web view$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);

stristr($param, "totalRows_Recordset1") == false) {

array_push($newParams, $param);

}

}

if (count($newParams) != 0) {

$queryString_Recordset1 = "&" . htmlentities(implode("&", $newParams));

}

}

$queryString_Recordset1 = sprintf("&totalRows_Recordset1=%d%s", $totalRows_Recordset1,

$queryString_Recordset1);

?>

<!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>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>musicfun</title>

<style type="text/css">

#aaa {

height: 100%;

width: 1024px;

margin-right: auto;

margin-left: auto;

text-align: center;

background-image: url(images/login/empty.jpg);

}

.word {

font-size: 22px;

font-weight: bold;

color: #099;

}

.word3 {

font-size: 16px;

font-weight: bold;

color: #FFF;

font-family: Arial, Helvetica, sans-serif;

}

.word {

font-family: "Times New Roman", Times, serif;

font-size: 22px;

Page 7: eshare.stust.edu.tweshare.stust.edu.tw/.../2015_6/2015_6_24ed07cf.docx  · Web view$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);

color: #096;

font-weight: bold;

}

.word4 {

font-family: Arial, Helvetica, sans-serif;

font-size: 14px;

color: #FFC;

}

.word2 {

font-size: 16px;

color: #930;

}

body {

background-image: url();

background-repeat: no-repeat;

}

.run {

background-color: #FFF;

}

.worldcolor {

font-size: 18px;

font-weight: bold;

color: #393;

}

#footege {

font-family: "Arial Black", Gadget, sans-serif;

font-size: 14px;

color: #FFF;

background-image: url(images/index/index_12.jpg);

height: 28px;

width: 1024px;

font-weight: bolder;

clip: rect(auto,auto,100%,auto);

}

.top {

background-color: #930;

font-family: Arial, Helvetica, sans-serif;

font-weight: bold;

color: #FFF;

}

Page 8: eshare.stust.edu.tweshare.stust.edu.tw/.../2015_6/2015_6_24ed07cf.docx  · Web view$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);

.songcolor {

font-family: "Times New Roman", Times, serif;

font-size: 16px;

font-weight: bold;

color: #300;

}

</style>

</head>

<body>

<div id="aaa">

<table width="1024" border="0" cellpadding="0" cellspacing="0">

<tr>

<td><a name="top" id="top"></a><a href="admin.php"><img src="images/admin/index_01.png"

width="230" height="150" /></a></td>

<td><a href="news.php"><img src="images/admin/index_02.png" width="200" height="150"

/></a></td>

<td><a href="index.php"><img src="images/admin/index_03.png" width="170" height="150"

/></a></td>

<td><a href="post-1.php"><img src="images/admin/index_04.png" width="200" height="150"

/></a></td>

<td><table width="224" border="0" cellpadding="0" cellspacing="0">

<tr>

<td><img src="images/admin/index_05.png" width="70" height="40" /></td>

<td><a href="index.php"><img src="images/icon_home.png" alt="" width="28" height="30"

/></a></td>

<td><img src="images/index/index_07.png" width="50" height="40" /></td>

<td><img src="images/index/index_08.png" width="59" height="40" /></td>

</tr>

</table>

<a href="video.php"><img src="images/admin/index_09.png" width="222" height="109"

/></a></td>

</tr>

</table>

<table width="1024" border="0" class="run">

<tr>

<td width="1024" height="40" align="left" valign="middle">

<table width="800" border="0" align="center">

<tr>

<td><marquee class="worldcolor" onMouseOver="this.stop()" onMouseOut="this.start()">★★★歡迎來到 MusicFun,為你的生活帶來旋律, 讓生活更佳繽紛!!!★★★</marquee></td>

Page 9: eshare.stust.edu.tweshare.stust.edu.tw/.../2015_6/2015_6_24ed07cf.docx  · Web view$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);

</tr>

</table>

<table width="800" border="0" align="center">

</table>

</td>

</tr>

</table>

</p>

<table width="1024" border="0" cellpadding="0" cellspacing="0">

<tr>

<td width="700" height="500" align="center"><iframe width="600" height="400" src="<?php echo

$row_Recordset2['musicaddress']; ?>"frameborder="0" allowfullscreen></iframe>

<table width="600" border="0" align="center" cellpadding="0" cellspacing="0">

<tr bgcolor="#FABE50" class="word">

<td width="100" align="center" bgcolor="#FFFFCC">類型</td>

<td width="200" align="center" bgcolor="#FFFFCC">歌名</td>

<td width="150" align="center" bgcolor="#FFFFCC">歌手</td>

<td width="100" align="center" bgcolor="#FFFFCC">專輯</td> </tr>

<tr>

<td width="100" align="center" bgcolor="#FFFFCC" class="word2"><?php echo

$row_Recordset2['musictype']; ?></td>

<td width="200" align="center" bgcolor="#FFFFCC" class="word2"><?php echo

$row_Recordset2['musicname']; ?></td>

<td width="150" align="center" bgcolor="#FFFFCC" class="word2"><?php echo

$row_Recordset2['musicsinger']; ?></td>

<td width="100" align="center" bgcolor="#FFFFCC" class="word2"><?php echo

$row_Recordset2['musicCD']; ?></td>

</tr>

</table>

<table width="600" border="0" cellpadding="0" cellspacing="0">

<tr>

<td align="center" bgcolor="#FFFFCC" class="word">歌曲介紹</td> </tr>

<tr>

<td align="center" bgcolor="#FFFFCC" class="word2"><?php echo

$row_Recordset2['musiccontent']; ?></td>

</tr>

</table>

<table width="600" border="0" align="center" cellpadding="0" cellspacing="0">

Page 10: eshare.stust.edu.tweshare.stust.edu.tw/.../2015_6/2015_6_24ed07cf.docx  · Web view$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);

<tr>

<td align="center" bgcolor="#FFFFCC" class="word">歌詞</td> </tr>

<tr>

<td align="center" bgcolor="#FFFFCC" class="word2"><?php echo

$row_Recordset2['musiclyrics']; ?></td>

</tr>

</table>

<p>&nbsp;</p>

<p><a href="#top" class="top"></a></p></td>

<td width="300" valign="top">

<p><table width="300" border="0" align="center" cellpadding="0" cellspacing="0">

<tr>

<td align="right" valign="middle" bgcolor="#663300"><a href="add.php"><img

src="images/webclips_icon_20100624.jpg" width="26" height="26" /></a><span class="word3">新增歌曲</span>&nbsp;&nbsp;</td> </tr>

</table></p>

<?php do { ?>

<table width="300" border="0" align="center" cellpadding="5" cellspacing="0">

<tr>

<td width="191" align="left" bgcolor="#FF9900" class="songcolor"><a href="admin.php?

id=<?php echo $row_Recordset1['id']; ?>" class="word3"><?php echo

$row_Recordset1['musicname']; ?></a></td>

<td width="44" align="center" valign="middle" bgcolor="#FF9900" class="word2"><a

href="Edit.php?id=<?php echo $row_Recordset1['id']; ?>" class="word4">修改</a></td> <td width="35" align="center" valign="middle" bgcolor="#FF9900" class="word2"><a

href="delete.php?id=<?php echo $row_Recordset1['id']; ?>" class="word4">刪除</a></td> </tr>

</table>

<?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>

<p>&nbsp;

<table border="0" align="center">

<tr>

<td><?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?>

<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, 0,

$queryString_Recordset1); ?>"><img src="First.gif" /></a>

<?php } // Show if not first page ?></td>

<td><?php if ($pageNum_Recordset1 > 0) { // Show if not first page ?>

Page 11: eshare.stust.edu.tweshare.stust.edu.tw/.../2015_6/2015_6_24ed07cf.docx  · Web view$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);

<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage, max(0,

$pageNum_Recordset1 - 1), $queryString_Recordset1); ?>"><img src="Previous.gif" /></a>

<?php } // Show if not first page ?></td>

<td><?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?>

<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage,

min($totalPages_Recordset1, $pageNum_Recordset1 + 1), $queryString_Recordset1); ?>"><img

src="Next.gif" /></a>

<?php } // Show if not last page ?></td>

<td><?php if ($pageNum_Recordset1 < $totalPages_Recordset1) { // Show if not last page ?>

<a href="<?php printf("%s?pageNum_Recordset1=%d%s", $currentPage,

$totalPages_Recordset1, $queryString_Recordset1); ?>"><img src="Last.gif" /></a>

<?php } // Show if not last page ?></td>

</tr>

</table>

</p></td>

</tr>

</table>

<p>&nbsp;</p>

<p><a href="#top" class="top">TOP</a></p>

<div id="footege"> 期末作業&nbsp;資傳二甲&nbsp;指導老師:陳炳彰老師&nbsp;學生:傅郁玲&nbsp;

王雅蓁&nbsp;蔡昀蓁&nbsp;林慧蘭</div></div>

</body>

</html>

<?php

mysql_free_result($Recordset1);

mysql_free_result($Recordset2);

?>

4.add

Page 12: eshare.stust.edu.tweshare.stust.edu.tw/.../2015_6/2015_6_24ed07cf.docx  · Web view$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);

5.edit

6.delete(可以直接在 admin 刪除)

Page 13: eshare.stust.edu.tweshare.stust.edu.tw/.../2015_6/2015_6_24ed07cf.docx  · Web view$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);

7.news-排行榜

Page 14: eshare.stust.edu.tweshare.stust.edu.tw/.../2015_6/2015_6_24ed07cf.docx  · Web view$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);

8.news-新歌資訊

Page 15: eshare.stust.edu.tweshare.stust.edu.tw/.../2015_6/2015_6_24ed07cf.docx  · Web view$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);

9.news-KTV 精選

Page 16: eshare.stust.edu.tweshare.stust.edu.tw/.../2015_6/2015_6_24ed07cf.docx  · Web view$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);

10.post-瀏覽留言

Page 17: eshare.stust.edu.tweshare.stust.edu.tw/.../2015_6/2015_6_24ed07cf.docx  · Web view$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);

11. post-我要留言

Page 18: eshare.stust.edu.tweshare.stust.edu.tw/.../2015_6/2015_6_24ed07cf.docx  · Web view$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);

12. post-修改留言

13.video

Page 19: eshare.stust.edu.tweshare.stust.edu.tw/.../2015_6/2015_6_24ed07cf.docx  · Web view$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);