|
Server : Apache/2.2.2 (Fedora) System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686 User : apache ( 48) PHP Version : 5.2.9 Disable Function : NONE Directory : /var/www/html/eoffice/application/document/ |
Upload File : |
<?
$org_id = intval($_SESSION[session_dev_id]);
$sex = array("M"=>"ชาย","F"=>"หญิง");
$m1 = array("#default", "user_ht.php" , "ref_id_info.php"); //, "user_pf.php"
$m2 = array("เปลี่ยนรหัสผ่าน", "รายละเอียดการเข้าใช้งาน" , "กำหนดเลขรหัสหน่วยงาน"); // , "ข้อมูลหน่วยงาน"
?>
<HTML xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=windows-874" />
<LINK href="../../common/style.css" rel="stylesheet" />
<TITLE>แก้ไขรายละเอียดต่าง ๆ</TITLE>
<STYLE>
.p_border{
border-bottom:2 solid #DADCED;
}
.shadetabs{
padding : 3px 0px ;
margin-left : 0;
margin-top : 1px;
margin-bottom : 0;
font : bold 12px tahoma;
list-style-type : none;
text-align : left; /*set to left, center, or right to align the menu as desired*/
}
.shadetabs li{
display : inline;
margin : 0;
background-color:#F2F4F7;
}
.shadetabs li a{
text-decoration : none;
padding : 3px 7px;
margin-right : 0px;
border : 1px solid #cccccc;
color : #666666;
text-decoration :underline;
}
.shadetabs li a:visited{
color : #666666;
}
.shadetabs li a:hover{
color : #666666;
}
.shadetabs li.selected{
position : relative;
top : 1px;
}
.shadetabs li.selected a{ /*selected main tab style */
background-color : #DADCED;
border-bottom-color : #DADCED;
}
.shadetabs li.selected a:hover{ /*selected main tab style */
text-decoration : none;
}
.contentstyle{
border : 1px solid #cccccc;
width : 700px;
margin-bottom : 1em;
padding : 10px;
background-color : #DADCED;
}
body {
margin-left: 5px;
margin-top: 5px;
margin-right: 5px;
}
</STYLE>
<SCRIPT language="javascript" src="ajaxtabs.js"></SCRIPT>
<SCRIPT language="javascript">
<?
foreach($session_gid as $vid => $val){
foreach($val as $v1 => $v2){
$gid_selected=$v2;
}
}
#################### เลขออก
if ($_SERVER[REQUEST_METHOD] == "POST"){
if ($digit){
$sql_del="
DELETE FROM ref_digit where ref_digit.gid=$id
";
$rsi=mysql_query($sql_del);
foreach($digit as $num => $val){
if($digit_char[$num]){ $val=$digit_char[$num];}
$sql_s="
INSERT INTO `ref_digit`
( `id` , `digit` , `value` , `type` , `gid` )
VALUES (
NULL , '$num', '$val', '$digit_type[$num]', '$gid_selected'
)
";
$rsi=mysql_query($sql_s);
}
$type="system";
}
#################### เลขเวียน
if ($digit_cir){
$sql_del="
DELETE FROM ref_digit_circular where ref_digit_circular.gid=$id
";
$rsi=mysql_query($sql_del);
foreach($digit_cir as $num => $val){
if($digit_char_cir[$num]){ $val=$digit_char_cir[$num];}
$sql="
INSERT INTO `ref_digit_circular`
( `id` , `digit` , `value` , `type` , `gid` )
VALUES (
NULL , '$num', '$val', '$digit_type_cir[$num]', '$gid_selected'
)
";
$rsi=mysql_query($sql);
}
$type="system";
}
}
$select_tag="";
$sql="select * from ref_type";
$rs=mysql_query($sql);
while($list=mysql_fetch_assoc($rs)){
if($list[id]=="2"){ $inner_code=" จำนวนหลัก : <input name=digit_char['+(gFiles)+'] type=text size=4 maxlength=2 >"; }else{ $inner_code="";}
$select_tag.=" <INPUT name=digit_type['+(gFiles)+'] type=radio value=$list[id]> $list[type] $inner_code <br>";
}
?>
// FILE ADD FUNCTION
var gFiles = 1;
function addFile() {
var li = document.createElement('li');
li.setAttribute('id', 'files-' + gFiles);
li.innerHTML = ' <b>หลักที่ '+(gFiles)+' </b><input type="text" name="digit['+(gFiles)+']" class="input" /> <span onclick="removeFile(\'files-' + gFiles + '\')" style="cursor:pointer;"> <img src="../../images/profile_sub.gif" /></span><br><?=$select_tag?>';
document.getElementById('files-root').appendChild(li);
gFiles++;
}
// FILE ADD FUNCTION
<?
$select_tag="";
$sql="select * from ref_type";
$rs=mysql_query($sql);
while($list=mysql_fetch_assoc($rs)){
if($list[id]=="2"){ $inner_code=" จำนวนหลัก : <input name=digit_char_cir['+(gFiles2)+'] type=text size=4 maxlength=2 >"; }else{ $inner_code="";}
$select_tag2.=" <INPUT name=digit_type_cir['+(gFiles2)+'] type=radio value=$list[id]> $list[type] $inner_code <br>";
} ?>
var gFiles2 = 1;
function addFile2() {
var li = document.createElement('li');
li.setAttribute('id', 'files-' + gFiles2);
li.innerHTML = ' <b>หลักที่ '+(gFiles2)+' </b><input type="text" name="digit_cir['+(gFiles2)+']" class="input" /> <span onclick="removeFile(\'files-' + gFiles2 + '\')" style="cursor:pointer;"> <img src="../../images/profile_sub.gif" /></span><br><?=$select_tag2?>';
document.getElementById('files-root2').appendChild(li);
gFiles2++;
}
function removeFile(aId){
var obj = document.getElementById(aId);
obj.parentNode.removeChild(obj);
}
</SCRIPT>
<SCRIPT language="javascript">
function ChangePass() {
if(document.post.old_pwd.value.length==0) {
alert("กรุณากรอกรหัสผ่าน");
document.post.old_pwd.focus();
return false;
} else if(document.post.new_pwd1.value.length==0) {
alert("โปรดใส่รหัสผ่านใหม่");
document.post.new_pwd1.focus();
return false;
} else if(document.post.new_pwd1.value.length != document.post.new_pwd2.value.length) {
alert("รหัสผ่านทั้งสองไม่ตรงกัน กรุณายืนยันรหัสผ่านให้ถูกต้อง") ;
document.post.new_pwd2.focus() ;
return false ;
}
var rnd = "rnd=" + Math.random();
var pwd_old = "&pwd_old=" + document.post.old_pwd.value;
var pwd_new = "&pwd_new=" + document.post.new_pwd1.value;
var param = rnd + pwd_old + pwd_new;
var txt = " <img src=\"../../images/indicator.gif\" align=\"absmiddle\" height=\"16\" width=\"16\"> Updating...";
document.getElementById("Status").innerHTML= txt;
xmlHttp.open('POST', 'user_cpwd.php', true);
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState==4) {
if (xmlHttp.status==200) { document.getElementById("Status").innerHTML = xmlHttp.responseText }
}
};
xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
xmlHttp.send(param);
document.post.reset();
}
function UpdateProfile() {
if(document.profile.staffname.value.length==0) {
alert("โปรดระบุชื่อภาษาไทย");
document.profile.staffname.focus();
return false;
} else if(document.profile.staffsurname.value.length==0) {
alert("โปรดระบุนามสกุลภาษาไทย");
document.profile.staffsurname.focus();
return false;
} else if(document.profile.engname.value.length==0) {
alert("โปรดระบุชื่อภาษาอังกฤษ");
document.profile.engname.focus();
return false;
} else if(document.profile.engsurname.value.length==0) {
alert("โปรดระบุนามสกุลภาษาอังกฤษ");
document.profile.engsurname.focus();
return false;
} else if(document.profile.email.value.length != 0) {
if(profile.email.value.indexOf('@')==-1) {
alert("อีเมล์ของคุณไม่ถูกต้องครับ") ;
document.profile.email.focus() ;
return false ;
} else if(profile.email.value.indexOf('.')==-1) {
alert("อีเมล์ของคุณไม่ถูกต้องครับ") ;
document.profile.email.focus() ;
return false ;
}
}
var rnd = "rnd=" + Math.random();
var prename = "&prename=" + document.profile.prename.value;
var staffname = "&staffname=" + document.profile.staffname.value;
var staffsurname = "&staffsurname=" + document.profile.staffsurname.value;
var engprename = "&engprename=" + document.profile.engprename.value;
var engname = "&engname=" + document.profile.engname.value;
var engsurname = "&engsurname=" + document.profile.engsurname.value;
var email = "&email=" + document.profile.email.value;
var sex = "&sex=" + document.profile.sex.value;
var title = "&title=" + document.profile.title.value;
var telno = "&telno=" + document.profile.telno.value;
//var address = "&address=" + document.profile.address.value;
var comment = "&comment=" + document.profile.comment.value;
var refid_info = "&refid_info=" + document.profile.refid_info.value;
var param = rnd + prename + staffname + staffsurname + engprename + engname + engsurname + email + sex + title + telno + comment+refid_info ;
var txt = " <img src=\"../../images/indicator.gif\" align=\"absmiddle\" height=\"16\" width=\"16\"> Updating...";
document.getElementById("Status").innerHTML= txt;
xmlHttp.open('POST', 'user_profile.php', true);
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState==4) {
if (xmlHttp.status==200) { document.getElementById("Status").innerHTML = xmlHttp.responseText }
}
};
xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");
xmlHttp.send(param);
}
function uplImage() {
var url = "user_image.php?rnd=" + Math.random() ;
var newwin = window.open(url ,'popup','location=0,status=no,scrollbars=no,resizable=no,width=400,height=120,top=200');
newwin.focus();
}
</SCRIPT>
</HEAD>
<BODY>
<TABLE width="100%" border="0" cellspacing="0" cellpadding="0" >
<TR valign="top">
<TD>
<UL id="maintab" class="shadetabs">
<?
for($i=0;$i<count($m1);$i++){
$showtab = ($i<=0) ? " class=\"selected\" " : "" ;
echo "<li $showtab><a href=\"".$m1[$i]."\" rel=\"ajaxcontentarea\">".$m2[$i]."</a></li>";
}
?>
</UL>
<DIV id="ajaxcontentarea" class="contentstyle" align="left" style="width:100%">
<FORM name="post">
<? // echo"<pre>";print_r($_POST); echo $sql_s;?>
<TABLE width="100%" border="0" cellpadding="5" cellspacing="0" bgcolor="#F2F4F7">
<TR>
<TD align="left" bgcolor="#DADCED"><SPAN style="font-size:11pt; font-weight:bold">เปลี่ยนข้อมูลรหัสผ่าน</SPAN></TD>
</TR>
<TR>
<TD align="center">
<TABLE width="100%" border="0" cellspacing="0" cellpadding="3">
<TR align="center">
<TD colspan="2"><DIV id="Status"></DIV></TD>
</TR>
<TR>
<TD width="171" height="20" align="left" class="p_border" ><STRONG>รหัสผ่านเดิม</STRONG> </TD>
<TD width="754" class="p_border" ><INPUT name="old_pwd" type="password" style="width:150;" size="20" maxlength="20"></TD>
</TR>
<TR>
<TD height="20" align="left"><STRONG>รหัสผ่านใหม่</STRONG> </TD>
<TD><INPUT name="new_pwd1" type="password" style="width:150;" size="20" maxlength="20"></TD>
</TR>
<TR>
<TD height="20" align="left"><STRONG>ยืนยันรหัสผ่านใหม่</STRONG> </TD>
<TD><INPUT name="new_pwd2" type="password" style="width:150;" size="20" maxlength="20"></TD>
</TR>
</TABLE>
</TD>
</TR>
<TR>
<TD align="left" bgcolor="#DADCED"><BUTTON style="width:60px; font-weight:bold" onClick="ChangePass();">OK</BUTTON></TD>
</TR>
</TABLE>
</FORM>
</DIV>
</TD>
</TR>
</TABLE>
<SCRIPT type="text/javascript">startajaxtabs("maintab")</SCRIPT>
</BODY>
</HTML>