|
 |
|
รวม php...<?php $user_db="root"; $pass_db=""; $host_db="localhost"; |
|
 |
|
|
 |
 |
|
//..........................connect.php
<?php
$user_db="root";
$pass_db="";
$host_db="localhost"; //เครื่องที่เราติดต่ิอ
$name_db="question";
if(mysql_connect($host_db,$user_db,$pass_db)) //ติดค่อฐานข้อมูล
{
mysql_db_query($name_db,"SET NAMES UTF8");
session_start();
//echo"สามารถติดต่อ Database ได้แล้ว";
}else{
echo"ไม่่สามารถติดต่อ Database ได้";
}
?>
//......................cklogin
<? session_start();?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<?php include("connect.php"); ?>
<?php $query="SELECT * FROM user_question WHERE user_name='$user_name' AND user_pass='$pass_word'";
$result = mysql_query($query);
$rows=mysql_num_rows($result);
if($rows>0){
mysql_data_seek($result,0);
$data=mysql_fetch_array($result);
$user_name=$data["user_name"];
$password=$data["pass_word"];
$user_id=$data["user_id"];
$status=$data["status"];
session_register("user_name");
session_register("user_pass");
session_register("user_id");
if($status=='1'){
session_register("1");
print "<meta http-equiv='refresh' content='0;url=admin/admin.php?show'>";
}elseif($status=='2'){
session_register('2');
print "<meta http-equiv='refresh' content='0;url=user/user.php?show'>";
}
}else{
print"<script language=JavaScript type=text/JavaScript> ";
print "alert('ชื่อผู้ใช้หรือรหัสผิดพลาด')"; print "</script>";
echo "<meta http-equiv=\"refresh\" content='0;URL=index.php'>";
}
?>
//.......................insert
$sql ="INSERT INTO `user_question` (`user_name`, `user_pass`, `name_user`, `lastname_user`, `sex`, `id_major`,`id_faculty`,`office`, `tel`,`mail`, `status`) VALUES ('$user_name', '$user_pass', '$f_name', '$l_name', '$sex', '$id_major', '$id_faculty', '$office', '$tel', '$mail', '$status');";
$ok = mysql_query($sql);
//.....................show
$SQL6="select * from plane,group_sub WHERE plane.p_program='$room' and plane.p_year like '%$a' and plane.p_term='$b' and plane.p_group=group_sub.gr_id";//เลือกข้อมูลมาแสดง
$result6=mysql_query($SQL6);
$rows6=mysql_num_rows($result6);
while($data6=mysql_fetch_array($result6)){
$p_group=$data6[p_group];
$p_subcode=$data6[p_subcode];
$p_subname=$data6[p_subname];
$p_unit=$data6[p_unit];
$gr_detail=$data6[gr_detail];
}
//.........................delete
$sql10="delete from question where id_question='$id_question'";
mysql_query($sql10);
//.........................update
$SQL="update user_question set user_name='$user_name', user_pass='$user_pass1', name_user='$name_user1', lastname_user='$lastname_user1', sex='$sex', id_faculty='$id_faculty', id_major='$id_major', office='$office', tel='$tel', mail='$mail1' WHERE user_id='$user_id' ";
mysql_query($SQL);
//........................search
$SQL2="select * from user_question,research_detail,questionnaries_detail where user_question.name_user like '%$keyword%';
//...................logout
<?
session_start();
session_destroy();
echo "<meta http-equiv='refresh' content='0;url=index.php'>";
?>
//.................java script ค่าว่าง
function cklogin()
{
if(form1.user_name.value=="")
{
alert("กรุณากรอกชื่อผู้ใช้ของคุณ");
document.form1.user_name.focus();
return false;
}
else
/*******************/
if(form1.pass_word.value=="")
{
alert("กรุณากรอกรหัสผ่านของคุณ");
document.form1.pass_word.focus();
return false;
}
else
return true;
}
Tag : - - - -

|
|
 |
 |
 |
 |
Date :
2009-05-13 20:30:34 |
By :
dee_com |
View :
1058 |
Reply :
5 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|

|
 |
 |
 |
 |
Date :
2009-05-13 20:42:03 |
By :
plakrim |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
?
|
 |
 |
 |
 |
Date :
2009-05-13 20:46:43 |
By :
kanchen |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
//....................edit checkbox
<?php if($arr_dt["sex"]=="1"){ echo "checked"; }?>
//.........................
|
 |
 |
 |
 |
Date :
2009-05-14 07:46:30 |
By :
dee_com |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ที่เอามานี้หมายความว่าไงหรอ จะเอามาให้ดู หรือว่าให้ช่วย อะไรช่วยบอกมาหน่อยดิ คือว่าไม่ทรายด้วยอะค่ะ อยู่ดีๆๆ ก็มา รวมphp งงเลยเรา ยังไงช่วยบอกหน่อยนะ อย่าว่ากกานละ เหอะๆๆ หุหุ
|
 |
 |
 |
 |
Date :
2009-05-14 08:42:27 |
By :
anchalika |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|

|
 |
 |
 |
 |
Date :
2009-05-14 09:29:33 |
By :
ddsure |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 01
|