php co ban
● Xu Ly Dang Ky
<?php
require("ketnoi.php");
$username=$_POST["user"];
$password=$_POST["pass"];
$email=$_POST["email"];
$address=$_POST["address"];
$sql="select*from user where username='$username'";
$kq=mysql_query($sql,$conn);
if(mysql_num_rows($kq)!=0)
{
echo"Dang ky thanh cong";
}
else
{
$sql="insert into user(username,password,email,address) value('$username','$password','$email','$address')";
$kq=mysql_query($sql,$conn);
include("th.html");
}
?>
● Xu Ly Dang Nhap Addmin
<html>
<body>
<?php
$user=$_POST["txtuser"];
$pass=$_POST["txtpass"];
$s=$_POST["sb"];
$link=mysql_connect("localhost","root","")
or die("die");
mysql_select_db("qlbh",$link);
$sql="select * from user where username='$user' and password='$pass';";
$kq=mysql_query($sql,$link);
if(isset($s))
{
if(mysql_num_rows($kq)==0)
{
require("index1.php");
}
else
{
if($user=="admin")
{
require("admin.html");
}
else
{
require("index.html");
}
}
}
?>
</body>
</html>
● Xu ly Dang Nhap BT
<?php
$conn=mysql_connect("localhost","root","") or die("Không k?t n?i du?c co s? du li?u");
mysql_select_db("quanlysv",$conn);
$user=$_post["username"];
$pass=$_post["password"];
$sql="select * from svien where username='$user' and password='$pass'";
$kq=mysql_query($sql,$conn);
if(mysql_num_rows($kq)==0)
{
echo"Ðang nh?p th?t b?i";
}
else
{
echo"dang nhap thanh cong";
include("trangchu.html");
}
?>
● Xu Ly Sua
<?php
require("ketnoi.php");
$user=$_POST["user"];
$pass=$_POST["pass"];
$email=$_POST["email"];
$diachi=$_POST["diachi"];
$sql="update user set password='$pass',email='$email',address='$diachi' where username='$user'";
$kq=mysql_query($sql,$conn);
include("sua.php");
?>
● Sua
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" />
<title>Untitled Document</title>
</head>
<body>
<script>
function selectupdate (username,password,email,diachi)
{
document.form1.user.value=username;
document.form1.user.disable=1;
document.form1.pass.value=password;
document.form1.email.value=email;
document.form1.diachi.value=diachi;
}
</script>
<form>
<h1> ĐĂNG KÝ </h1><br>
Username:<input><br>
Password:<input><br>
Email:<input><br>
Diachi:<input><br><br>
<input>
</form>
<?php
require("ketnoi.php");
$sql="select*from user";
$kq=mysql_query($sql,$conn);
if(mysql_num_rows($kq)>0)
{
echo"<table border=1><tr><td>Username</td>";
echo"<td>Password</td>";
echo"<td>Email</td>";
echo"<td>Diachi</td>";
echo"<td>chon</td>";
while($dong=mysql_fetch_array($kq))
{
$user=$dong["username"];
$pass=$dong["password"];
$email=$dong["email"];
$diachi=$dong["diachi"];
echo"<tr><td>$user</td>";
echo"<td>$pass</td>";
echo"<td>$email</td>";
echo"<td>$diachi</td>";
echo"<td><input type=radio name=sua onclick=selectupdate('$user','$pass','$email','$diachi')></td></tr>";
}
echo"</table>";
}
?>
</body>
</html>
● Xu Ly Xoa
<title>Untitled Document</title><?php
require("ketnoi.php");
$user=$_POST["user"];
$pass=$_POST["pass"];
$email=$_POST["email"];
$diachi=$_POST["address"];
echo"test:$user";
$sql="delete from user where username='$user'";
echo"$sql";
$kq=mysql_query($sql,$conn);
include("xoa.php");
?>
● Xoa
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" />
<title>Untitled Document</title>
</head>
<body>
<script>
function selectupdate (username,password,email,diachi)
{
document.form1.user.value=username;
document.form1.user.disable=1;
document.form1.pass.value=password;
document.form1.email.value=email;
document.form1.diachi.value=diachi;
}
</script>
<form>
<h1> ĐĂNG KÝ </h1><br>
Username:<input><br>
Password:<input><br>
Email:<input><br>
Diachi:<input><br><br>
<input>
</form>
<?php
require("ketnoi.php");
$sql="select*from user";
$kq=mysql_query($sql,$conn);
if(mysql_num_rows($kq)>0)
{
echo"<table border=1><tr><td>Username</td>";
echo"<td>Password</td>";
echo"<td>Email</td>";
echo"<td>Diachi</td>";
echo"<td>chon</td>";
while($dong=mysql_fetch_array($kq))
{
$user=$dong["username"];
$pass=$dong["password"];
$email=$dong["email"];
$diachi=$dong["diachi"];
echo"<tr><td>$user</td>";
echo"<td>$pass</td>";
echo"<td>$email</td>";
echo"<td>$diachi</td>";
echo"<td><input type=radio name=sua onclick=selectupdate('$user','$pass','$email','$diachi')></td></tr>";
}
echo"</table>";
}
?>
</body>
</html>
● Kiet noi
<?php
$conn=mysql_connect("localhost","root","") or die("khong ket noi duoc");
mysql_select_db("xemphim",$conn);
?>
● Xu Ly Tim Kiem
<?php
require("ketnoi1.php");
$tim=$_POST["txttim"];
$gia=$_POST["txtphim"];
$sql="select * from xp where tenphim like '%$tim%'or loai like '%$loai%' ";
$kq=mysql_query($sql,$conn);
if(mysql_num_rows($kq)>0)
{
echo"<table border=1 ><tr><td>ma</td>";
echo"<td>Loaip</td>";
echo"<td>Tenphim</td></tr>";
while($dong=mysql_fetch_array($kq))
{
$ma=$dong["ma"];
$loaip=$dong["loai"];
$tenp=$dong["tenphim"];
echo"<tr><td>$ma</td>";
echo"<td>$loaip</td>";
echo"<td>$tenp</td></tr>";
}
echo"</table>";
}
else
{
echo"k tim thay";
}
?>
● Hien thi ten nguoi dung
<div>
<i><font><b><form>
<table>
<tr>
<td>
<i><font><b>chaoban!:
</b></font></i><?php $user=$HTTP_POST_VARS["txtuser"]; echo"$user";?></b>
</td>
<td>
<a>Thoát</a>
</td>
</tr>
</table>
</b></font></i></div>
● Dem so lan nguoi truy cap
<div>
<div><img/></div>
<div><a>search engine optimization</a></div></div>
● Ngay thang
<div>
<SCRIPT>
<!-- hide from old browsers
var curDateTime = new Date()
document.write(curDateTime.toLocaleString())
//-->
</SCRIPT>
</div>
● ngay thang
<script>
var mydate=new Date()
var year=mydate.getYear()
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
var phut=mydate.getMinutes()
var gio=mydate.getHours()
var giay=mydate.getSeconds()
if (daym<10)
daym="0"+daym
var dayarray=new Array("Chủ Nhật","Thứ Hai","Thứ Ba","Thứ Tư","Thứ Năm","Thứ Sáu","Thứ Bảy")
var montharray=new Array("/01","/02","/03","/04","/05","/06","/07","/08","/09","/10","/11","/12")
document.write("<strong > Hôm nay: " +dayarray[day]+", Ngày "+daym+""+montharray[month]+"/"+year+"</strong>" )
</script>
Bạn đang đọc truyện trên: Truyen247.Pro