* Login   * Register


Last visit was:
It is currently Fri Dec 14, 2018 5:21 pm
View unanswered posts
View active topics





Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: đăng kí, dăng nhập có thi đó nha
PostPosted: Wed Jun 03, 2009 12:00 am 
Offline

Joined: Sun Feb 08, 2009 11:00 pm
Posts: 29
---------
ÔN THI LẬP TRÌNH ỨNG DỤNG MẠNG
CÔNG NGHỆ THÔNG TIN KHÓA 7


TÌM

<html>

<body>
<p align="center">BANG TIM GIA HANG</p>
<form method="POST" action="xltim1.php">
<p align="left">&nbsp;….&nbsp;
Gia Hang : <input type="text" name="giahang" size="10"></p>
<p align="center"><input type="submit" value="TIM" name="sb">&nbsp; </p>
</form>
</body>

</html>
TÌM 1

<html>

<body>
<p align="center">BANG TIM MA HANG</p>
<form method="POST" action="xltim.php">
<p align="left">&nbsp;…..&nbsp;
Ma Hang : <input type="text" name="mahang" size="10"></p>
<p align="center"><input type="submit" value="TIM" name="sb">&nbsp; </p>
</form>
</body>

</html>
XỬ LÍ TÌM


<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>

<body>
<?php
$m=$HTTP_POST_VARS["mahang"];
$t=$HTTP_POST_VARS["sb"];

$kn=mysql_connect("localhost","root","")
or die("ket noi that bai");
mysql_select_db("QLHH",$kn);

$sql="SELECT * FROM HH WHERE MaH='$m'";
$kq=mysql_query($sql,$kn);

if(isset($t))
{
if(empty($m))
{
echo"ban da nhap chua day du thong tin.Hay nhap lai nhe!";
require"tim.php";
}
else
{
if(mysql_num_rows($kq)< 0)
{
echo"trong du lieu khong co hang hoa nay";
require"themhang.php";
}
else
{
echo"trong bang du lieu co hang hoa nay!";
echo"<table border=1>";
echo"<tr>";
echo"<td>";
echo"Ma Hang";
echo"</td>";
echo"<td>";
echo"Loai Hang";
echo"</td>";
echo"<td>";
echo"Ten Hang";
echo"</td>";
echo"<td>";
echo"SL Hang";
echo"</td>";
echo"<td>";
echo"Gia Hang";
echo"</td>";
echo"</tr>";

while($ma=mysql_fetch_array($kq))
{
$mh=$ma["MaH"];
$lh=$ma["LoaiH"];
$th=$ma["TenH"];
$sl=$ma["SL"];
$g=$ma["GIA"];
echo"<tr>";
echo"<td>";
echo"$mh";
echo"</td>";
echo"<td>";
echo"$lh";
echo"</td>";
echo"<td>";
echo"$th";
echo"</td>";
echo"<td>";
echo"$sl";
echo"</td>";
echo"<td>";
echo"$g";
echo"</td>";
echo"</tr>";
echo"</table>";
mysql_close($kn);
}
}

}
}

?>
</body>

</html>

XỬ LÌ TÌM 1
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
</head>

<body>
<?php
$t=$HTTP_POST_VARS["sb"];
$gia=$HTTP_POST_VARS["giahang"];

$kn=mysql_connect("localhost","root","")
or die("ket noi that bai");
mysql_select_db("QLHH",$kn);

$sql="SELECT TenH,SL,GIA FROM HH WHERE GIA $gia";
$kq=mysql_query($sql,$kn);

if(isset($t))
{
if(empty($gia))
{
echo"ban da nhap chua day du thong tin.Hay nhap lai nhe!";
require"tim.php";
}
else
{
if(mysql_num_rows($kq)< 0)
{
echo"trong du lieu khong co hang hoa nay";
require"themhang.php";
}
else
{
echo"trong bang du lieu co hang hoa nay!";
echo"<table border=1>";
echo"<tr>";
echo"<td>";
echo"Ten Hang";
echo"</td>";
echo"<td>";
echo"SL Hang";
echo"</td>";
echo"<td>";
echo"Gia Hang";
echo"</td>";
echo"</tr>";
while($ga=mysql_fetch_array($kq))
{
$th=$ga["TenH"];
$sl=$ga["SL"];
$g=$ga["GIA"];
echo"<tr>";
echo"<td>";
echo"$th";
echo"</td>";
echo"<td>";
echo"$sl";
echo"</td>";
echo"<td>";
echo"$g";
echo"</td>";
echo"</tr>";

}
echo"</table>";
mysql_close($kn);
}

}
}

