Posts

Showing posts from April, 2017

Responsive

Điều kiện để responsive :  <meta name="viewport" content="width=device-width, initial-scale=1"> CSS responsive :  @media (min-width: 768px) {     .container {         width: 750px;     } } @media (min-width: 992px) {     .container {         width: 970px;     } } @media (min-width: 1280px) {     .container {         width: 1250px;     } } @media screen and (max-width: 1024px) {     .side-left,     .main {         float: left;     }     .side-right {         display: none;     }     .side-left {         width: 25%;     }     .main {         width: 75%;     }     .title-header1, .title-header2, .title-header3 {         float: none;         width: 100%;         border: none;     } } @media screen and (max-width: 800px) {     .side-left {         display: none;     }     .side-right {         display: none;     }     .main {         width: 100%;     } } @media screen and (max-width: 720px) {     .header .da-slid

Đăng xuất hủy session

<?php @session_start(); session_destroy(); echo '<meta http-equiv="REFRESH" content ="0;URL=home.php"/>'; ?>

Xữ lý đăng nhập có session

<?php session_start(); ?> <?php include("connection.php"); $us = $_POST['us']; $pa = md5($_POST['pa']); $sq="select * from customer where username='$us' and password='$pa'"; $result = mysql_query($sq); if(mysql_num_rows($result)>0) { $_SESSION['user']=$us; echo "<script>alert('Login is successful!')</script>"; echo '<meta http-equiv="REFRESH" content ="0;URL=doimatkhau.php"/>'; } else { echo "<script>alert('Login is not successful!')</script>"; echo '<meta http-equiv="REFRESH" content ="0;URL=formdn_ss.php"/>'; } ?>

JavaScript bắt lổi đăng nhập

<script language="JavaScript"> function kt() { if(f.us.value=="") { alert("Enter username please"); f.us.focus(); return false; } if(f.pa.value=="") { alert("Enter password please"); f.pa.focus(); return false; } return true; } </script> <form name="f" method="post" action="dangnhap_xuly_ss.php" onSubmit="return kt();">   <table width="38%" border="0" align="center">     <tr>       <td colspan="2"><div align="center"><strong><font color="#0000FF">Login</font></strong></div></td>     </tr>     <tr>       <td width="19%">username</td>       <td width="47%"><input name="us" type="text" id="us" placeholder="Enter username"></

Đếm session trong php

<?php    session_start();       if( isset( $_SESSION['counter'] ) )    {       $_SESSION['counter'] += 1;    }    else    {       $_SESSION['counter'] = 1;    }    $msg = "You have visited this page ".  $_SESSION['counter'];    $msg .= " in this session."; ?> <html>       <head>       <title>Setting up a PHP session</title>    </head>      <body>       <?php  echo ( $msg ); ?>    </body>    </html>

Seri php thuần đăng ký đăng nhập thêm sửa xóa trong php

Phần 5 sữa dử liệu <body> <?php include("Connection.php"); $us=$_GET['us']; $sql= "SELECT * FROM `customer` where username='$us'"; $result=mysql_query($sql); $row=mysql_fetch_array($result); ?> <form action="" method="post" enctype="multipart/form-data" name="f" id="f">   <table width="484"  align="center">     <tr>       <td width="129">&nbsp;</td>       <td width="264" style="color:red;"><h2>Update Customer</h2></td>     </tr>     <tr>       <td>Username</td>       <td><label for="t1"></label>         <input type="text" name="t1" id="t1" readonly="readonly" value="<?php echo $row['username'];?>"/></td>     </tr>

Seri php thuần đăng ký đăng nhập thêm sửa xóa trong php

Phần 4 select dử liệu từ cơ sở dữ liệu <script> //kiểm tra có chắc muốn xóa hay không function sure() { if( confirm("are you sure")) { return true; } else{ return false; } } </script> <?php include("Connection.php"); if(isset($_GET['us'])){ //$_GET xữ lý trên trang không chuyển trang $us = $_GET['us']; $sq="DELETE FROM customer where username ='$us'"; mysql_query($sq); } ?> <title>Document</title> </head> <body> <?php include('Connection.php'); $result=mysql_query("select * from customer"); ?> <table width="694" border="1">   <tr>     <td width="121">Username</td>     <td width="152">Name</td>     <td width="51">Address</td>     <td width="97">Phone</td>     <td width="100">Ava

Seri php thuần đăng ký đăng nhập thêm sửa xóa trong php

Phần 3 đăng nhập <body> <?php include('Connection.php'); if(isset($_POST['btn_log'])) { $t1=$_POST['t1']; $t2=md5($_POST['t2']); $sq="select * from customer where username='$t1' and password ='$t2'"; $result= mysql_query($sq); if(mysql_num_rows($result)>0) { echo "<script>alert('login success');</script>"; echo '<meta http-equiv="refresh" content="0;url=select_cus_del.php"/>'; } else{ echo "<script>alert('login not success');</script>"; echo '<meta http-equiv="refresh" content="0;url=login.php"/>'; } }?> <form id="f" name="f" method="post" action="">   <p>username     <label for="t1"></label>   <input type="text" name="t1" id="t1" />

Seri php thuần đăng ký đăng nhập thêm sửa xóa trong php

Phần 2 : đăng ký thành viên //lưu ý bạn có thể viết code xử lý ở 1 file php riêng và action đến file đó ở đây mình xữ lý trên trang luôn <body> <?php include("Connection.php"); //gọi đến file kết nối cơ sở dữ liệu if(isset($_POST['btn_re'])) //kiểm tra xem có bấm nút đăng ký hay không { $us=$_POST['t1']; $pass=md5($_POST['t2']); $cusname=$_POST['t4']; $add=$_POST['t5']; $phone=$_POST['t6']; //up hinh $taptin =$_FILES['hinh']; //kiểm tra file hình ảnh if($taptin['type']=="image/ipg"||$taptin['type']=="image/jpeg"||$taptin['type']=="image/png"||$taptin['type']=="image/gif") { if($taptin['size']<=614400) { copy($taptin['tmp_name'],"Image/".$taptin['name']); $hinhanh=$taptin['name']; $sq="select * from customer where username=

Seri php thuần đăng ký đăng nhập thêm sửa xóa trong php

Phần 1 : tạo kết nối cơ sở dữ liệu <?php mysql_connect("localhost","root","") or die("Khong the ket noi Mysql"); mysql_select_db("cus_property") or die("khong the ket noi database"); //cus_property là tên cơ sở dữ liệu ?> //lưu file thành Connection.php