Viewing file: register.php (6.87 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?
require("config.inc.php");
?>
<html>
<head>
<title><?echo $title?></title>
<meta http-equiv="Content-Type" content="text/html; charset=tis-620">
<link href="./style.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor=#FFFFE0 background="pic/bg2.gif">
<?
$BDdate = ("$b_year"."-"."$b_month"."-"."$b_day");
$BDdate = trim(htmlspecialchars($BDdate));
$User = trim(htmlspecialchars($User));
$Pass1 = trim(htmlspecialchars($Pass1));
$Pass2 = trim(htmlspecialchars($Pass2));
$Email = trim(htmlspecialchars($Email));
$ICQ = trim(htmlspecialchars($ICQ));
$WebName = trim(htmlspecialchars($WebName));
$URL = trim(htmlspecialchars($URL));
$Profile = trim(htmlspecialchars($Profile));
$memphoto = trim(htmlspecialchars($memphoto));
// ตรวจสอบว่ารหัสผ่านตรงกันหรือไม่
$n_pw1 = strlen($Pass1);
if($b_day=="0"){echo "<br>";
echo "<center>";
echo "<font size=3 face='MS Sans Serif'>";
echo "ใส่ วัน,เดือน,ปี ด้วย";
echo "</font>";
echo "<br><br>";
echo "<a href='javascript:history.back(1)'>[ กลับไปแก้ไข ] </a>";
echo "</center>";
exit();
}elseif($b_month=="0")
{echo "<br>";
echo "<center>";
echo "<font size=3 face='MS Sans Serif'>";
echo "ใส่ เดือน,ปี ด้วย";
echo "</font>";
echo "<br><br>";
echo "<a href='javascript:history.back(1)'>[ กลับไปแก้ไข ] </a>";
echo "</center>";
exit();
}elseif($b_year=="0")
{echo "<br>";
echo "<center>";
echo "<br>";
echo "<font size=3 face='MS Sans Serif'>";
echo "ใส่ ปี ด้วย";
echo "</font>";
echo "<br><br>";
echo "<a href='javascript:history.back(1)'>[ กลับไปแก้ไข ] </a>";
echo "</center>";
exit();
}
if($Pass1!=$Pass2 || $n_pw1<4) {
echo "<center>";
echo "<table width=60% border=1 bordercolor=#ff69b4 bgcolor=#f0ffff cellpadding=2 cellspacing=0>";
echo "<tr><td align=center>";
echo "<font size=2 face='MS Sans Serif'>";
echo "<font size=3 color=red><b>รหัสผ่านไม่ตรงกัน</b></font><br><br>";
echo "หรือน้อยกว่า 4 หลัก กรุณาตรวจสอบให้ถูกต้องด้วยครับ : )";
echo "</font></td></tr></table>";
echo "<br><hr width=500 color=blue>";
echo "<font size=2 face='MS Sans Serif'>";
echo "[<a href='javascript:history.back(1)'>Back</a>]";
echo "</center>";
exit();
}
if($action!="edit") {
// ตรวจสอบว่า user ที่รับมาเคยลงทะเบียนไปหรือยัง
mysql_connect($host,$user,$passwd);
$sql = "select User from webboard_member where User='$User'";
$result = mysql_db_query($dbname,$sql);
$NRow = mysql_num_rows($result);
// ถ้าเคยลงทะเบียนแล้ว ให้แจ้งข้อผิดพลาด
if($NRow!=0) {
echo "<center>";
echo "<table width=60% border=1 bordercolor=#ff69b4 bgcolor=#f0ffff cellpadding=2 cellspacing=0>";
echo "<tr><td align=center>";
echo "<font size=2 face='MS Sans Serif'>";
echo "<font size=3 color=red><b>Username [$User] ได้ถูกใช้ไปแล้ว</b></font><br><br>";
echo "กรุณาเปลี่ยน Username ด้วยครับ";
echo "</font></td></tr></table>";
echo "<br><hr width=500 color=blue>";
echo "<font size=2 face='MS Sans Serif'>";
echo "[<a href='javascript:history.back(1)'>Back</a>]";
echo "</center>";
exit();
}
mysql_close();
}
// ป้องกันการแทรก html กับ ละเครื่องหมาย ' "
$User = htmlspecialchars($User);
$Password = htmlspecialchars($Pass1);
$Email = htmlspecialchars($Email);
$ICQ = htmlspecialchars($ICQ);
$WebName = htmlspecialchars($WebName);
$URL = htmlspecialchars($URL);
$Profile = htmlspecialchars($Profile);
$memphoto = htmlspecialchars($memphoto);
$BDdate = htmlspecialchars($BDdate);
// ปรับเวลาให้ตรงกับเวลาเมืองไทย กรณีที่ server อยู่ที่เมืองนอก
$mdate = date("Y-m-d H:i:s");
mysql_connect($host,$user,$passwd);
$sql = "select * from webboard_member where memphoto='$memphoto'";
$result = mysql_db_query($dbname,$sql);
$NRow = mysql_num_rows($result);
#ตัดสคิ้ป html และตัด http://
$User = htmlspecialchars( $User );
$Profile = htmlspecialchars( $Profile );
$Profile = nl2br( $Profile );
if($action=="edit") {
$sql = "update webboard_member set Password='$Password' , Email='$Email' , ICQ='$ICQ' , WebName='$WebName' , URL='$URL',Profile='$Profile' ,icon='$b_icon' where User='$User'";
}
else {
$sql = "insert into webboard_member (User,Password,Email,ICQ,WebName,URL,Date,BDdate,Profile,icon) values ('$User','$Password','$Email','$ICQ','$WebName','$URL','$mdate','$BDdate','$Profile','$b_icon')";
}
$result = mysql_db_query($dbname,$sql);
if($result==0) {
echo "<center>";
echo "<table width=60% border=1 bordercolor=#ff69b4 bgcolor=#f0ffff cellpadding=2 cellspacing=0>";
echo "<tr><td align=center>";
echo "<font size=2 face='MS Sans Serif'>";
echo "<font size=3 color=red><b>มีข้อผิดพลาดที่ระบบ</b></font><br><br>";
echo "กรุณาแจ้ง admin ให้ตรวจสอบด้วยครับ";
echo "</font></td></tr></table>";
echo "<br><hr width=500 color=blue>";
echo "<font size=2 face='MS Sans Serif'>";
echo "[<a href='javascript:history.back(1)'>Back</a>]";
echo "</center>";
exit();
}
mysql_close();
if($action=="edit") {
echo "<center>";
echo "<table width=60% border=1 bordercolor=#ff69b4 bgcolor=#f0ffff cellpadding=2 cellspacing=0>";
echo "<tr><td align=center>";
echo "<font size=2 face='MS Sans Serif'>";
echo "<font size=3 color=red><b>ได้แก้ไขข้อมูลของ $User </b></font><br><br>";
echo "และบันทึกลงในฐานข้อมูลแล้ว<br>";
echo "และได้ส่ง user:passwd ไปยัง email ของท่านแล้ว";
echo "</font></td></tr></table>";
echo "<br><hr width=500 color=blue>";
echo "<font size=2 face='MS Sans Serif'>";
}
else {
echo "<center>";
echo "<table width=60% border=1 bordercolor=#ff69b4 bgcolor=#f0ffff cellpadding=2 cellspacing=0>";
echo "<tr><td align=center>";
echo "<font size=2 face='MS Sans Serif'>";
echo "<font size=3 color=red><b>ได้เพิ่มข้อมูลของ $User </b></font><br><br>";
echo "ลงในฐานข้อมูลแล้ว<br>";
echo "และได้ส่ง user:passwd ไปยัง email ของท่านแล้ว";
echo "</font></td></tr></table>";
echo "<br><hr width=500 color=blue>";
echo "<font size=2 face='MS Sans Serif'>";
echo "$BDdate";
}
//ส่งเมล์บอกรหัสผ่าน
$subject ="Username และ Password ของคุณสำหรับใช้ในเว็บบอร์ด ";
$msg = "ขอขอบคุณ คุณ $User\n";
$msg .= "ที่สมัครสมาชิกเว็บบอร์ด\n";
$msg .= "และหวังว่าคงได้รับความเอื้อเฟื้อ ในโอกาสอื่นๆต่อไป..\n\n";
$msg .= "==================================================\n";
$msg .= "คุณสามารถใช้ Username และ Passwoed นี้ในเว็บบอร์ด \n";
$msg .= "และสามารถแก้ไขข้อมูลได้ตลอดเวลา\n\n";
$msg .= "Username :: $User \n";
$msg .= "Password :: $Password \n\n";
$msg .= "==================================================\n\n";
$msg .= "Webmaster\n";
$from = "From: $Email\nReply-To: $webmasterEmail\nReturn-Path: $webmasterEmail";
mail(strtolower($Email) , $subject , $msg , $from);
?>
<br>
<font size=2 face="MS Sans Serif"> [<a href="../webboard/webboard.php?Category=<? echo $Category; ?>&page=<? echo $page; ?>">ไปหน้าเว็บบอร์ด</a>]
</font>
|