Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,038

HOME > PHP > PHP Forum > รบกวน ช่วยดูให้หน่อยครับ เกี่ยวกับการสมัครสมาชิกครับ



 

รบกวน ช่วยดูให้หน่อยครับ เกี่ยวกับการสมัครสมาชิกครับ

 



Topic : 042486



โพสกระทู้ ( 13 )
บทความ ( 0 )



สถานะออฟไลน์




connect.php

<?
$objConnect = mysql_connect("localhost","root","root");
if($objConnect)
{
echo "Database Connected.";
}
else
{
echo "Database Connect Failed.";
}

mysql_close($objConnect);
?>

----------------------------------------------------------------------------------------------------

index.php


<?
session_start();
?>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" />
<title>คอมพิวเตอร์ธุรกิจภาคพิเศษ</title>
<style type="text/css">
<!--
body {
background-color: #FFF;
text-align: left;
}
.fortable {
background-color: #09F;
border: thin solid #009;
text-align: center;
font-size: 24px;
}
.Table2 {
background-color: #366;
}
.NS {
background-color: #666;
}
.fortable tr th marquee {
color: #CCC;
}
.bg {
background-color: #F0F0F0;
border: medium solid #666;
}
#form1 table tr td {
color: #06F;
text-align: center;
}
.bg tr th marquee {
color: #FC3;
}
.bg tr th marquee {
color: #630;
}
#form1 .bg tr th {
color: #33F;
}
-->
</style>
</head>

<body>


<p>&nbsp;</p>
<table width="900" height="213" border="0" align="center" class="bg">
<tr>
<th width="900" height="172" scope="col"><img src="image/หัวเว็ป/01.gif" width="880" height="170" class="bg" /></tr>
<tr>
<th height="30" scope="row" ><marquee>
วิทยาลัยบริหารธุรกิจและการท่องเที่ยวกรุงเทพ โทรศัพท์
&nbsp;02-914-3172-3
&nbsp;&nbsp;โทรสาร&nbsp;02-914-0805
</marquee></th>
</tr>
</table>
<br>
<center>
<form action="chkuser.php" method="post" name="form1" id="form1">

<table width="900" border="0" class="bg">
<tr>
<th colspan="14" scope="col"><img src="image/แผนก.jpg" width="500" height="90" class="bg" /></th>
</tr>
<tr>
<th width="32" scope="col">&nbsp;</th>
<th width="49" scope="col">&nbsp;</th>
<th width="10" scope="col">&nbsp;</th>
<th width="159" scope="col">&nbsp;</th>
<th width="22" scope="col">&nbsp;</th>
<th width="47" scope="col">&nbsp;</th>
<th width="79" scope="col">&nbsp;</th>
<th width="24" scope="col">&nbsp;</th>
<th width="70" scope="col">&nbsp;</th>
<th width="10" scope="col">&nbsp;</th>
<th width="4" scope="col">&nbsp;</th>
<th width="336" colspan="3" rowspan="9" scope="col">&nbsp;</th>
</tr>
<tr>
<th scope="col">&nbsp;</th>
<th scope="col">&nbsp;</th>
<th scope="col">&nbsp;</th>
<th scope="col">&nbsp;</th>
<th scope="col">&nbsp;</th>
<th scope="col">&nbsp;</th>
<th scope="col">&nbsp;</th>
<th scope="col">&nbsp;</th>
<th scope="col">&nbsp;</th>
<th scope="col">&nbsp;</th>
<th scope="col">&nbsp;</th>
</tr>
<tr>
<th scope="col">&nbsp;</th>
<th scope="col">&nbsp;</th>
<th scope="col">&nbsp;</th>
<th scope="col">&nbsp;</th>
<th colspan="2" scope="col">Username :</th>
<th colspan="4" scope="col"><input name="username" type="text" id="username" ></th>
<th scope="col">&nbsp;</th>
</tr>
<tr>
<th scope="col">&nbsp;</th>
<th scope="col">&nbsp;</th>
<th scope="col">&nbsp;</th>
<th scope="col">&nbsp;</th>
<th colspan="2" scope="col">Password :</th>
<th colspan="4" scope="col"><input name="password" type="password" id="password" ></th>
<th scope="col">&nbsp;</th>
</tr>
<tr>
<th scope="col">&nbsp;</th>
<th scope="col">&nbsp;</th>
<th scope="col">&nbsp;</th>
<th scope="col">&nbsp;</th>
<th scope="col">&nbsp;</th>
<th scope="col">&nbsp;</th>
<th scope="col">&nbsp;</th>
<th scope="col">&nbsp;</th>
<th scope="col">&nbsp;</th>
<th scope="col">&nbsp;</th>
<th scope="col">&nbsp;</th>
</tr>
<tr>
<th scope="row">&nbsp;</th>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><input type="submit" name="Reset" value="Reset" id="Reset" ></td>
<td colspan="2">
<input type="submit" name="Submit" value="Submit" id="Submit" >
</a></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<th scope="row">&nbsp;</th>
<td>&nbsp;</td>
<td>&nbsp;</td>

