?? global.php
字號:
<?php
function editrecord($name,$sort2id,$brief,$pic,$rm,$asf,$flash,$rmzx,$asfzx,$flashzx){
global $dbhost,$dbuser,$dbpasswd,$dbname,$down_table,$id;
if ($name=="" || $brief=="" || $pic==""):
echo "<center>\"name\", \"synopsis\" or \"picture address\" can not empty";
echo "<br><a href=javascript:history.back(1)>Click here to return</a>";
exit;
endif;
mysql_pconnect($dbhost,$dbuser,$dbpasswd);
if (!$id == ""):
$sql = "UPDATE $down_table SET name='$name',sort2id='$sort2id',brief='$brief',pic='$pic',rm='$rm',asf='$asf',flash='$flash',rmzx='$rmzx',asfzx='$asfzx',flashzx='$flashzx' WHERE id=$id";
else:
$sql = "INSERT INTO $down_table (name,sort2id,brief,pic,rm,asf,flash,rmzx,asfzx,flashzx) VALUES ('$name',$sort2id,'$brief','$pic','$rm','$asf','$flash','$rmzx','$asfzx','$flashzx')";
endif;
mysql_db_query($dbname,$sql);
} // end editrecord
function delrecord($id){
global $dbhost,$dbuser,$dbpasswd,$dbname,$down_table;
mysql_pconnect($dbhost,$dbuser,$dbpasswd);
$sql = "DELETE FROM $down_table WHERE id=$id";
mysql_db_query($dbname,$sql);
} // end delrecord
function list_pages($type,$setpage,$setid){
global $dbhost,$dbuser,$dbpasswd,$dbname,$down_table;
global $list_num,$list_page_num;
if (empty($type) || $type==0):
$type = 0;
$istype = "";
else:
$istype = "WHERE sort2id=".$type;
endif;
mysql_pconnect($dbhost,$dbuser,$dbpasswd);
$sql = "SELECT COUNT(*) AS rcnt FROM $down_table $istype ORDER BY id DESC";
$result = mysql_db_query($dbname, $sql);
$row = mysql_fetch_array($result);
$num = $row[rcnt];
if (empty($setid)):
$setid = 0;
endif;
$sql = "SELECT * FROM $down_table $istype ORDER BY id DESC LIMIT $setid, $list_num";
$result = mysql_db_query($dbname, $sql);
$pages = ceil($num/$list_num);
$page = ceil($pages/$list_page_num);
if ($setid > 0):
$setpage1 = ceil($setid/$list_num);
$setpage = ceil(($setpage1+1)/$list_page_num);
else:
$setpage = 1;
endif;
if ($pages > $list_page_num):
$pagenum = $list_page_num;
else:
$pagenum = $pages;
endif;
$issetid = ceil(($setid+1)/$list_num);
$issetpage = $issetid % $list_page_num;
if ($setpage > 1):
echo "<a title='First Page' href='list.php?type=".$type."&setpage=1&setid=0'>1</a>...\n";
endif;
if ($setpage>1):
$lastpage = $setpage-1;
$lastsetid = ($setpage-2)*$list_page_num*$list_num;
echo "<a title='previous column' href='list.php?type=".$type."&setpage=".$lastpage."&setid=".$lastsetid."'><<</a> - \n";
endif;
if ($setid > 0):
if ($issetpage == 1):
$newsetpage = $setpage-1;
else:
$newsetpage = $setpage;
endif;
$presetid = $setid-$list_num;
echo "<a title='Previous' href='list.php?type=".$type."&setpage=".$newsetpage."&setid=".$presetid."'><</a> \n";
endif;
$i1 = ($setpage-1)*$list_page_num;
for ($i=$i1; $i<($i1+$pagenum) && $i<$pages; $i++)
{
$newsetid=$list_num*$i;
if (($setid/$list_num) == $i):
echo "<b><font color=red>".($i+1)."</font></b> \n";
else:
echo "<a href='list.php?type=".$type."&setpage=".$setpage."&setid=".$newsetid."'>".($i+1)."</a> \n";
endif;
}
if ($pages!=0 && ($setid/$list_num+1)!=$pages && ($setid/$list_num+1)<=$pages||$setid==1):
if ($list_page_num-$issetpage == 0 || $issetpage == 0):
$newsetpage = $setpage+1;
else:
$newsetpage = $setpage;
endif;
$newsetid = $setid+$list_num;
echo "<a title='next page layout' href='list.php?type=".$type."&setpage=".$newsetpage."&setid=".$newsetid."'>></a> \n";
endif;
if ($pages!=0 && $pages>$list_page_num && $setpage<$page):
$nextpage = $setpage+1;
$nextsetid = $setpage*$list_page_num*$list_num;
echo "- <a title='next column' href='list.php?type=".$type."&setpage=".$nextpage."&setid=".$nextsetid."'>>></a>\n";
endif;
if ($pages>$list_page_num && $setpage<$page):
$lastpage = $list_num*($pages-1);
echo "...<a title='last page layout' href='list.php?type=".$type."&setpage=".$page."&setid=".$lastpage."'>".$pages."</a>\n";
endif;
} // end list_pages
function list_program($type,$setid){
global $dbhost,$dbuser,$dbpasswd,$dbname,$down_table,$down_sort1_table,$down_sort2_table;
global $list_num,$list_brief_num,$img_path;
if (empty($type)):
$istype = "";
else:
$istype = "WHERE sort2id=".$type;
endif;
mysql_pconnect($dbhost,$dbuser,$dbpasswd);
$sql = "SELECT COUNT(*) AS rcnt FROM $down_table $istype ORDER BY id DESC";
$result = mysql_db_query($dbname, $sql);
$row = mysql_fetch_array($result);
$num = $row[rcnt];
$num = $row[rcnt];
if ($num <= 0):
echo "<center>Did not find any records<br><br>";
endif;
if (empty($setid)):
$setid = 0;
endif;
$sql = "SELECT * FROM $down_table $istype ORDER BY id DESC LIMIT $setid, $list_num";
$result = mysql_db_query($dbname, $sql);
while ($row=mysql_fetch_array($result))
{
$sort2_sql = "SELECT * FROM $down_sort2_table WHERE id='$row[sort2id]'";
$sort2_result = mysql_db_query($dbname, $sort2_sql);
$objresult = mysql_fetch_object($sort2_result);
$type2 = $objresult->sort2;
$sort1id = $objresult->sort1id;
$sort1_sql = "SELECT * FROM $down_sort1_table WHERE id='$sort1id'";
$sort1_result = mysql_db_query($dbname, $sort1_sql);
$objresult = mysql_fetch_object($sort1_result);
$type1 = $objresult->sort1;
$brief_len = strlen($row[brief]);
if ($brief_len <= $list_brief_num):
$brief = $row[brief];
else:
$brief = substr($row[brief],"0","$list_brief_num")."...";
endif;
echo "<table bgcolor=#999999 border=1 cellpadding=3 cellspacing=0 style='border-collapse:collapse' bordercolor=#111111 width=100%>\n";
echo "<tr>\n";
echo "<td width=50% colspan=2 class=shadow1><b>".$row[name]."</b></td>\n";
echo "<td width=30% colspan=2 class=shadow2>".$type1."¦".$type2."</td>\n";
echo "<td width=20% colspan=2 align=right class=shadow3>\n";
echo "<a class=shadow2 href='./edit.php?id=".$row[id]."'>editor</a> ¦ \n";
echo "<a class=shadow2 href='./edit.php?delete=".$row[id]."'>delete</a>\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>\n";
echo "<br>\n";
} // while
} // end list_program
function adminmenu(){
global $dbhost,$dbuser,$dbpasswd,$dbname,$down_user_table,$cookie_user;
// get mygroupid
mysql_pconnect($dbhost,$dbuser,$dbpasswd);
$sql = "SELECT groupid FROM $down_user_table WHERE username='$cookie_user'";
$result = mysql_db_query($dbname, $sql);
$objresult = mysql_fetch_object($result);
$mygroupid = $objresult->groupid;
echo "<table class=border border=1 cellpadding=3 cellspacing=0 bordercolor=#111111 width=95%>\n";
echo "<tr>\n";
echo "<td bgcolor=#333333 width=100% align=center><b> control panel</b></td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class=shadow2 width=100% height=250 align=center valign=top><br>\n";
echo "<b><a class=shadow2 href='./list.php'>Film Management</a></b><br><br>\n";
echo "<a class=shadow2 href='./edit.php'>Add film</a><br><br>\n";
echo "<a class=shadow2 href='./list.php'>Film list</a><br><br>\n";
if ($mygroupid == "1"):
echo "<b><a class=shadow2 href='./sort.php'>Classify Management</a></b><br><br>\n";
else:
endif;
echo "<b><a class=shadow2 class=shadow2 href='./list.php?action=logout'>safety exit</a></b><br>\n";
echo " ﹎﹎﹎﹎﹎<br> ﹊﹊﹊﹊﹊<br>";
echo "<b><a class=shadow2 href='./list.php'>return first page</a></b><br><br>\n";
echo "</tr>\n";
echo "</table>\n";
//echo "<br>\n";
} // end adminmenu
function move($srcsort2id,$dstsort2id){
global $dbhost,$dbuser,$dbpasswd,$dbname,$down_table;
if ($srcsort2id=="" || $dstsort2id==""):
echo "<center><br><br><br><br><br>";
echo "You do not choose origin or purpose classification Category<br>";
echo "<a href=javascript:history.back(1)>Click here to return</a>";
else:
mysql_pconnect($dbhost,$dbuser,$dbpasswd);
$sql = "UPDATE $down_table SET sort2id=$dstsort2id WHERE sort2id=$srcsort2id";
mysql_db_query($dbname,$sql);
echo "<center><br><br><br><br><br>shift succeed<br>";
echo "<a href=./move.php>Click here to return</a>";
endif;
} // end move
function addsort1($downort1,$description){
global $dbhost,$dbuser,$dbpasswd,$dbname,$down_sort1_table;
if ($downort1==""):
echo "<center><br><br><br><br><br>";
echo "name can not empty<br>";
echo "<a href=javascript:history.back(1)>Click here to return</a>";
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -