Luận văn xây dựng wesite bán giày dép

40 367 0
Luận văn xây dựng wesite bán giày dép

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

    BỘ CÔNG THƢƠNG TRƢỜNG CAO ĐẲNG CÔNG THƢƠNG   BÁO CÁO ĐỒ ÁN MÔN HỌC PHP Đề tài: THIẾT KẾ WEBSITE XÂY DƢNG WESITE BÁN GIÀY DÉP GVDH: Hồ Diên Lợi SVTH: 1. Lớp: CĐ Tin 32A Khoá: 2008-2011Tp.HCM, năm 201112007   NHẬN XÉT CỦA GIÁO VIÊN                               LỜI NÓI ĐẦU ______ 0 0 0 ______                 thôn máy tính của bạn.      Website Bán Giày Dép     .      n  .   WEBSITE: SHOP BÁN GIÀY DÉP :SITE SHOP BÁN GIÀY DÉP I.1Cơ sở dữ liệu:gồm 8 bảng:  (id,tensanphamm,giasanpham,noisanxuat,tomtat,noidung,hinhanh,trangthai,danhm uc,id,masp,ghichu,ngay,deleted)   (id,tieude,tomtat,noidung,hinhanh,trangthai,danhmuc_tintuc,matintuc,ngaydang,ghichu,delete d) _ 5:Menu(id,key ,name,parent,page) 6:Login(id ,username,pass,uname,email,phone,address,utype,active,uskey) 7:(id,tm,ip) hang(id,hoten,diachi,dienthoai,content,ngay,ghichu) I.2 Nội dung code để xây dƣng trang web 1:File Function.php:Chức năng :xây dựng các hàm trong bài Dòng lệnh kêt nối data:tên data là ngochiep <?php class database { private $_host = "localhost"; private $_user = "root"; private $_pwd = ""; private $_db = "vthiep_db"; private $_status = true; private $_conn = null; function __construct($in_host, $in_user, $in_pwd, $in_db, $get_default){ if($get_default == true){ $this->_host = $in_host; $this->_user = $in_user; $this->_pwd = $in_pwd; $this->_db = $in_db; } }   function connect(){ $this->_conn = mysql_connect($this->_host, $this->_user, $this->_pwd); if(!$this->_conn){ echo "Connection string incorrect"; $this->_status = false; }else{ $db_selected = mysql_select_db($this->_db); mysql_query("set names 'utf8'"); if(!$db_selected){ echo "Could not connect ".$this->_db; $this->_status = false; } } Hàm ( public function get_products())    (function get_news_list($in_pk))    function get_user_login($in_user, $in_pwd) { if($this->_status) { $user = $in_user; $pwd = md5($in_pwd); $q_user = "select username, pass, uname, utype, user_key from login where username = '$user' and pass = '$pwd' and active='1'"; $r_user = mysql_query($q_user); $user_rows = mysql_num_rows($r_user); if($user_rows == 1) { $rsUser = mysql_fetch_array($r_user); $_SESSION["user_login"] = $rsUser[0]; $_SESSION["name_login"] = $rsUser[2]; $_SESSION["type_login"] = $rsUser[3]; $_SESSION["key_login"] = $rsUser[4]; header("Location: admin/index.php"); ob_end_flush(); }else{ echo "Login failed!"; } Hàm lất tất cả các dòng trong cở sở dữ liệu : phpmyadmin function mysql_fetch_all($result) { while($row = mysql_fetch_array($result)) {   $return[] = $row; } return $return; 2:FILE DATA_SITE.PHP require_once("admin/data.php"); gọi tới hàm admin/data.php hay kết nối tới hàm admin/data.php admin/data 2.1: Hàmpublic function get_product_index a danh      2.2:Hàm public function product_detail($in_pk)  where là chon masp  2.3:Hàm   function get_product_list($in_pk)  $in_pk   function get_news_list()  Select    public function news_detail($in_pk){       public function get_other($in_page){   $title = "Infomation"; if(array_key_exists($in_page, $title_page)){ $title = $title_page[$in_page]; } echo "<div class=\"title_sp\">".$title."</div>"; echo "<div class=\"rdata\">"; require_once($in_page.".php"); echo "</div>"; } 2.7: function finished_cart()  tháng     2.8: function login :Hàm Login    public function login(){ $user = $_POST["user_name"]; $pwd = $_POST["pwd"]; $this->get_user_login($user, $pwd); } function get_user_login($in_user, $in_pwd) { $user = $in_user; $pwd = md5($in_pwd); $q_user = "select username, pass, uname, utype, user_key from login where username = '$user' and pass = '$pwd' and active='1'"; $r_user = mysql_query($q_user); $user_rows = mysql_num_rows($r_user); if($user_rows == 1) { $rsUser = mysql_fetch_array($r_user); $_SESSION["user_login"] = $rsUser[0]; $_SESSION["name_login"] = $rsUser[2]; $_SESSION["type_login"] = $rsUser[3]; $_SESSION["key_login"] = $rsUser[4]; header("Location: admin/index.php"); ob_end_flush(); }else{ echo "Login failed!"; } } function mysql_fetch_all($result) { while($row = mysql_fetch_array($result)) { $return[] = $row; } return $return; }  require_once("function.php");base require_once("function.php");   class menu { function get_menu() { //$db = new database("localhost", "hiep", "vthiep", "vuthihiep", true); $db = new database("localhost", "vthiep", "vthpwd", "vthiep_db", false); $db->connect(); $q_menu = "select * from menu where parent = '0'"; $r_menu = mysql_query($q_menu); $menu = $db->mysql_fetch_all($r_menu); for($i=0; $i< count($menu); $i++){ echo "<div id=\"p_{$menu[$i][1]}\" class=\"iNavBar\" onmouseover=\"show_div(this)\" onmouseout=\"hide_div(this)\">"; echo "<a href='{$menu[$i][4]}'>{$menu[$i][2]}</a>"; $q_subm = "select * from menu where parent = '{$menu[$i][1]}'"; $r_subm = mysql_query($q_subm); if(mysql_num_rows($r_subm)>0){ $subm = $db->mysql_fetch_all($r_subm); if(count($subm)>0) { echo "<div id=\"sub_{$menu[$i][1]}\" class=\"submenu\" style=\"display:none\">"; for($s = 0; $s < count($subm); $s++){ echo "<li style=\"padding: 5px 20px; list- style-type:none\"> <! <a href='?page=plist&pk={$subm[$s][1]}'>".$subm[$s][2]."</a> > <a href='{$subm[$s][4]}{$subm[$s][1]}'>".$subm[$s][2]."</a> </li>"; } echo "</div>"; } } echo "</div>"; } } } ?>  $q_menu = "select * from menu where parent = '0'";   $r_menu = mysql_query($q_menu); $menu = $db->mysql_fetch_all($r_menu);   menu 4:File index  <div id="wrapper">   <div id="navbar"> <?php require_once("navbar.php");-> $mn = new menu(); $mn->get_menu(); ?> <div id="bodyp">  <div id="bp-top">  <div id="img_slide">  <div id="lastest_new">  < require_once("lastest_new.php");  <div id="bp-content">  <div id="content-left">  <div id="menu-right">  <?php require_once("sanpham.php"); $p = new getData(); $page = ""; $pk = ""; pk if($page == "pd"){ $p->product_detail($pk); } else if($page == "pl"){ $p->product_list($pk); }   else if($page == "nl"){ $p->news_list($pk); } else if($page == "nd"){ $p->news_detail($pk); .   WEBSITE: SHOP BÁN GIÀY DÉP :SITE SHOP BÁN GIÀY DÉP I.1Cơ sở dữ liệu:gồm 8 bảng:  (id,tensanphamm,giasanpham,noisanxuat,tomtat,noidung,hinhanh,trangthai,danhm uc,id,masp,ghichu,ngay,deleted).   BÁO CÁO ĐỒ ÁN MÔN HỌC PHP Đề tài: THIẾT KẾ WEBSITE XÂY DƢNG WESITE BÁN GIÀY DÉP GVDH: Hồ Diên Lợi SVTH: 1. Lớp: CĐ Tin 32A Khoá: 2008-2011Tp.HCM,.      Website Bán Giày Dép     

Ngày đăng: 19/10/2014, 02:57

Từ khóa liên quan

Tài liệu cùng người dùng

Tài liệu liên quan