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,028

HOME > PHP > PHP Forum > login แล้วครั้งแรกไม่แสดงชื่อต้องกดซ้ำ 2 ครั้งถึงจะแสดงชื่อ



 

login แล้วครั้งแรกไม่แสดงชื่อต้องกดซ้ำ 2 ครั้งถึงจะแสดงชื่อ

 



Topic : 008464

Guest




แบบนี้ต้องกด 2 ครั้งถึงจะโชว์ชื่อ

$sql = "SELECT * FROM mtcustomer WHERE Cust_ID ='" . $sCustid . "'";
$table = mysql_query($sql, $con);
if($row = mysql_fetch_array($table)){
$sFname=$row[Cust_Fname];
$sLname=$row[Cust_Lname];
print "<form name='form1' method='post' action='profile_out.php?sOut=yes'>";
print "<img src='images/icon/user.gif' width='16' height='16'>ยินดีต้อนรับ คุณ $sFname $sLname ";
print "<input name='cmdOut' type='submit' id='cmdOut' value='logout'>";
print "</form>";
mysql_close($con);

}else{


อีกแบบกดครั้งเดี๋ยวได้ แต่ถ้าไปหน้าอื่นกลับมาชื่อจะหายต้องแก้อย่างไรคะช่วยบอกด้วยค่ะ


$sql = "SELECT * FROM mtcustomer WHERE Cust_ID ='" . $sCustid . "'";
$table = mysql_query($sql, $con);
if($row != mysql_fetch_array($table)){
$sFname=$row[Cust_Fname];
$sLname=$row[Cust_Lname];
print "<form name='form1' method='post' action='profile_out.php?sOut=yes'>";
print "<img src='images/icon/user.gif' width='16' height='16'>ยินดีต้อนรับ คุณ $sFname $sLname ";
print "<input name='cmdOut' type='submit' id='cmdOut' value='logout'>";
print "</form>";
mysql_close($con);

}else{ [


Tag : - - - -







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 25 พ.ค. 2549 10:33:17 By : นู๋ดา View : 2421 Reply : 5
 

 

No. 1

Guest


เอาโค้ดทั้งหน้ามาให้ดูจิ โค้ดแต่นี้ช่วยอะไรไม่ได้เลย






Date : 25 พ.ค. 2549 13:28:47 By : ปุด
 


 

No. 2

Guest


นี่คะ code


<? /* Chk Login User */
include("include/function.inc");

if ($_POST !=null){
$sData1=$_POST["txtLoginName"];
$sData2=$_POST["txtPass"];
//print $sData1;
//print $sData2;
$con = mysql_connect("localhost", "root", "");
$db = mysql_select_db("mpmktg", $con);
$sql = "SELECT * FROM mtcustomer WHERE Cust_UserLogin ='" . $_POST["txtLoginName"]. "' and Cust_UserPass ='" . $_POST["txtPass"] . "'";
$table = mysql_query($sql, $con);
if ($row = mysql_fetch_array($table)) {
$session_id = "";
for ($i = 0; $i < 10; $i++) {
$session_id = $session_id . rand(0, 9);
}
$custid = $row["Cust_ID"];
$mailN = $row["Cust_Fname"];
$sql = "DELETE FROM tssession WHERE uid='" . $custid . "'";
$table = mysql_query($sql, $con);
$sDate=CurrentDate();
$sTime=CurrentTime();
$sTime=CovTime($sTime);
$sql = "INSERT INTO tssession (uid,sid) VALUES ('" . $custid . "','" . $session_id . "' ,'" . $sDate . "', '" . $sTime . "')";
$table = mysql_query($sql, $con);

setcookie("uid", $custid, time() + 3600);
setcookie("sid", $session_id, time() + 3600);
setcookie("basket", ";", time() + 3600);
setcookie("icount", ";", time() + 3600);
} else {
}
mysql_close($con);
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Pigeon</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a.indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a;}}
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers.document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_nbGroup(event, grpName) { //v6.0
var i,img,nbArr,args=MM_nbGroup.arguments;
if (event == "init" && args.length > 2) {
if ((img = MM_findObj(args[2])) != null && !img.MM_init) {
img.MM_init = true; img.MM_up = args[3]; img.MM_dn = img.src;
if ((nbArr = document[grpName]) == null) nbArr = document[grpName] = new Array();
nbArr[nbArr.length] = img;
for (i=4; i < args.length-1; i+=2) if ((img = MM_findObj(args)) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = img.MM_dn = args[i+1];
nbArr[nbArr.length] = img;
} }
} else if (event == "over") {
document.MM_nbOver = nbArr = new Array();
for (i=1; i < args.length-1; i+=3) if ((img = MM_findObj(args)) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = (img.MM_dn && args[i+2]) ? args[i+2] : ((args[i+1])? args[i+1] : img.MM_up);
nbArr[nbArr.length] = img;
}
} else if (event == "out" ) {
for (i=0; i < document.MM_nbOver.length; i++) {
img = document.MM_nbOver; img.src = (img.MM_dn) ? img.MM_dn : img.MM_up; }
} else if (event == "down") {
nbArr = document[grpName];
if (nbArr)
for (i=0; i < nbArr.length; i++) { img=nbArr; img.src = img.MM_up; img.MM_dn = 0; }
document[grpName] = nbArr = new Array();
for (i=2; i < args.length-1; i+=2) if ((img = MM_findObj(args)) != null) {
if (!img.MM_up) img.MM_up = img.src;
img.src = img.MM_dn = (args[i+1])? args[i+1] : img.MM_up;
nbArr[nbArr.length] = img;
} }
}
//-->
</script>
<link href="StyleSheet.css" rel="stylesheet" type="text/css">
</head>

<body topmargin="0" onLoad="MM_preloadImages('images/Home.gif','images/Home1.gif','images/product1.gif','images/news.gif','images/momtips.gif','images/momtips1.gif','images/gallery.gif','images/gallery1.gif','images/webboard.gif','images/webboard1.gif','images/contact.gif','images/contact1.gif','images/news1.gif')">

<table width="755" border="0" align="center" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="755" height="75" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" background="images/title1.gif">
<!--DWLayoutTable-->
<tr>
<td width="174" height="13"></td>
<td width="512"></td>
<td width="57"></td>
<td width="15" rowspan="2" valign="top"><img src="images/test1%20copy.gif" width="15" height="25"></td>
</tr>
<tr>
<td rowspan="2" valign="top"><img src="images/pigeon_03.gif" width="174" height="56"></td>
<td height="12"></td>
<td rowspan="2" valign="top"><img src="images/pigeon_05.gif" width="57" height="56"></td>
</tr>
<tr>
<td height="50"></td>
<td>&nbsp;</td>
</tr>
</table></td>
</tr>
<tr>
<td height="455" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="">
<!--DWLayoutTable-->
<tr>
<td width="170" rowspan="3" valign="top"><table width="90%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="170" height="455" valign="top"><table border="0" width="170" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td height="22" colspan="2" valign="top"><a href="index.html" target="_top" onClick="MM_nbGroup('down','group1','Home','images/Home.gif',1)" onMouseOver="MM_nbGroup('over','Home','images/Home1.gif','',1)" onMouseOut="MM_nbGroup('out')"><img src="images/Home.gif" alt="" name="Home" width="135" height="22" border="0" onload=""></a></td>
</tr>
<tr>
<td height="22" colspan="2" valign="top"><a href="product.php?model=main&page_no=0"><img name="product" src="images/product1.gif" border="0" alt="" onLoad=""></a></td>
</tr>
<tr>
<td height="16" colspan="2" valign="middle"><img src="images/sub.gif" width="17" height="7"><span class="txd13"><a href="product.php?model=Nip&sub=0&page_no=1">จุกนม</a></span></td>
</tr>
<tr>
<td height="17" colspan="2" class="txd13"><img src="images/sub.gif" width="17" height="7"><span class="txd13"><a href="product2.php?model=Nur&sub=0&page_no=1">ขวดนม</a></span></td>
</tr>
<tr>
<td height="16" colspan="2" valign="middle" class="txd13"><img src="images/sub.gif" width="17" height="7"><span class="txd13"><a href="product3.php?model=Clr&sub=0&page_no=1">ทำความสะอาดจุกนมและขวดนม</a></span></td>
</tr>
<tr>
<td width="18" height="16"></td>
<td width="152" valign="middle" class="txd13"><img src="images/sub.gif" width="17" height="7"><a href="product3.php?model=Clr&sub=As_Clr&page_no=1">อุปกรณ์การทำความสะอาด</a></td>
</tr>
<tr valign="middle">
<td height="16"></td>
<td valign="top" class="txd13"><img src="images/sub.gif" width="17" height="7"><a href="product3.php?model=Clr&sub=liq_Clr&page_no=1">น้ำยาทำความสะอาด</a></td>
</tr>
<tr>
<td height="16" colspan="2" valign="top"><img src="images/sub.gif" width="17" height="7"><span class="txd13"><a href="product.php?model=Ric&sub=0&page_no=1">ผลิตภัณฑ์ป้อนอาหารทารก</a></span></td>
</tr>
<tr>
<td height="16" colspan="2" valign="top"><img src="images/sub.gif" width="17" height="7"><span class="txd13"><a href="product.php?model=Mag&sub=0&page_no=1">ถ้วยหัดดื่ม</a></span></td>
</tr>
<tr>
<td height="16" colspan="2" valign="top"><img src="images/sub.gif" width="17" height="7"><span class="txd13"><a href="product.php?model=Bay&sub=0&page_no=1">ผ้าเช็ดทำความสะอาดผิว</a></span></td>
</tr>
<tr>
<td height="16" colspan="2" valign="middle"><img src="images/sub.gif" width="17" height="7"><span class="txd13"><a href="product7.php?model=Nas&sub=0&page_no=1">ดูแลสุขภาพอนามัย</a></span></td>
</tr>
<tr>
<td height="17" colspan="2" valign="middle"><img src="images/sub.gif" width="17" height="7"><span class="txd13"><a href="product8.php?model=Mom&sub=0&page_no=1">อุปกรณ์การให้นมมารดา</a></span></td>
</tr>
<tr>
<td height="16" colspan="2" valign="middle"><img src="images/sub.gif" width="17" height="7"><span class="txd13"><a href="product.php?model=Saf&sub=0&page_no=1">ดูแลความปลอดภัยภายในบ้าน</a></span></td>
</tr>
<tr>
<td height="16" colspan="2" valign="middle"><img src="images/sub.gif" width="17" height="7"><span class="txd13"><a href="product.php?model=Gif&sub=0&page_no=1">ชุดของขวัญเด็ก</a></span></td>
</tr>
<tr>
<td height="16" colspan="2" valign="middle" class="txd13"><img src="images/sub.gif" width="17" height="7"><span class="txd13"><a href="product.php?model=clo&sub=0&page_no=1">ผ้าอ้อม</a></span></td>
</tr>
<tr>
<td height="16" colspan="2" valign="top" class="txd13"><img src="images/sub.gif" width="17" height="7"><span class="txd13"><a href="product.php?model=sho&sub=0&page_no=1">รองเท้า</a></span></td>
</tr>
<tr>
<td height="16" colspan="2" valign="top"><img src="images/sub.gif" width="17" height="7"><span class="txd13"><a href="product.php?model=Bla&sub=0&page_no=1">ผ้าห่ม</a></span></td>
</tr>
<tr>
<td height="22" colspan="2" valign="top"><a href="news.html" target="_top" onClick="MM_nbGroup('down','group1','news2','images/news.gif',1)" onMouseOver="MM_nbGroup('over','news2','images/news1.gif','',1)" onMouseOut="MM_nbGroup('out')"><img name="news2" src="images/news.gif" border="0" alt="" onLoad=""></a></td>
</tr>
<tr>
<td height="22" colspan="2" valign="top"><a href="momtips.html" target="_top" onClick="MM_nbGroup('down','group1','momtips','images/momtips.gif',1)" onMouseOver="MM_nbGroup('over','momtips','images/momtips1.gif','',1)" onMouseOut="MM_nbGroup('out')"><img name="momtips" src="images/momtips.gif" border="0" alt="" onLoad=""></a></td>
</tr>
<tr>
<td height="22" colspan="2" valign="top"><a href="gallery.html" target="_top" onClick="MM_nbGroup('down','group1','gallery','images/gallery.gif',1)" onMouseOver="MM_nbGroup('over','gallery','images/gallery1.gif','',1)" onMouseOut="MM_nbGroup('out')"><img name="gallery" src="images/gallery.gif" border="0" alt="" onLoad=""></a></td>
</tr>
<tr>
<td height="22" colspan="2" valign="top"><a href="webboard/Webboard.php" target="_top" onClick="MM_nbGroup('down','group1','webboard','images/webboard.gif',1)" onMouseOver="MM_nbGroup('over','webboard','images/webboard1.gif','',1)" onMouseOut="MM_nbGroup('out')"><img name="webboard" src="images/webboard.gif" border="0" alt="" onLoad=""></a></td>
</tr>
<tr>
<td height="22" colspan="2" valign="top"><a href="pigeon.html" target="_top" onClick="MM_nbGroup('down','group1','contact','images/contact.gif',1)" onMouseOver="MM_nbGroup('over','contact','images/contact1.gif','',1)" onMouseOut="MM_nbGroup('out')"><img name="contact" src="images/contact.gif" border="0" alt="" onLoad=""></a></td>
</tr>
<tr>
<td height="4"></td>
<td></td>
</tr>
<tr>
<td height="25" colspan="2" valign="top"><img src="images/report.jpg" width="136" height="25"></td>
</tr>
<tr>
<td height="17" colspan="2" valign="middle"><span class="txd13"><img src="images/plus1.gif" width="7" height="7">
<a href="product.php?model=Ord_main&sub=0&page_no=0">ดูสินค้าในรถเข็ญ</a></span></td>
</tr>
<tr>
<td height="16" colspan="2" valign="middle"><span class="txd13"><img src="images/plus1.gif" width="7" height="7"></span>
<span class="txd13"><a href="checkSt.php">ตรวจสอบสถานะสินค้า</a></span></td>
</tr>
<tr>
<td height="16" colspan="2" valign="middle"><span class="txd13"><img src="images/plus1.gif" width="7" height="7"></span>
<span class="txd13"><a href="member.php">สมัครสมาชิก</a></span></td>
</tr>
<tr>
<td height="17" colspan="2" valign="middle" class="txd13"><span class="txd13"><img src="images/plus1.gif" width="7" height="7"></span>
<a href="forget.php">ลืมรหัสผ่าน</a></td>
</tr>
</table></td>
</tr>
</table></td>
<td width="11" height="1"></td>
<td width="574"></td>
</tr>
<tr>
<td height="35"></td>
<td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="331" height="25" align="right" valign="bottom"><form action="Search.php" method="post" name="form2" class="txd13">
<?
// ค้นหา
// <select name="select1" id="select1">
// <option value="Pro_Name">ชื่อสินค้า</option>
// <option value="Pro_Detail">รายละเอียดสินค้า</option>
// <option value="Pro_Price">ราคาสินค้า</option>
// <option value="Pro_Code">รหัสสินค้า</option>
// </select>
// <input name="textfield3" type="text" size="15">
// <input type="submit" name="Submit" value="Go">
?>
</form></td>
<td width="243" align="right" valign="bottom" class="txd13">
<?
$sCustid=$_COOKIE["uid"];
// print $sCustid;

$con = mysql_connect("localhost", "root", "");
$db = mysql_select_db("mpmktg", $con);
$sql = "SELECT * FROM mtcustomer WHERE Cust_ID ='" . $sCustid . "'";
$table = mysql_query($sql, $con);
$row = mysql_fetch_array($table);
$sFname=$row[Cust_Fname];
$sLname=$row[Cust_Lname];
if($custid="" or $sCustid!="" ){
print "<form name='form1' method='post' action='profile_out.php?sOut=yes'>";
print "<img src='images/icon/user.gif' width='16' height='16'>ยินดีต้อนรับ คุณ $sFname $sLname ";
print "<input name='cmdOut' type='submit' id='cmdOut' value='logout'>";
print "</form>";
mysql_close($con);
}else{

print "<form name='form1' method='post' action='product3.php?model=Clr&sub=0&page_no=1'>";
print "Login ";
print "<input name='txtLoginName' type='text' id='txtLoginName' size='15'>";
print "- ";
print "<input name='txtPass' type='password' id='txtPass' size='8'>";
print "<input name='cmdlogin' type='submit' id='cmdlogin' value='OK'>";
print "</form>";
}
?>
</td>
</tr>
<tr>
<td height="10"></td>
<td></td>
</tr>
</table></td>
</tr>
<tr>
<td height="455">&nbsp;</td>
<td valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="574" height="419" align="left" valign="top">
<?
ob_start();
/* Show Detail Data */
$sType = $_GET['model'];
$spage_no = $_GET['page_no'];
$sSub_no = $_GET['sub'];
//print $sType;
//print $spage_no;
if ( $sType == "main" OR $spage_no == "0" ){

}else{
print "<iframe src='detail.php?where=" . $sType . "&SubWhere=" . $sSub_no . "&pnod=" . $spage_no . "' frameborder='NO' width='560' scrolling='NO' height='1550'></iframe>";
}
//print "<iframe src='detail.php?where=" . $sType . "&pnod=" . $spage_no . "' frameborder='NO' width='560' scrolling='NO' height='1400'></iframe>";

?>
<p>&nbsp;</p></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
<tr>
<td height="22" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" background="images/line1.gif">
<!--DWLayoutTable-->
<tr>
<td width="755" height="5"></td>
</tr>
<tr>
<td height="17" valign="bottom" class="txd12"><div align="center">บริษัท
มุ่งพัฒนามาร์เก็ตติ้ง จำกัด</div></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>

Date : 25 พ.ค. 2549 14:53:20 By : นู๋ดา
 

 

No. 3

Guest


$sql = "SELECT * FROM mtcustomer WHERE Cust_UserLogin ='" . $_POST["txtLoginName"]. "' and Cust_UserPass ='" . $_POST["txtPass"] . "'";
$table = mysql_query($sql, $con);
$num=mysql_num_rows($table);
if($num>0){
echo "<meta http-equiv='refresh' content='0;URL=หน้าที่ต้องการ.php'>";
}else{
echo "<meta http-equiv='refresh' content='0;URL=หน้าที่ต้องการ.php'>"
}
Date : 26 พ.ค. 2549 09:42:33 By : นิจัง
 


 

No. 4

Guest


ขอบคุณนะคะ
Date : 26 พ.ค. 2549 11:00:13 By : นู๋ดา
 


 

No. 5

Guest


$sql = "SELECT * FROM mtcustomer WHERE Cust_UserLogin ='" . $_POST["txtLoginName"]. "' and Cust_UserPass ='" . $_POST["txtPass"] . "'";

แบบนี้โดน sql injection นะครับ
Date : 28 พ.ค. 2549 07:14:15 By : baby
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : login แล้วครั้งแรกไม่แสดงชื่อต้องกดซ้ำ 2 ครั้งถึงจะแสดงชื่อ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ 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 05
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่