?>
</body>

</html>

ĐĂNG KÍ

<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<body background="a.jpg">
<br><br></br></br>
<script type="text/javascript">
function checkinput()
{
if(document.f.txtuser.value=="")
{
alert("Vui lòng nhập username");
document.f.txtuser.focus();
return false;
}
if(document.f.txtpass.value=="")
{
alert("Vui lòng nhập password");
document.f.txtpass.focus();
return false;
}
if(document.f.txtemail.value=="")
{
alert("Vui lòng nhập email");
document.f.txtemail.focus();
return false;
}
return true;
}
</script>
<form method="post" name="f" action="trangxulydangky.php" onSubmit="return checkinput()">
<table >
<tr>
<td>username:</td>
<td><input type="text" name="txtuser"></td>
</tr>
<tr>
<td>password:</td>
<td><input type="password" name="txtpass"></td>
</tr>
<tr>
<td>email:</td>
<td><input type="text" name="txtemail"></td>
</tr>
<tr>
<td colspan=2><center><input type="submit" value="Đăng ký" name="sb">
<input type="reset" value="Nhập lại" name="sd"></center></td>
</tr>
</form>
</body>
</html>

ĐĂNG NHẬP
<html>

<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>BANG DANG NHAP</title>
</head>

<body>

<form method="POST" action="login.php">
<p align="center">BANG DANG NHAP</p>
<p>&nbsp;</p>
<p>USERNAME : <input type="text" name="username" size="50" maxlenght="30"></p>
<p>PASSWORD : <input type="password" name="password" size="20" maxlength="10"></p>
<p align="center"><input type="submit" value="DANG NHAP" name="sb">&nbsp;&nbsp;&nbsp;
</p>
</form>

</body>

</html>
LOGIN
<?php
$u=$HTTP_POST_VARS["username"];
$p=$HTTP_POST_VARS["password"];
$s=$HTTP_POST_VARS["sb"];

$kn=mysql_connect("localhost","root","")
or die("ket noi that bai");
mysql_select_db("QLHH",$kn);

$sql="SELECT * FROM NSD WHERE user='$u' AND pass='$p'";
$kq=mysql_query($sql,$kn);

if(isset($s))
{
if(empty($u)||empty($p))
{
echo"ban da nhap chua day du thong tin.Hay nhap lai nhe!";
require"dn.php";
}
else
{
if(mysql_num_rows($kq)==0)
{
echo"ban chua co tai khoan hay dang ki di.";
require"dk.php";
}
else
{
echo"ban dang nhap thanh cong roi.Chuc mung nha!";
require "suapass.php";
mysql_close($kn);
}

}
}

?>
XỬ LÍ ĐĂNG KÍ

<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<body>
<?php
$user=$HTTP_POST_VARS["txtuser"];
$pass=$HTTP_POST_VARS["txtpass"];
$email=$HTTP_POST_VARS["txtemail"];
$link=mysql_connect("localhost","root","")
or die("khong ket noi duoc csdl");
mysql_select_db("mongnghi",$link);
$sql="select *from user where user='$user';";
$kq=mysql_query($sql);
if(mysql_num_rows($kq)!=0)
{
echo"<br>";
echo"&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp";
echo"<font color=red>$user đã tồn tại</font>";
require"dangky.php";
}
else
{
$sql="insert into user(user,email,pass) value ('$user','$email','$pass')";
$kq=mysql_query($sql);
echo"<br>";
echo"&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp";
echo"<font color=red>Đăng ký thành công</font>";
require"dangky.php";

}
?>
</body>
</html>


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

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