Hướng dẫn làm web bán hàng bằng php từ a-z-phần 14
Hướng dẫn làm web bán hàng bằng php từ a-z-phần 14
29. include_file(” cumchucnang/ quanly_menu_doc/ them_menu.php”);
[sourcecode language=”plain”]<a href="?thamso=them_leftmenu" class="lienket_phanthan">Menu dọc</a><br />
<a href="?thamso=them_menu_ngang" class="lienket_phanthan">Menu ngang</a><br />
<!–<a href="?thamso=them_menu_help" class="lienket_phanthan">Menu help</a><br />–></pre>
<pre>[/sourcecode]
30. include_file(” cumchucnang/ quanly_menu_doc/ them_leftmenu.php”);
[sourcecode language=”plain”]<?php
chong_pha_hoai();
//echo "vao day <hr>";
?>
<?php
function dequy_option__mnn($id,$nhandang)
{
$nhandang=" ".$nhandang;
$a=mysql_query("select * from menu where thuoc_menu in(‘$id’) order by id");
while($b=mysql_fetch_array($a))
{
echo"<option value=\"$b[id]\">$nhandang $b[ten]</option>";
dequy_option__mnn($b[‘id’],$nhandang);
}
}
?>
<table id="er" width="970px" style="margin:6px 0px"><tr><td>Thêm menu</td></tr><tr><td>
<form action="" method="post">
<table border="0" id="er_1" width="600px" style="margin:6px">
<tr>
<td width="100px"><b>Cấp độ : </b></td>
<td>
<select name="chon_menu" id="hop_chon_5" >
<option value="">Cấp đầu</option>
<?php
$cap1_lan1_chuoi="select * from menu where thuoc_menu in(”) and vi_tri_menu!=’ngang’ order by id";
$cap1_lan1_truyvan=mysql_query($cap1_lan1_chuoi);
while($mang_cap1_lan1_dulieu=mysql_fetch_array($cap1_lan1_truyvan))
{
print ‘<option value="’.$mang_cap1_lan1_dulieu[‘id’].’">’.$mang_cap1_lan1_dulieu[‘ten’].'</option>’;
dequy_option__mnn($mang_cap1_lan1_dulieu[‘id’],"");
}
?>
</select>
</td>
</tr>
<tr>
<td><b>Tên :</b></td>
<td><input type="text" name="txttd" size="50"/></td>
</tr>
<!– <tr>
<td><b>Dạng :</b></td>
<td>
<?php
/*switch($_SESSION[‘dang’])
{
case "link":
$a_1="";$a_2=’selected="selected"’;
$b="block";
break;
default:
$a_2="";$a_1=’selected="selected"’;
$b="none";
}*/
?>
<select name="dang" onclick="hg(this.value)">
<option value="" <?php //echo $a_1;?> >Sản phẩm</option>
<option value="link" <?php //echo $a_2;?> >Link</option>
</select>
<div id="link_kkk" style="display:<?php //echo $b; ?>">
Link : <input name="link" size="40" id="link_kkk" />
</div>
<script>
function hg(v)
{
var id=document.getElementById("link_kkk");
if(v==""){id.style.display="none";}
if(v=="link"){id.style.display="block";}
}
</script>
</td>
</tr>–>
<tr>
<td><b>Keywords :</b></td>
<td><input type="text" name="keywords" size="50"/></td>
</tr>
<tr>
<td><b>Description :</b></td>
<td><input type="text" name="description" size="50"/></td>
</tr>
<tr>
<td><b>Url đẹp : </b></td>
<td><input type="text" name="url_dep" size="50" value="" /></td>
</tr>
</tr>
<tr>
<td> </td>
<td >
<input type="submit" name="them_left_menu" class="nut_chapnhan" value="Thêm Menu" />
</td>
</tr>
</table>
</form>
</td></tr></table>
<script type="text/javascript">
table_css_1("er");
table_css("er_1");
var ss_cap_do="<?php echo $_SESSION[‘chon_menu’]; ?>";
var hop_chon_5=document.getElementById("hop_chon_5");
var option_55=hop_chon_5.getElementsByTagName("option");
//alert(option_55[0].value);
//alert(ss_cap_do);
for(i=0;i<option_55.length;i++)
{
if(option_55[i].value==ss_cap_do)
{
option_55[i].selected=true;
//alert("selected");
}
}
</script></pre>
<pre>[/sourcecode]
31. include_file(” cumchucnang/ quanly_menu_ngang/ them_menu_ngang.php”);
[sourcecode language=”plain”]<?php
chong_pha_hoai();
?>
<br>
<style type="text/css">
a.a_vvv { font-size: 14px; text-decoration: none; color: #0b55c4; }
a.a_vvv:visited { font-size: 14px; color: #0b55c4; text-decoration: none; }
a.a_vvv:hover { font-size: 14px; text-decoration: none; color: #084095; font-style: normal; }
</style>
<?php
if($_POST[‘form_trang’]==’form_trang’)
{
//thongbao("vao day");
for($i=1;$i<=15;$i++)
{
$name_1="sx_".$i;
$name_2="id_".$i;
$sx=$_POST[$name_1];
$id=$_POST[$name_2];
$up="UPDATE `menu` SET `sap_xep` = ‘$sx’ WHERE `id` =’$id’;";
mysql_query($up);
}
trang_truoc();
exit();
}
?>
<?php
function khoangcach($cap_csdl)
{
include("cumchucnang/bien/bien.php");
$sql = "select count(*) from menu where id in (‘$cap_csdl’)";
$query = mysql_query($sql);
$rows = mysql_fetch_row($query);
if($rows[0] != 0)
{
$sql = "select * from menu where id in (‘$cap_csdl’)";
$query = mysql_query($sql);
$rows = mysql_fetch_array($query);
echo " ";
//echo $rows[‘thuoc_menu’]."<hr>";
khoangcach($rows[‘thuoc_menu’]);
}
}
function lay_chuoi_menu_con($chuoi_menu,$id_cha)
{
include("cumchucnang/bien/bien.php");
$sql = "select * from menu where $tb__menu_ngang__f__thuoc_menu=’$id_cha’ order by sap_xep ";
$query = mysql_query($sql);
while($rows = mysql_fetch_array($query))
{
$chuoi_menu = $chuoi_menu." ( select * from menu where $tb__menu_ngang__f__id = ‘$rows[id]’) union";
$chuoi_menu = lay_chuoi_menu_con($chuoi_menu,$rows[‘id’]);
}
return $chuoi_menu;
}
function lay_chuoi_menu($chuoi_menu)
{
include("cumchucnang/bien/bien.php");
$sql = "select * from menu where thuoc_menu=” and vi_tri_menu=’ngang’ order by sap_xep ";
//echo $sql."<hr>";
$query = mysql_query($sql);
while($rows = mysql_fetch_array($query))
{
$chuoi_menu = $chuoi_menu." ( select * from menu where id = ‘$rows[id]’) union";
$chuoi_menu = lay_chuoi_menu_con($chuoi_menu,$rows[‘id’]);
}
$chuoi_menu = substr($chuoi_menu,0,-6);
return $chuoi_menu;
}
$chuoi_menu="";
///ky thuat phan trang
$sd = 15;
if($_GET[‘page’] == "")
{
$vtbd = 0;
}
else
{
$vtbd = ($_GET[‘page’]-1)*$sd;
}
$sql_tsd = "select count(*) from menu where vi_tri_menu=’ngang’ ";
$tsd1 = mysql_query($sql_tsd);
$tsd = mysql_fetch_row($tsd1);
$st = ceil($tsd[0]/$sd);
//echo "$st <br />";
$menu=lay_chuoi_menu($chuoi_menu);
$menu = $menu." limit $vtbd,$sd";
//echo $menu."<hr />";
$query = mysql_query($menu);
if($_GET[‘page’] == "" or $_GET[‘page’] == 1)
{
$stt = 1;
}
else
{
$stt=$vtbd + 1;
}
$r=1;
echo "<form action=” method=’post’ style=’margin:0′>";
echo "<table width=’720px’ id=’er’ style=’margin:6px 0px’>";
echo "<tr>";
echo "<td width=\"50px\" align=\"center\">STT</td>";
echo "<td width=\"350px\">Tiêu Đề</td>";
//echo "<td width=\"350px\">Tiêu Đề (English)</td>";
echo "<td width=\"100px\" align=\"center\">Sắp xếp</td>";
echo "<td width=\"100px\" align=\"center\">Sửa</td>";
echo "<td width=\"100px\" align=\"center\">Xóa</td>";
echo "</tr>";
while($rows = mysql_fetch_array($query))
{
$ten_menu=$rows[‘ten’];
$ten_menu_1=$rows[‘ten_en’];
$thuoc_menu=$rows[‘thuoc_menu’];
$sap_xep=$rows[‘sap_xep’];
$id_menu=$rows[‘id’];
$link_sua="?thamso=xoa_sua_menungang_chitiet&id_menu=$id_menu&page=$_GET[page]";
$link_xoa="?thamso=xoa_sua_menungang&xoa_menu_ngang=xoa&id_menu=$id_menu";
$name_1="sx_".$r;
$name_2="id_".$r;
echo "<tr class=\"mau_dong\">";
echo "<td align=\"center\">$stt</td>";
echo "<td nowrap=\"nowrap\">";
khoangcach($thuoc_menu);
echo "<a href=\"$link_sua\" class=\"a_vvv\">$ten_menu</a>";
echo "</td>";
//echo "<td nowrap=\"nowrap\">";
//khoangcach($thuoc_menu);
//echo "<a href=\"$link_sua\" class=\"a_vvv\">$ten_menu_1</a>";
//echo "</td>";
echo "<td align=\"center\">
<input size=’5′ style=’margin:3px’ value=’$sap_xep’ name=’$name_1′ >
<input type=’hidden’ value=’$id_menu’ name=’$name_2′ >
</td>";
echo "<td align=\"center\"><a href=\"$link_sua\" class=\"sua_xoa\" >Sửa</a></td>";
echo "<td align=\"center\"><a href=\"$link_xoa\" class=\"sua_xoa\" >Xóa</a></td>";
echo "</tr>";
$stt++;
$r++;
}
echo "<tr>";
echo "<td width=\"50px\" align=\"center\" colspan=’2′ > </td>";
echo "<td width=\"50px\" align=\"center\" >
<input type=’hidden’ name=’form_trang’ value=’form_trang’ >
<input type=’submit’ value=’Thay đổi’ style=’margin:3px’ >
</td>";
echo "<td width=\"50px\" align=\"center\" colspan=’2′ > </td>";
echo "</tr>";
echo "</table>";
echo "</form>";
for($i=1; $i<=$st; $i++)
{
$link ="?thamso=xoa_sua_menungang&page=$i";
echo "<a href=\"$link\" class=\"phantrang\"> $i </a>";
}
?>
<script type="text/javascript">
table_css_2("er");
</script>
<br>
<br></pre>
<pre>[/sourcecode]
32. include_file(” cumchucnang/ quanly_menu_ngang/ xoa_sua_menu_ngang.php”);
[sourcecode language=”plain”]<?php
chong_pha_hoai();
?>
<?php
if(trim($_POST[‘form_hd_555’])=="form_hd_555")
{
if($_POST[‘tenmenu’] != "")
{
$update = "UPDATE `menu` SET `ten` = ‘$_POST[tenmenu]’
,`ten_en` = ‘$_POST[tenmenu_en]’,`link`=’$_POST[link]’,`loai`=’$_POST[lmn]’,`url_dep`=’$_POST[url_dep]’
WHERE `id` =’$_GET[id_menu]’" ;
mysql_query($update);
}
else
{
thongbao("Không được bỏ trống tên menu !");
}
trangtruoc();
exit();
}
?>
<?php
$id_menu_sua = $_GET[‘id_menu’];
$sql = "select * from menu where id = ‘$id_menu_sua’";
$query = mysql_query($sql);
$row = mysql_fetch_array($query);
$ten_menu=$row[‘ten’];
$ten_menu_1=$row[‘ten_en’];
$link=$row[‘link’];
//echo $link."<hr>";
$url_dep=$row[‘url_dep’];
if($row[‘loai’]=="san_pham"){$a_f="selected";}
?>
<form action="" method="post" style="margin:0">
<table width="970px" border="0" id="ir" style="margin:6px 0px">
<tr>
<td colspan="2">
<span style="float:left">Sữa menu ngang</span>
<a href="?thamso=xoa_sua_menungang&page=<?php echo $_GET[‘page’] ?>" style="text-decoration: none;color:#0b55c4;float:right;margin-right:5px;">
Đóng
</a>
</td>
</tr>
<tr>
<td><b>Loại menu : </b></td>
<td>
<!–<span style="color:blue;font-size:14px;cursor:pointer" onclick="document.getElementById(‘hhh’).style.display=’block’;">Thay đổi</span>–>
<div id="hhh" style="">
<?php
if($link=="?thamso=trang_chu"){$a_2="selected=’selected’";}
if($link=="?thamso=tin_tuc"){$a_3="selected=’selected’";}
if($link=="?thamso=san_pham_moi"){$a_4="selected=’selected’";}
if($link=="?thamso=lien_he"){$a_5="selected=’selected’";}
if($row[‘loai’]=="san_pham"){$a_6="selected=’selected’";$link="san_pham";}
?>
<script>
function h_jf9(vl)
{
document.getElementById(‘link’).value=vl;
//if(vl=="?thamso=xuat_mot_tin&id=108")
if(vl.match("xuat_mot_tin"))
{
var vl="?thamso=xuat_mot_tin&id="+document.getElementById(‘sl_o2’).value;
document.getElementById(‘link’).value=vl;
document.getElementById(‘id_bai_viet’).style.display="block";
}
else
{
document.getElementById(‘id_bai_viet’).style.display="none";
}
//alert(vl);
}
function h_k12(vl)
{
//var gt_cu=document.getElementById(‘link’).value;
var gt_moi="?thamso=xuat_mot_tin&id="+vl;
document.getElementById(‘link’).value=gt_moi;
if(vl=="108")
{
document.getElementById(‘text_r9’).innerHTML="Hãy chọn 1 id để liên kết tới bài viết muốn sữa";
}
else
{
document.getElementById(‘text_r9′).innerHTML="<a href=’?thamso=quanly_dulieu_menu_ngang&sua_dulieu_menu_ngang=co&id_mnn="+vl+"’ target=’_blank’ class=’link_l88′ >Click vào đây để sữa bài viết có id là <b style=’font-size:20px’>"+vl+"</b></a>";
}
//alert(gt_moi);
}
</script>
<?php
if(ereg("xuat_mot_tin",$link))
{
$an_hien="display:block;";
$m_j=explode("id=",$link);
//print_r($m_j);echo "<hr>";
$link_bv=$link;
}
else
{
$an_hien="display:none;";
$link_bv="?thamso=xuat_mot_tin&id=108";
}
?>
<select onchange="h_jf9(this.value);" name="lmn" style="margin:3px 0px">
<option value="<?php echo $link_bv; ?>" <?php //echo $a_1; ?> >Bài viết</option>
<option value="san_pham" <?php echo $a_6; ?> >Sản phẩm</option>
<option value="?thamso=trang_chu" <?php echo $a_2; ?> >Trang chủ</option>
<option value="?thamso=tin_tuc" <?php echo $a_3; ?> >Tin tức</option>
<option value="?thamso=san_pham_moi" <?php echo $a_4; ?> >Sản phẩm mới</option>
<option value="?thamso=lien_he" <?php echo $a_5; ?> >Liên hệ</option>
</select>
<br />
<div id="id_bai_viet" style="<?php echo $an_hien; ?>" >Id bài viết : <select onchange="h_k12(this.value)" name="id_bai_viet" id="sl_o2">
<option value="108" >Chưa chọn</option>
<?php
for($i=1;$i<=100;$i++)
{
if($m_j[1]==$i)
{
$jh="selected=’selected’";
}
else
{
$jh="";
}
echo "<option value=’$i’ $jh >";
echo $i;
echo "</option>";
}
?>
</select>
<div id="text_r9" style="line-height:30px">Hãy chọn 1 id để liên kết tới bài viết muốn sữa</div>
</div>
<input type="hidden" name="link" size="50" id="link" style="margin:3px 0px" value="<?php echo $link; ?>" />
</div>
</td>
</tr>
<tr>
<td width="100px"><b>Tên Menu : </b></td>
<td><input type="text" name="tenmenu" value="<?php echo $ten_menu?>" size="50"/></td>
</tr>
<tr>
<td width="100px"><b>Url đẹp : </b></td>
<td>
<input type="text" name="url_dep" value="<?php echo $url_dep?>" size="50"/>
<input type="hidden" name="url_dep_hd" value="<?php echo $url_dep?>" />
</td>
</tr>
<!–<tr>
<td width="100px"><b>Tên Menu :<br>(English) </b></td>
<td valign="top"><input type="text" name="tenmenu_en" value="<?php //echo $ten_menu_1?>" size="50"/></td>
</tr>–>
<tr>
<td> </td>
<td>
<input type="hidden" name="form_hd_555" value="form_hd_555" />
<input type="submit" value="Sửa" class="nut_abc"/>
</td>
</tr>
</table>
</form>
<script type="text/javascript">
table_css_2("ir");
</script></pre>
<pre>[/sourcecode]
33. include_file(” cumchucnang/ quanly_menu_ngang/ xoa_sua_menungang_chitiet.php”);
[sourcecode language=”plain”]<a href="?thamso=xoa_sua_leftmenu" class="lienket_phanthan">Menu dọc</a><br />
<a href="?thamso=xoa_sua_menungang" class="lienket_phanthan">Menu ngang</a><br />
<!–<a href="?thamso=quan_ly_menu_help" class="lienket_phanthan">Menu help</a>–></pre>
<pre>[/sourcecode]
34. include_file(” cumchucnang/ quanly_menu_doc/ sua_xoa_menu.php”);
[sourcecode language=”plain”]<?php
chong_pha_hoai();
?>
<?php
if($_POST[‘form_trang’]==’form_trang’)
{
//thongbao("vao day");
for($i=1;$i<=15;$i++)
{
$name_1="sx_".$i;
$name_2="id_".$i;
$sx=$_POST[$name_1];
$id=$_POST[$name_2];
$up="UPDATE `menu` SET `sap_xep` = ‘$sx’ WHERE `id` =’$id’;";
mysql_query($up);
}
trang_truoc();
exit();
}
?>
<?php
function cap_menu_asd_de_quy($thuoc_menu,$so)
{
$so++;
$tv="select * from menu where id=’$thuoc_menu’";
$tv_1=mysql_query($tv);
$tv_2=mysql_fetch_array($tv_1);
if($tv_2[‘thuoc_menu’]=="")
{
return $so;
}
else
{
return cap_menu_asd_de_quy($tv_2[‘thuoc_menu’],$so);
}
}
function cap_menu_asd($id)
{
$tv="select * from menu where id=’$id’";
$tv_1=mysql_query($tv);
$tv_2=mysql_fetch_array($tv_1);
if($tv_2[‘thuoc_menu’]=="")
{
return 1;
}
else
{
return cap_menu_asd_de_quy($tv_2[‘thuoc_menu’],1);
}
}
//$cap_menu_asd=cap_menu_asd(54);
//echo $cap_menu_asd."<hr>";
function xac_dinh_menu_con_asd($id)
{
$mang=mysql_fetch_row(mysql_query("select count(*) from menu where thuoc_menu=’$id’"));
if($mang[0]!=0)
{
return "co";
}
else
{
return "khong";
}
}
function chuoi_union_asd_de_quy($id,$chuoi)
{
$tv="select * from menu where thuoc_menu=’$id’ order by sap_xep";
$tv_1=mysql_query($tv);
while($tv_2=mysql_fetch_array($tv_1))
{
$xac_dinh_menu_con_asd=xac_dinh_menu_con_asd($tv_2[‘id’]);
$chuoi=$chuoi."( select * from menu where id=’$tv_2[id]’) union ";
if($xac_dinh_menu_con_asd=="co")
{
$chuoi=chuoi_union_asd_de_quy($tv_2[‘id’],$chuoi);
}
}
return $chuoi;
}
function tinh_chuoi_union_asd()
{
$tv="select * from menu where thuoc_menu=” and vi_tri_menu!=’ngang’ order by sap_xep";
$tv_1=mysql_query($tv);
$chuoi="";
while($tv_2=mysql_fetch_array($tv_1))
{
$xac_dinh_menu_con_asd=xac_dinh_menu_con_asd($tv_2[‘id’]);
$chuoi=$chuoi."( select * from menu where id=’$tv_2[id]’) union ";
if($xac_dinh_menu_con_asd=="co")
{
$chuoi=chuoi_union_asd_de_quy($tv_2[‘id’],$chuoi);
}
}
$chuoi=substr($chuoi,0,-6);
return $chuoi;
}
$chuoi_union=tinh_chuoi_union_asd();
//echo $chuoi_union."<hr>";
?>
<style type="text/css">
a.a_vvv { font-size: 14px; text-decoration: none; color: #0b55c4; }
a.a_vvv:visited { font-size: 14px; color: #0b55c4; text-decoration: none; }
a.a_vvv:hover { font-size: 14px; text-decoration: none; color: #084095; font-style: normal; }
</style>
<?php
if(isset($_GET[‘xoa_menu’]))
{
$sql = "select count(*) from menu where capdo = ‘$_GET[id_menu]’";
//echo $sql."<br>";
$query = mysql_query($sql);
$rows = mysql_fetch_row($query);
//echo $rows[0]."<br>";
if($rows[0] == 0)
{
$del = "DELETE FROM `menu` WHERE `id_menu` = ‘$_GET[id_menu]’ ";
//echo $del." \$del <br>";
mysql_query($del);
trangtruoc();
}
else
{
trangtruoc();
}
}
?>
<?php
$sd = 15;
if($_GET[‘page’] == "")
{
$vtbd = 0;
}
else
{
$vtbd = ($_GET[‘page’]-1)*$sd;
}
$tsd=mysql_num_rows(mysql_query($chuoi_union));
$st = ceil($tsd/$sd);
$menu = $chuoi_union." limit $vtbd,$sd";
//echo $menu."<hr />";
$query = mysql_query($menu);
if($_GET[‘page’] == "" or $_GET[‘page’] == 1)
{
$stt = 1;
}
else
{
$stt=$vtbd + 1;
}
echo "<form action=” method=’post’ style=\"margin:0\">";
echo "<table id=\"er\" style=\"margin:6px 0px\" width=\"720px\">";
echo "<tr bgcolor=\"green\">";
echo "<td width=\"50px\" align=\"center\">STT</td>";
echo "<td width=\"350px\">Tiêu Đề</td>";
//echo "<td width=\"100px\">Dạng</td>";
echo "<td width=\"100px\" align=\"center\">Sắp xếp</td>";
echo "<td width=\"100px\" align=\"center\">Sửa</td>";
echo "<td width=\"100px\" align=\"center\">Xóa</td>";
echo "</tr>";
$r=1;
while($rows = mysql_fetch_array($query))
{
$id=$rows[‘id’];
$cap_menu_asd=cap_menu_asd($id);
$kt="";
for($i=1;$i<$cap_menu_asd;$i++)
{
$kt=$kt." ";
}
if(trim($rows[‘dang’])!=""){$dang="Link";}else {$dang="Sản phẩm";}
$tieu_de=$rows[‘ten’];
$tieu_de_1=$rows[‘ten_en’];
$link_sua="?thamso=xoa_sua_leftmenu_sua&id_menu=$id&page=$_GET[page]";
$link_xoa="?thamso=xoa_sua_leftmenu&xoa_left_menu=xoa&id_menu=$id";
$sap_xep=$rows[‘sap_xep’];
$name_1="sx_".$r;
$name_2="id_".$r;
echo "<tr class=\"mau_dong\">";
echo "<td align=\"center\">$stt</td>";
echo "<td nowrap=\"nowrap\">";
echo $kt."<a href=\"$link_sua\" class=\"a_vvv\">$tieu_de</a>";
echo "</td>";
//echo "<td nowrap=\"nowrap\">";
//echo "<span style=’font-size:14px’>".$dang."</span>";
//echo "</td>";
echo "<td align=\"center\">
<input size=’5′ style=’margin:3px’ value=’$sap_xep’ name=’$name_1′ >
<input type=’hidden’ value=’$id’ name=’$name_2′ >
</td>";
echo "<td align=\"center\"><a href=\"$link_sua\" class=\"sua_xoa\">Sửa</a></td>";
echo "<td align=\"center\"><a href=\"$link_xoa\" class=\"sua_xoa\">Xóa</a></td>";
echo "</tr>";
$stt++;
$r++;
}
echo "<tr>";
echo "<td width=\"50px\" align=\"center\" colspan=’2′ > </td>";
echo "<td width=\"50px\" align=\"center\" >
<input type=’hidden’ name=’form_trang’ value=’form_trang’ >
<input type=’submit’ value=’Thay đổi’ style=’margin:3px’ >
</td>";
echo "<td width=\"50px\" align=\"center\" colspan=’2′ > </td>";
echo "</tr>";
echo "</table>";
echo "</form>";
for($i=1; $i<=$st; $i++)
{
$link ="?thamso=xoa_sua_leftmenu&page=$i";
echo "<a href=\"$link\" class=\"phantrang\"> $i </a>";
}
?>
<script type="text/javascript">
table_css_2("er");
</script></pre>
<pre>[/sourcecode]
35. include_file(” cumchucnang/ quanly_menu_doc/ xoa_sua_leftmenu.php”);
[sourcecode language=”plain”]<?php
chong_pha_hoai();
?>
<?php
$id_menu_sua = $_GET[‘id_menu’];
$sql = "select * from menu where id = ‘$id_menu_sua’";
$query = mysql_query($sql);
$row = mysql_fetch_array($query);
?>
<form action="" method="post" style="margin:0">
<table width="970px" border="0" id="er" style="margin:6px">
<tr>
<td colspan="2">
<span style="float:left">Sữa menu</span>
<a href="?thamso=xoa_sua_leftmenu&page=<?php echo $_GET[‘page’] ?>" style="text-decoration: none;color:#0b55c4;float:right;margin-right:5px;">
Đóng
</a>
</td>
</tr>
<tr>
<td width="120px"><b>Tên :</b></td>
<td><input type="text" name="tenmenu" value="<?php echo $row[‘ten’]?>" size="50" /></td>
</tr>
<!–<tr>
<td><b>Dạng :</b></td>
<td>
<?php
/*switch($row[‘dang’])
{
case "link":
$a_1="";$a_2=’selected="selected"’;
$b="block";
break;
default:
$a_2="";$a_1=’selected="selected"’;
$b="none";
}*/
?>
<select name="dang" onclick="hg(this.value)">
<option value="" <?php //echo $a_1;?> >Sản phẩm</option>
<option value="link" <?php //echo $a_2;?> >Link</option>
</select>
<div id="link_kkk" style="display:<?php echo $b; ?>">
Link : <input name="link" size="40" id="link_kkk" value="<?php echo $row[‘link’]; ?>" />
</div>
<script>
function hg(v)
{
var id=document.getElementById("link_kkk");
if(v==""){id.style.display="none";}
if(v=="link"){id.style.display="block";}
}
</script>
</td>
</tr>–>
<tr>
<td><b>Keywords :</b></td>
<td><input type="text" name="keywords" size="50" value="<?php echo $row[‘keywords’]; ?>"/></td>
</tr>
<tr>
<td><b>Description :</b></td>
<td><input type="text" name="description" size="50" value="<?php echo $row[‘description’]; ?>"/></td>
</tr>
<tr>
<td><b>Url đẹp :</b></td>
<td><input type="text" name="url_dep" size="50" value="<?php echo $row[‘url_dep’]; ?>"/></td>
</tr>
</tr>
<tr>
<td> </td>
<td>
<input type="submit" name="sua_left_menu" value="Sửa" class="nut_abc"/>
</tr>
</table>
</form>
<script type="text/javascript">
table_css_2("er");
</script></pre>
<pre>[/sourcecode]
36. include_file(” cumchucnang/ quanly_menu_doc/ chitiet_sua_menu.php”);
[sourcecode 1=”<pre>[/sourcecode” language=”plain”]</pre>
<h2><span style="font-size: 14pt;">37. include_file(" cumchucnang/ quanly_dulieu/ bienluan_them_dulieu.php");</span></h2>
<pre>[sourcecode language="plain"]<a href="?thamso=them_dulieu_leftmenu" class="lienket_phanthan">Them Du Lieu Leftmenu</a><br />
<a href="?thamso=them_dulieu_menungang" class="lienket_phanthan">Them Du Lieu Menu Ngang</a><br /></pre>
<pre>[/sourcecode]
38. include_file(” cumchucnang/ quanly_dulieu/ them_dulieu_leftmenu.php”);
[sourcecode language=”plain”]<?php
chong_pha_hoai();
//echo "vao day <hr>";
empty_forder("../hinhanh_flash/upload_tam/");
// ham empty_forder : lam rong thu muc
//echo ereg("b","abc");
?>
<script type="text/javascript" >
function ddd5()
{
var id=document.getElementById("ddd5");
id.style.display="block";
}
</script>
<?php
function dequy_option__mnn($id,$nhandang)
{
$nhandang=" ".$nhandang;
$a=mysql_query("select * from menu where thuoc_menu in(‘$id’) order by id");
while($b=mysql_fetch_array($a))
{
echo"<option value=\"$b[id]\">$nhandang $b[ten]</option>";
dequy_option__mnn($b[‘id’],$nhandang);
}
}
class class__khung_them_du_lieu
{
function khung_nhap_lieu_fckeditor($name)
{
echo "<script type=\"text/javascript\">";
echo "var oFCKeditor = new FCKeditor(‘$name’);";
echo "oFCKeditor.BasePath = \"giaodien/fckeditor/\";";
echo "oFCKeditor.Width = 770 ;";
echo "oFCKeditor.Height = 350 ;";
mau_fckeditor();
echo "oFCKeditor.Config[\"EnterMode\"] = \"br\" ;";
echo "oFCKeditor.Create();";
//echo "document.getElementById(‘xEnter’).value = \"br\" ;";
echo "</script>";
}
function hop_chon_capdo(){
echo "<select name=\"capdo\" id=\"hop_chon_5\">";
$cap1_lan1_chuoi="select * from menu where thuoc_menu in(”) and vi_tri_menu!=’ngang’ order by id";
$cap1_lan1_truyvan=mysql_query($cap1_lan1_chuoi);
while($mang_cap1_lan1_dulieu=mysql_fetch_array($cap1_lan1_truyvan))
{
print ‘<option value="’.$mang_cap1_lan1_dulieu[‘id’].’">’.$mang_cap1_lan1_dulieu[‘ten’].'</option>’;
dequy_option__mnn($mang_cap1_lan1_dulieu[‘id’],"");
}
echo "</select>";
}
function khung_them_du_lieu()
{
echo "<table width=\"970px\" id=\"er\" style=\"margin:6px 0px\">";
echo "<form action=\"\" method=\"post\" enctype=\"multipart/form-data\" style=\"margin:0\">";
tr("Thêm sản phẩm vào left menu",2);
echo "<tr>";
echo "<td width=\"20%\" align=\"left\"><b>Cấp độ : </b></td>";
echo "<td width=\"80%\" align=\"left\">";
$this->hop_chon_capdo();
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td width=\"20%\" align=\"left\"><b>Tiêu đề : </b></td>";
echo "<td width=\"80%\" align=\"left\"><input name=\"tieude\" size=\"25\"></td>";
echo "</tr>";
//xuat_tr("Tiêu đề : <br>(English)","<input name=\"tieude_en\" size=\"70\">");
echo "<tr>";
echo "<td width=\"20%\" align=\"left\"><b>Hình ảnh : </b></td>";
echo "<td width=\"80%\" align=\"left\"><input type=\"file\" name=\"uploadedfile\"></td>";
echo "</tr>";
echo "<tr>";
echo "<td width=\"20%\" align=\"left\"><b>Up nhiều hình : </b></td>";
echo "<td width=\"80%\" align=\"left\">";
echo "<div style=’overflow:scroll;width:600px;height:150px’>";
echo "<input type=\"file\" name=\"up_hinh_1\" style=’margin:3px 0px’><br>";
echo "<input type=\"file\" name=\"up_hinh_2\" style=’margin:3px 0px’ ><br>";
echo "<input type=\"file\" name=\"up_hinh_3\" style=’margin:3px 0px’ ><br>";
echo "<input type=\"file\" name=\"up_hinh_4\" style=’margin:3px 0px’ ><br>";
echo "<input type=\"file\" name=\"up_hinh_5\" style=’margin:3px 0px’ ><br>";
echo "<input type=\"file\" name=\"up_hinh_6\" style=’margin:3px 0px’ ><br>";
echo "<input type=\"file\" name=\"up_hinh_7\" style=’margin:3px 0px’ ><br>";
echo "<input type=\"file\" name=\"up_hinh_8\" style=’margin:3px 0px’ ><br>";
echo "<input type=\"file\" name=\"up_hinh_9\" style=’margin:3px 0px’ ><br>";
echo "<input type=\"file\" name=\"up_hinh_10\" style=’margin:3px 0px’ ><br>";
echo "<input type=\"file\" name=\"up_hinh_11\" style=’margin:3px 0px’ ><br>";
echo "<input type=\"file\" name=\"up_hinh_12\" style=’margin:3px 0px’ ><br>";
echo "</div>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td width=\"20%\" align=\"left\"><b>Giá bán : </b></td>";
echo "<td width=\"80%\" align=\"left\"><input name=\"giaban\" size=\"25\">";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td width=\"20%\" align=\"left\"><b>Mô tả ngắn : </b></td>";
echo "<td width=\"80%\" align=\"left\"><textarea name=’mo_ta_ngan’ style=’width:300px;height:60px’></textarea>";
echo "</td>";
echo "</tr>";
/*echo "<tr>";
echo "<td width=\"20%\" align=\"left\"><b>Khối lượng : </b></td>";
echo "<td width=\"80%\" align=\"left\"><input name=\"khoi_luong\" size=\"25\">";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td width=\"20%\" align=\"left\" valign=’top’><b>Size : </b></td>";
echo "<td width=\"80%\" align=\"left\"><input name=\"size\" size=\"25\" value=\"$_SESSION[size]\">";
echo ‘<a href="javascript:voild(0)" style="margin-left:20px" onclick="ddd5()">Xem cách chọn size</a>’;
echo ‘<div style="width:5px;height:3px;overflow:hidden"></div>’;
echo ‘<div id="ddd5" style="margin-left:194px;display:none">Dùng dấu \’_\’ để phân cách size <br>Ví dụ : Nhập \’S_M_L_XL_XXL\’ thì sẽ được 5 size S,M,L,XL,XXL </div>’;
echo "</td>";
echo "</tr>";*/
echo "<tr>";
echo "<td width=\"20%\" align=\"left\"><b>Keywords : </b></td>";
echo "<td width=\"80%\" align=\"left\"><input name=\"keywords\" size=\"25\">";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td width=\"20%\" align=\"left\"><b>Description : </b></td>";
echo "<td width=\"80%\" align=\"left\"><input name=\"description\" size=\"25\">";
echo "</td>";
echo "</tr>";
?>
<tr>
<td><b>Url đẹp :</b></td>
<td><input type="text" name="url_dep" size="25" value=""/></td>
</tr>
<?php
//xuat_tr("Khuyến mãi : <br>(English)","<input name=\"khuyen_mai__en\" size=\"70\">");
echo "<tr>";
echo "<td width=\"20%\" valign=\"top\" align=\"left\"><b>Nội dung : </b></td>";
echo "<td width=\"80%\" valign=\"top\" align=\"left\">";
//xuat_select("luan","suc");
echo "<div id=\"div_vn_afc\">";
//echo "tieng viet";
mau_fckeditor_2();
$this->khung_nhap_lieu_fckeditor("noidung");
echo "</div>";
echo "<div id=\"div_en_afc\" style=\"display:none\">";
//echo "tieng anh";
//$this->khung_nhap_lieu_fckeditor("noidung_en");
echo "</div>";
echo "</td>";
echo "</tr>";
echo "<tr>";
o(" ");
o("<input type=\"submit\" class=\"nut_chapnhan\" value=\"Chấp nhận\" name=\"them_dulieu_menu_doc\">");
echo "</tr>";
echo "</form>";
echo "</table>";
}
}
$class__khung_them_du_lieu=new class__khung_them_du_lieu;
$class__khung_them_du_lieu->khung_them_du_lieu();
?>
<script type="text/javascript">
table_css_2("er");
var ss_cap_do="<?php echo $_SESSION[‘capdo’]; ?>";
var hop_chon_5=document.getElementById("hop_chon_5");
var option_55=hop_chon_5.getElementsByTagName("option");
//alert(option_55[0].value);
//alert(ss_cap_do);
for(i=0;i<option_55.length;i++)
{
if(option_55[i].value==ss_cap_do)
{
option_55[i].selected=true;
//alert("selected");
}
}
</script></pre>
<pre>[/sourcecode]
39. include_file(” cumchucnang/ quanly_dulieu/ them_san_pham_menu_ngang.php”);
[sourcecode language=”plain”]<?php
chong_pha_hoai();
//echo "vao day <hr>";
empty_forder("../hinhanh_flash/upload_tam/");
// ham empty_forder : lam rong thu muc
//echo ereg("b","abc");
?>
<script type="text/javascript" >
function ddd5()
{
var id=document.getElementById("ddd5");
id.style.display="block";
}
</script>
<?php
function dequy_option__mnn($id,$nhandang)
{
$nhandang=" ".$nhandang;
$a=mysql_query("select * from menu where thuoc_menu in(‘$id’) order by id");
while($b=mysql_fetch_array($a))
{
if($b[‘loai’]!="san_pham")
{
$f29="disabled";
}
else
{
$f29="";
}
echo "<option value=\"$b[id]\" $f29 >$nhandang $b[ten]</option>";
dequy_option__mnn($b[‘id’],$nhandang);
}
}
class class__khung_them_du_lieu
{
function khung_nhap_lieu_fckeditor($name)
{
echo "<script type=\"text/javascript\">";
echo "var oFCKeditor = new FCKeditor(‘$name’);";
echo "oFCKeditor.BasePath = \"giaodien/fckeditor/\";";
echo "oFCKeditor.Width = 770 ;";
echo "oFCKeditor.Height = 350 ;";
mau_fckeditor();
echo "oFCKeditor.Config[\"EnterMode\"] = \"br\" ;";
echo "oFCKeditor.Create();";
//echo "document.getElementById(‘xEnter’).value = \"br\" ;";
echo "</script>";
}
function hop_chon_capdo(){
echo "<select name=\"capdo\" id=\"hop_chon_5\">";
$cap1_lan1_chuoi="select * from menu where thuoc_menu in(”) and vi_tri_menu=’ngang’ order by id";
$cap1_lan1_truyvan=mysql_query($cap1_lan1_chuoi);
while($mang_cap1_lan1_dulieu=mysql_fetch_array($cap1_lan1_truyvan))
{
if($mang_cap1_lan1_dulieu[‘loai’]!="san_pham")
{
$f29="disabled";
}
else
{
$f29="";
}
print ‘<option value="’.$mang_cap1_lan1_dulieu[‘id’].’" ‘.$f29.’ >’.$mang_cap1_lan1_dulieu[‘ten’].'</option>’;
dequy_option__mnn($mang_cap1_lan1_dulieu[‘id’],"");
}
echo "</select>";
}
function khung_them_du_lieu()
{
echo "<table width=\"970px\" id=\"er\" style=\"margin:6px 0px\">";
echo "<form action=\"\" method=\"post\" enctype=\"multipart/form-data\" style=\"margin:0\">";
tr("Thêm sản phẩm vào menu ngang",2);
echo "<tr>";
echo "<td width=\"20%\" align=\"left\"><b>Cấp độ : </b></td>";
echo "<td width=\"80%\" align=\"left\">";
$this->hop_chon_capdo();
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td width=\"20%\" align=\"left\"><b>Tiêu đề : </b></td>";
echo "<td width=\"80%\" align=\"left\"><input name=\"tieude\" size=\"25\"></td>";
echo "</tr>";
//xuat_tr("Tiêu đề : <br>(English)","<input name=\"tieude_en\" size=\"70\">");
echo "<tr>";
echo "<td width=\"20%\" align=\"left\"><b>Hình ảnh : </b></td>";
echo "<td width=\"80%\" align=\"left\"><input type=\"file\" name=\"uploadedfile\"></td>";
echo "</tr>";
echo "<tr>";
echo "<td width=\"20%\" align=\"left\"><b>Up nhiều hình : </b></td>";
echo "<td width=\"80%\" align=\"left\">";
echo "<div style=’overflow:scroll;width:600px;height:150px’>";
echo "<input type=\"file\" name=\"up_hinh_1\" style=’margin:3px 0px’><br>";
echo "<input type=\"file\" name=\"up_hinh_2\" style=’margin:3px 0px’ ><br>";
echo "<input type=\"file\" name=\"up_hinh_3\" style=’margin:3px 0px’ ><br>";
echo "<input type=\"file\" name=\"up_hinh_4\" style=’margin:3px 0px’ ><br>";
echo "<input type=\"file\" name=\"up_hinh_5\" style=’margin:3px 0px’ ><br>";
echo "<input type=\"file\" name=\"up_hinh_6\" style=’margin:3px 0px’ ><br>";
echo "<input type=\"file\" name=\"up_hinh_7\" style=’margin:3px 0px’ ><br>";
echo "<input type=\"file\" name=\"up_hinh_8\" style=’margin:3px 0px’ ><br>";
echo "<input type=\"file\" name=\"up_hinh_9\" style=’margin:3px 0px’ ><br>";
echo "<input type=\"file\" name=\"up_hinh_10\" style=’margin:3px 0px’ ><br>";
echo "<input type=\"file\" name=\"up_hinh_11\" style=’margin:3px 0px’ ><br>";
echo "<input type=\"file\" name=\"up_hinh_12\" style=’margin:3px 0px’ ><br>";
echo "</div>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td width=\"20%\" align=\"left\"><b>Giá bán : </b></td>";
echo "<td width=\"80%\" align=\"left\"><input name=\"giaban\" size=\"25\">";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td width=\"20%\" align=\"left\"><b>Mô tả ngắn : </b></td>";
echo "<td width=\"80%\" align=\"left\"><textarea name=’mo_ta_ngan’ style=’width:300px;height:60px’></textarea>";
echo "</td>";
echo "</tr>";
/*echo "<tr>";
echo "<td width=\"20%\" align=\"left\"><b>Khối lượng : </b></td>";
echo "<td width=\"80%\" align=\"left\"><input name=\"khoi_luong\" size=\"25\">";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td width=\"20%\" align=\"left\" valign=’top’><b>Size : </b></td>";
echo "<td width=\"80%\" align=\"left\"><input name=\"size\" size=\"25\" value=\"$_SESSION[size]\">";
echo ‘<a href="javascript:voild(0)" style="margin-left:20px" onclick="ddd5()">Xem cách chọn size</a>’;
echo ‘<div style="width:5px;height:3px;overflow:hidden"></div>’;
echo ‘<div id="ddd5" style="margin-left:194px;display:none">Dùng dấu \’_\’ để phân cách size <br>Ví dụ : Nhập \’S_M_L_XL_XXL\’ thì sẽ được 5 size S,M,L,XL,XXL </div>’;
echo "</td>";
echo "</tr>";*/
echo "<tr>";
echo "<td width=\"20%\" align=\"left\"><b>Keywords : </b></td>";
echo "<td width=\"80%\" align=\"left\"><input name=\"keywords\" size=\"25\">";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td width=\"20%\" align=\"left\"><b>Description : </b></td>";
echo "<td width=\"80%\" align=\"left\"><input name=\"description\" size=\"25\">";
echo "</td>";
echo "</tr>";
?>
<tr>
<td><b>Url đẹp :</b></td>
<td><input type="text" name="url_dep" size="25" value=""/></td>
</tr>
<?php
//xuat_tr("Khuyến mãi : <br>(English)","<input name=\"khuyen_mai__en\" size=\"70\">");
echo "<tr>";
echo "<td width=\"20%\" valign=\"top\" align=\"left\"><b>Nội dung : </b></td>";
echo "<td width=\"80%\" valign=\"top\" align=\"left\">";
//xuat_select("luan","suc");
echo "<div id=\"div_vn_afc\">";
//echo "tieng viet";
mau_fckeditor_2();
$this->khung_nhap_lieu_fckeditor("noidung");
echo "</div>";
echo "<div id=\"div_en_afc\" style=\"display:none\">";
//echo "tieng anh";
//$this->khung_nhap_lieu_fckeditor("noidung_en");
echo "</div>";
echo "</td>";
echo "</tr>";
echo "<tr>";
o(" ");
o("<input type=\"submit\" class=\"nut_chapnhan\" value=\"Chấp nhận\" name=\"them_dulieu_menu_doc\">");
echo "</tr>";
echo "</form>";
echo "</table>";
}
}
$class__khung_them_du_lieu=new class__khung_them_du_lieu;
$class__khung_them_du_lieu->khung_them_du_lieu();
?>
<script type="text/javascript">
table_css_2("er");
var ss_cap_do="<?php echo $_SESSION[‘capdo’]; ?>";
var hop_chon_5=document.getElementById("hop_chon_5");
var option_55=hop_chon_5.getElementsByTagName("option");
//alert(option_55[0].value);
//alert(ss_cap_do);
for(i=0;i<option_55.length;i++)
{
if(option_55[i].value==ss_cap_do)
{
option_55[i].selected=true;
//alert("selected");
}
}
</script>[/sourcecode]
Chúc các bạn học tốt
-
Bạn có thể xem thêm các khóa học ở dưới:
Tag: học thiết kế đồ họa tại hà nội, học thiết kế đồ họa ở hà nội, học thiết kế đồ họa ở đâu, học thiết kế đồ họa ngắn hạn, khóa học thiết kế đồ họa ở hà nội, khóa học thiết kế đồ họa tại hà nội, học thiết kế đồ họa in ấn quảng cáo tại hà nội, khóa học thiết kế đồ họa in ấn quảng cáo tại hà nội, học lập trình web ở đâu, học lập trình web tại hà nội, học lập trình php ở đâu, học lập trình php tại hà nội
- Khóa học thiết kế đồ họa tại hà nội
- Khóa học lập trình php tại hà nội
- Khóa học html css ở đâu
- Khóa học photoshop ở hà nội
Mọi thông tin bạn có thể liên hệ:
Đào tạo lập trình và thiết kế đồ họa
Hotline: 0968.853.958 hoặc hỗ trợ kỹ thuật Mr. trung: 0947.499.221
Bình luận