* Login   * Register


Last visit was:
It is currently Sat Feb 24, 2018 3:04 pm
View unanswered posts
View active topics





Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Nhung bai Tap PHP Day Du
PostPosted: Tue Jun 02, 2009 6:13 pm 
Offline

Joined: Thu Feb 05, 2009 1:48 pm
Posts: 21
---------
● 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 xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<script type="text/javascript">
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 name="form1" action="xulysua.php" method="post">
<h1> ĐĂNG KÝ </h1><br>
Username:<input type="text" name="user"><br>
Password:<input type="password" name="pass"><br>
Email:<input type="text" name="email"><br>
Diachi:<input type="text" name="diachi"><br><br>
<input type="submit" name="submit" value="Sửa">
</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 xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<script type="text/javascript">
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 name="form1" action="xulyxoa.php" method="post">
<h1> ĐĂNG KÝ </h1><br>
Username:<input type="text" name="user"><br>
Password:<input type="password" name="pass"><br>
Email:<input type="text" name="email"><br>
Diachi:<input type="text" name="diachi"><br><br>
<input type="submit" name="submit" value="Xóa">
</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 style="position: absolute; width: 215px; height: 24px; z-index: 17; left: 820px; top: 401px" id="layer35">
<i><font color="#3366CC"><b><form method="post" name="tt" action="xulydn.php">
<table border="0">
<tr>
<td>
&nbsp;&nbsp;<i><font color="#3366CC"><b>chaoban!:&nbsp;
</b></font></i><?php $user=$HTTP_POST_VARS["txtuser"]; echo"$user";?></b>
</td>
<td>
<a href="index.html">Thoát</a>
</td>

</tr>

</table>
</b></font></i></div>

● Dem so lan nguoi truy cap

<div style="position: absolute; width: 210px; height: 38px; z-index: 1; left: -226px; top: -58px" id="layer36">
<div style="margin-bottom:1px"><img src="http://hitfreecounter.com/counter/counter.php?Id=11456" alt="Load Counter"/></div>
<div style="background:#FFFFFF;text-align:center;padding-bottom:2px"><a href="http://www.dailyserver.com" target="_blank" style="color:#0000CC;font:10px Verdana;text-decoration:none">search engine optimization</a></div></div>

● Ngay thang


<div style="position: absolute; width: 187px; height: 42px; z-index: 19; left: 415px; top: 403px" id="layer38">
<SCRIPT Language="JavaScript">
<!-- hide from old browsers
var curDateTime = new Date()
document.write(curDateTime.toLocaleString())
//-->
</SCRIPT>
</div>

● ngay thang

<script type="text/javascript">
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>


Report this post
Top
 Profile E-mail  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 


Who is online

Users browsing this forum: No registered users and 0 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron

Make Forum · php-BB© · Internationalization Project · Report abuse · Terms Of Use/Privacy Policy
© Forums-Free.com 2009