<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td colspan="3"><a href="register.php">สมัครสมาชิก</a></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<th scope="row">&nbsp;</th>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td colspan="2">&nbsp;</td>
<td colspan="2">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<th scope="row">&nbsp;</th>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
</form></center>
<br>
<center><table width="900" border="0" class="bg">
<tr>
<th scope="col"><img src="image/หัวเว็ป/001.jpg" width="891" height="120" class="bg" /></th>
</tr>
</table></center>
<p><br /></p>
</body>
</html>

-----------------------------------------------------------------------------------------------------

register.php


<!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=windows-874" />
<title>สมัครสมาชิก</title>
<style type="text/css">
<!--
.style3 { font-size: 16px;
color: #0000FF;
}
.style4 {font-family: Geneva, Arial, Helvetica, sans-serif}
.style68 {font-family: Geneva, Arial, Helvetica, sans-serif; font-size: 9px;color: #FF0000; }
.style69 {font-size: 12px}
body {
background-color: #FFC;
}
-->
</style>
</head>

<body>
<form id="form1" name="form1" method="post" action="add-register.php">
<table width="560" border="0" align="center">
<tr></tr>
<tr></tr>
<tr></tr>
<tr>
<td colspan="4"><div align="center" class="style3 style4 style8">สมัครสมาชิก</div></td>
</tr>
<tr>
<td width="157"><div align="right" class="style6 style4 style69">Username</div></td>
<td width="3"><span class="style6">:</span></td>
<td colspan="2" align="left"><span class="style6">
<label>
<input type="text" name="username" id="username" />
</label>
</span>
<label><span class="style68">**</span></label>
<span class="style6">
<label></label>
</span></td>
</tr>
<tr>
<td><div align="right" class="style6 style4 style69">Password</div></td>
<td><span class="style6">:</span></td>
<td colspan="2" align="left"><span class="style6">
<label>
<input type="password" name="password" id="password" />
</label>
</span>
<label><span class="style68"> **</span></label>
<span class="style6">
<label></label>
</span></td>
</tr>
<tr>
<td><div align="right" class="style6 style4 style69">RePassword</div></td>
<td><span class="style6">:</span></td>
<td colspan="2" align="left"><span class="style6">
<label>
<input type="password" name="repassword" id="repassword" />
</label>
</span>
<label><span class="style68">**</span></label>
<span class="style6">
<label></label>
</span></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td colspan="2" align="left">&nbsp;</td>
</tr>
<tr>
<td><div align="right" class="style6 style4 style69">ชื่อ</div></td>
<td><span class="style6">:</span></td>
<td colspan="2" align="left"><span class="style6">
<label>
<input type="text" name="name" id="name" />
</label>
</span>
<label><span class="style68">**</span></label>
<span class="style6">
<label></label>
</span></td>
</tr>
<tr>
<td><div align="right" class="style6 style4 style69">สกุล</div></td>
<td><span class="style6">:</span></td>
<td colspan="2" align="left"><span class="style6">
<label>
<input type="text" name="lastname" id="lastname" />
</label>
</span>
<label><span class="style68"> **</span></label>
<span class="style6">
<label></label>
</span></td>
</tr>
<tr></tr>
<tr>
<td><div align="right" class="style6 style4 style69">E-mail</div></td>
<td height="27"><span class="style6">:</span></td>
<td colspan="2" align="left"><span class="style6">
<label>
<input name="email" type="text" id="email" size="30" maxlength="30" />
<span class="style68">**</span> <br />
</label>
</span></td>
</tr>
<tr>
<td><div align="right" class="style6 style4 style69">Telephone</div></td>
<td height="24">&nbsp;</td>
<td valign="top"><input type="text" name="telephone" id="telephone" /></td>
<td><label><span class="style68">**</span></label>
<span class="style6">
<label></label>
</span></td>
</tr>
<tr>
<td>&nbsp;</td>
<td height="33">&nbsp;</td>
<td width="149" valign="top"><label>
<br />
<input type="reset" name="Reset" id="Reset" value="Reset" />
</label></td>
<td width="233">
<label><br />
<input type="Submit" name="Submit" id="Submit" value="Submit" />
</label>
</p>
<p align="left">&nbsp; </p></td>
</tr>
</table>
</form>
</body>
</html>

-----------------------------------------------------------------------------------------------------

add-register.php

<?php
include "connect.php";

$username=$_POST[username];
$password=$_POST[password];
$repassword=$_POST[repassword];

$name=$_POST[name];
$lastname=$_POST[lastname];
$email=$_POST[email];
$telephone=$_POST[telephone];

if($username=="username" or $password=="password" or $repassword=="repassword" or $name=="name" or $lastname=="lastname" or $email=="email" or telephone=="telephone") {
echo "Plz Input all data";
echo " <meta http-equiv=\"refresh\" content=\"1; url=register.php\">";
}

if($password != $repassword){
echo "Password != RePassword";
echo " <meta http-equiv=\"refresh\" content=\"1; url=register.php\">";
}

$sql="INSERT INTO `member`.`tb_member` (`id` ,`username` ,`password` ,`name` ,`lastname` ,`email` ,`telephone`)
VALUES (NULL , '$username', '$password', '$name', 'lastname', 'email', '$telephone');";
$result=mysql_db_query($dbname,$sql);

if ($result){
echo "Register has success";
echo " <meta http-equiv=\"refresh\" content=\"1; url=register.php\">";
}
else {
echo "Register has fail";
echo " <meta http-equiv=\"refresh\" content=\"1; url=register.php\">";
}
?>


------------------------------------------------------------------------------------------------------

chkuser.php

<?php
include "connect.php";

$username=$_POST[username];
$password=$_POST[password];

if ($username=="" || $password=="")
{
echo "<meta http-equiv=\"refresh\" content=\"1; url=index.php\">";
}else{

$sql="SELECT * FROM `tb_member` WHERE `username` ='$username' AND `password` = '$password' ";

$result=mysql_db_query($dbname,$sql);

if($check=mysql_fetch_array($result)){ // ผมมีปันหากับตัวนี้อ่ะงับ //
if($check['username']!=""&&$check['password']!=""){
session_start();
$_SESSION[session_username]=$username;
echo "<meta http-equiv=\"refresh\" content=\"0; url=loginlaw.php\">";
}else{
echo "<meta http-equiv=\"refresh\" content=\"1; url=index.php\">";
}
}
}
?>

-----------------------------------------------------------------------------------------------------

loginlaw.php



<?php
session_start();
include "connect.php";

$sql="select * from tb_member where username='$session_username'";

$result=mysql_db_query($dbname,$sql);
$record=mysql_fetch_array($result);

$username=$record[username];
$name=$record[name];
$lastname=$record[lastname];
$email=$record[email];
$telephone=$record[telephone];

mysql_close();
?>
<!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" />
<link href="style.css" rel="stylesheet" type="text/css">
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
background-color: #000000;
}
a:link {
color: #CCCCCC;
}
.style1 {color: #FFFF00}
-->
</style></head>

<body>
<table width="423" border="0" align="center">
<tr>
<td colspan="2" class="white"><div align="center">
<?=$session_username ?>
's Profile</div></td>
</tr>
<tr>
<td width="165" class="white"><div align="right"></div></td>
<td width="248" class="white"><div align="center"></div></td>
</tr>
<tr>
<td class="white"><div align="right" class="style1">Username</div></td>
<td class="white">
<div align="left">
<?=$username ?>
&nbsp;</div></td>
</tr>
<tr>
<td class="white"><div align="right"><span class="style1"></span></div></td>
<td class="white"><div align="left"></div></td>
</tr>
<tr>
<td class="white"><div align="right" class="style1">Name</div></td>
<td class="white">
<div align="left">
<?=$name ?>
&nbsp;</div></td>
</tr>
<tr>
<td class="white"><div align="right" class="style1">Lastname</div></td>
<td class="white">
<div align="left">
<?=$lastname ?>
&nbsp;</div></td>
</tr>
<tr>
<td class="white"><div align="right" class="style1">E-mail</div></td>
<td class="white">
<div align="left">
<?= $email ?>
&nbsp;</div></td>
</tr>
<tr>
<td class="white"><div align="right" class="style1">Telephone</div></td>
<td class="white">
<div align="left">
<?= $telephone ?>
&nbsp;</div></td>
</tr>
<tr>
<td colspan="2" class="white"><div align="center"><a href="logout.php">Logout</a></div></td>
</tr>
</table>
</body>
</html>

------------------------------------------------------------------------------------------------

logout.php

<?
session_start();
unset($_SESSION['session_username']);
session_destroy();
header('Location: index.php');
?>


------------------------------------------------------------------------------------------------

อันนี้ database ชื่อ phpMyAdmin ตารางชื่อ tb_member

create table 'tb_member' (
'ib' int(100) not null auto_increment primary key,
'username' varchar(15) not null,
'password' varchar(15) not null,
'name' varchar(30) not null,
'lastname' varchar(30) not null,
'email' varchar(30) not null,
'telephone' varchar(10) not null,
) engine=myisam;


------------------------------------------------------------------------------------------------

รบกวนช่วยดูให้หน่อยครับว่ามันผิดตรงไหน ผมต้องส่งโปรเจคสิ้นเดือนี้แล้ว
แบบว่าผมมือใหม่อ้ะครับ
รบกวนหน่อยนะครับ

เช็คให้ทีว่ามันผิดตรงไหน



add msn มาบอกก้อได้ครับ [email protected]



Tag : - - - -







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2010-05-06 15:05:49 By : mooaounza View : 651 Reply : 8
 

 

No. 1



โพสกระทู้ ( 178 )
บทความ ( 0 )



สถานะออฟไลน์


Quote:
if($check=mysql_fetch_array($result)){ // ผมมีปันหากับตัวนี้อ่ะงับ //


ผิดแน่ครับ

คุณอยู่ใน เงือนไข if แล้วคุณใช้ = ตัวเดียว มันต้องใช้ ==

แต่ที่จริงเงื่อนไขนี้คุณต้องการอะไรครับ






Date : 2010-05-06 15:33:11 By : kaos
 


 

No. 2



โพสกระทู้ ( 13 )
บทความ ( 0 )



สถานะออฟไลน์


คือต้องการให้มานเช็คว่า user กะ pass ถูกรึป่าวอ่ะงับ

แล้ว connect ผมถูกมั้ยอ่ะครับ
Date : 2010-05-06 15:37:52 By : mooaounza
 

 

No. 3



โพสกระทู้ ( 13 )
บทความ ( 0 )



สถานะออฟไลน์


หน้าที่กรอก สมัครสมาชิกอ่ะครับ กรอกไปแล้วมานไม่ไปหน้า loginlaw อ่ะครับ T_T
Date : 2010-05-06 15:40:58 By : mooaounza
 


 

No. 4



โพสกระทู้ ( 178 )
บทความ ( 0 )



สถานะออฟไลน์


จาก
Quote:
if($check=mysql_fetch_array($result)){ // ผมมีปันหากับตัวนี้อ่ะงับ //
if($check['username']!=""&&$check['password']!=""){
session_start();
$_SESSION[session_username]=$username;
echo "<meta http-equiv=\"refresh\" content=\"0; url=loginlaw.php\">";
}else{
echo "<meta http-equiv=\"refresh\" content=\"1; url=index.php\">";
}

แก้เป็น
Code (PHP)
sql="SELECT * FROM `tb_member` WHERE `username` ='$username' AND `password` = '$password' ";

$result=mysql_db_query($dbname,$sql);
if(mysql_num_rows($result)>0)//จะเช็คว่าที่คุณ select sql ด้าบบน พบ record หรือไหม
{
session_start();
$_SESSION[session_username]=$username;
}
else
{

}

Date : 2010-05-06 15:44:14 By : kaos
 


 

No. 5



โพสกระทู้ ( 13 )
บทความ ( 0 )



สถานะออฟไลน์


เอ่อ มานขึ้นว่า

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\bcbat\chkuser.php on line 15

อ่ะครับ -*-


<?php
include "connect.php";

$username=$_POST[username];
$password=$_POST[password];

if ($username=="" || $password=="")
{
echo "<meta http-equiv=\"refresh\" content=\"1; url=index.php\">";
}else{

$sql="SELECT * FROM `tb_member` WHERE `username` ='$username' AND `password` = '$password' ";

$result=mysql_db_query($dbname,$sql);
if(mysql_num_rows($result)>0)//จะเช็คว่าที่คุณ select sql ด้าบบน พบ record หรือไหม
{
session_start();
$_SESSION[session_username]=$username;
}
else
{


}
}

?>


ขอโทดทีนะครับพอดีไม่ค่อยเปง ขอบคุณมากเลยที่ช่วย
Date : 2010-05-06 15:51:21 By : mooaounza
 


 

No. 6



โพสกระทู้ ( 13 )
บทความ ( 0 )



สถานะออฟไลน์


ผม รบกวนขอ msn พี่ได้มั้ยครับ
Date : 2010-05-06 16:02:23 By : mooaounza
 


 

No. 7



โพสกระทู้ ( 178 )
บทความ ( 0 )



สถานะออฟไลน์


Quote:
$result=mysql_db_query($dbname,$sql);
print mysql_error();

ลองprint ตัวสีแดงหน่อยครับ ได้อะไร
[email protected] ครับ
Date : 2010-05-06 16:08:51 By : kaos
 


 

No. 8



โพสกระทู้ ( 13 )
บทความ ( 0 )



สถานะออฟไลน์


Database Connected.No database selected
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\bcbat\chkuser.php on line 16

ตอนแรกเป็น
Database Connected
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\bcbat\chkuser.php on line 16


อ่ะครับ
Date : 2010-05-06 16:16:46 By : mooaounza
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : รบกวน ช่วยดูให้หน่อยครับ เกี่ยวกับการสมัครสมาชิกครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 01
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2025 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่