|
|
|
รบกวนผู้รู้แนะนำการใช้คำสั่ง echo หน่อยครับเพราะในเว้บที่ผมทำไม่ยอมแจ้ง error ครับ |
|
|
|
|
|
|
|
อันนี้เป็นโค๊ดครับ
Code (PHP)
<?
session_start();
//session_destroy();
require_once('Connections/db_connect.php');
if (!isset($_SESSION['mem_user'])) { $MEM_USER = ""; } else { $MEM_USER = $_SESSION['mem_user']; }
$sql = "SELECT * FROM member WHERE mem_user='" .$MEM_USER."'";
//print $sql;
$rs = mysql_query($sql);
$row = mysql_num_rows($rs);
$row=mysql_fetch_array($rs);
$MEM_USER = $row['mem_name'];
//print $MEM_USER;
//mysql_select_db($database_db_connect, $db_connect);
?>
<html>
<head>
<title>O N L I N E C O U R S E :: unlimite learning your self online 24 hr.</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<style type="text/css">
<!--
@import url("mystyle.css");
.style17 { font-family: "ms Sans Serif";
font-weight: bold;
font-size: 16px;
color: #0033FF;
}
.style35 {
font-size: 12;
color: #FF0000;
}
.style36 {
font-family: "ms Sans Serif";
font-weight: bold;
font-size: 14px;
}
.style37 {
font-family: "ms Sans Serif";
font-size: 14px;
}
.style38 {font-size: 16px; color: #0033FF; font-family: "ms Sans Serif";}
.style41 {
font-size: 18px;
color: #0000FF;
font-weight: bold;
}
.style39 {color: #0000FF}
-->
</style>
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>
<script language="JavaScript">
<!--
function Clock() {
window.setTimeout( "Clock()", 1000 );
now = new Date();
localtime = now.toString();
hours = now.getHours();
mins = now.getMinutes();
secs = now.getSeconds();
self.status = hours + ":" + mins + ":" + secs + " ===>Welcome To E-learning ยินดีต้อนรับเข้าสู่ สื่อการเรียนการสอนออนไลน์ วิชาโครงสร้างข้อมูลและอัลกอริทึม<===".toString();
}
Clock();
// -->
</SCRIPT>
<script language="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[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
//-->
</script>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
<body>
<table width="780" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="img/bannergatoon.jpg" width="981" height="200">
<TABLE height=21 cellSpacing=1 cellPadding=0 width="981" bgColor=#FFFFFF border=0>
<!-- จบการเปลี่ยนแปลง -->
<TBODY>
<TR bgColor=#000000>
<TD width=160 height=19 align=center bgcolor="#CC99CC" onclick=mClk(this); onMouseOver="mOvr(this,'#6600FF');" onmouseout=mOut(this);><a href="index.php"><strong>home</strong></a></TD>
<TD width=160 height=19 align=center bgcolor="#CC99CC" onclick=mClk(this); onMouseOver="mOvr(this,'#CC99FF');" onmouseout=mOut(this);><a href="descript.php"><strong>คำอธิบายรายวิชา</strong></a></TD>
<TD width=160 height=19 align=center bgcolor="#CC99CC" onclick=mClk(this); onMouseOver="mOvr(this,'#6699FF');" onmouseout=mOut(this);><a href="courseplan.php"><strong>แผนการเรียน</strong></a></TD>
<TD width=160 height=19 align=center bgcolor="#CC99CC" onclick=mClk(this); onMouseOver="mOvr(this,'#81A765');" onmouseout=mOut(this);><a href="aboutus.php"><strong>ผู้จัดทำ</strong></a></TD>
<TD width=163 height=19 align=center bgcolor="#CC99CC" onclick=mClk(this); onMouseOver="mOvr(this,'#0000FF');" onmouseout=mOut(this);><a href="guestion/index.php"><strong>กระดานข่าว</strong></a></TD>
<TD width=171 height=19 align=center bgcolor="#CC99CC" onclick=mClk(this); onMouseOver="mOvr(this,'#C0C088');" onmouseout=mOut(this);><a href="admin/index.php"><strong>Admin</strong></a> <a class="toolLnk" href="indexstudent.php"></a></TD>
</TR>
</TBODY>
</TABLE></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="80%" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="#F4F4F4"><table width="218" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td background="images/bg_b.gif"><?
$foo = include 'leftmenu.php';
?></td>
</tr>
</table>
</td>
</tr>
<tr>
<td bgcolor="#FFCC99"><h6 align="center" class="style41"> </h6></td>
</tr>
<tr>
<td><table width="100%" height="684" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="73%" height="684" valign="top" background="images/bg_c_s.gif"> </td>
</tr>
</table></td>
</tr>
</table>
<div align="center">
<p><span class="style39"><span class="style37">โรงเรียน .......................................... <br>
พัฒนาโดย.......................................</span></span><span class="style38"><span class="style35"><br>
</span></span><span class="style17"><br>
</span></p>
</div></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table></td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($result);
?>
|
|
|
|
|
Date :
2012-06-14 13:32:52 |
By :
jumloon2005 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
อันนี้เป็นในส่วนของการ login ที่กรอก username password ครับ
รบกวนช่่วยดูนิดหครันึ่งครับ
Code (PHP)
<?
?>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
}
.style1 {
color: #0000FF;
font-weight: bold;
}
.style2 {font-weight: bold}
.style3 {font-weight: bold}
.style5 {color: #0000FF}
.style6 {
color: #333333;
font-weight: bold;
}
-->
</style><table width="218" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" valign="top"><? if(!($MEM_USER)) { ?>
<form name="form1" method="post" action="login.php">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/line_top.gif" width="218" height="19" /></td>
</tr>
</table></td>
</tr>
<tr>
<td><img src="images/member_login.gif" width="218" height="34"></td>
</tr>
<tr>
<td><table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" background="images/line1.gif"><img src="images/line1.gif" width="2" height="2"></td>
</tr>
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td width="42%" height="25"><img src="images/username.gif" width="73" height="22"></td>
<td width="58%" height="25"><input name="MEM_USER" type="text" class="box_txt" id="MEM_USER" size="15"></td>
</tr>
<tr>
<td height="25"><img src="images/password.gif" width="73" height="22"></td>
<td height="25"><input name="MEM_PASS" type="password" class="box_txt" id="MEM_PASS" size="15"></td>
</tr>
<tr>
<td height="25" colspan="2"><div align="center">
<input name="Submit" type="submit" class="button" value="Log in">
</div></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
</table></td>
</tr>
<tr>
<td background="images/line1.gif"><img src="images/line1.gif" width="2" height="2"></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="25" valign="bottom" class="txt_orange">>> <a href="new_member.php">สมัครสมาชิกใหม่</a> >> <a href="forgetpass.php">ลืมรหัสผ่าน</a></td>
</tr>
</table></td>
</tr>
</table>
</form>
<? }else { ?>
<form name="form1" method="post" action="login.php">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
</table></td>
</tr>
<tr>
<td><img src="images/member_login.gif" width="218" height="34"></td>
</tr>
<tr>
<td><table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td valign="top" background="images/line1.gif"><img src="images/line1.gif" width="2" height="2"></td>
</tr>
<tr>
<td><div class="style3"><strong>ยินดีต้อนรับคุณ <? if($MEM_USER!=""){ echo $MEM_USER; }?></strong></div></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>
<p>
<script language="javascript" type="text/javascript">
function logout(){
if(confirm(" ")== true){
window.location="logout.php";
}
}
</script>
</tr>
<tr>
<td background="images/line1.gif"><img src="images/line1.gif" width="2" height="2"></td>
</tr>
</table></td>
</tr>
</table>
<p align="left"><? } ?>
</p>
</form> </td>
</tr>
<tr>
<td background="images/bg_b.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/bg_b.gif" width="218" height="2"></td>
</tr>
</table></td>
</tr>
</table>
|
|
|
|
|
Date :
2012-06-14 13:37:20 |
By :
jumloon2005 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
แล้วเว็บมันทำงานอะไรไม่ได้อ่ะคะ login ไม่ได้หรอค่ะ
ลอง echo ดูว่า ค่าที่รับ POST , GET ในหน้า check การ login นั้น ได้รับ ค่าจากช่องที่กรอกมาจริงหรือไม่อ่ะคะ
แล้วมีค่าอยู่ใน Database จริงหรือไม่ค่ะ
|
|
|
|
|
Date :
2012-06-14 14:12:11 |
By :
sarinya_yaya |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
รู้สึกจะเคยตอบไปแล้วน่ะครับ
|
|
|
|
|
Date :
2012-06-14 15:30:40 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
อาการที่เกิดคือ username กับ passs ค้างอยู่แบบนี้ครับกดอะไรก้ไม่ได้ครับ
รบกวนผู้รู้ ลองตัวอย่างการใช้ echo หน่อยครับ ผมเพิ่งเริ่มเขียนครับขอบคุณครับ
|
|
|
|
|
Date :
2012-06-14 15:30:59 |
By :
jumloon2005 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|