|
|
|
เราจะแก้ไขให้ User login ที่ขึ้นต้นด้วย (DT= redirect ไป 192.168.1.6 ) ส่วน (TC = redirect ไป 192.168.1.7 ) แก้ยังไงดี |
|
|
|
|
|
|
|
Code (PHP)
if(substr($strUsername,0,2) == "DT")
{
header("location:http://192.168.1.6/");
exit();
}
else if(substr($strUsername,0,2) == "TC")
{
header("location:http://192.168.1.7/");
exit();
}
|
|
|
|
|
Date :
2016-06-13 16:55:07 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ตอบความคิดเห็นที่ : 1 เขียนโดย : mr.win เมื่อวันที่ 2016-06-13 16:55:07
รายละเอียดของการตอบ ::
ลองทดสอบแล้ว ใส่ตรงตำแหน่งด้านล่าง ไม่สามารถใช้ได้ หรือผมใส่ผิดตำแหน่ง
Code (PHP)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>internet hotspot > login</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="expires" content="-1" />
<style type="text/css">
body {color: #737373; font-size: 10px; font-family: verdana;}
textarea,input,select {
background-color: #FDFBFB;
border: 1px solid #BBBBBB;
padding: 2px;
margin: 1px;
font-size: 14px;
color: #808080;
}
a, a:link, a:visited, a:active { color: #AAAAAA; text-decoration: none; font-size: 10px; }
a:hover { border-bottom: 1px dotted #c1c1c1; color: #AAAAAA; }
img {border: none;}
td { font-size: 14px; color: #7A7A7A; }
</style>
</head>
<body>
<table width="100%" style="margin-top: 0%;">
<tr>
<td align="center" valign="middle">
<!--<div class="notice" style="color: #c1c1c1; font-size: 9px">Please log on to use the internet hotspot service<br />$(if trial == 'yes')Free trial available, <a style="color: #FF8080"href="$(link-login-only)?dst=$(link-orig-esc)&username=T-$(mac-esc)">click here</a>.$(endif)</div>--><br />
<table width="800" height="566" border="0" align="center" background="img/BG_login.jpg">
<tr>
<td width="200" height="284"><br />
<br />
<br />
<table width="276" height="194" >
<tr>
<td width="198" height="175" colspan="2" align="center" valign="bottom" bordercolor=""><form name="login" action="$(link-login-only)" method="post"
$(if chap-id) onSubmit="return doLogin()" $(endif)>
<input type="hidden" name="dst" value="if($strUsername,0,2) == "DT")
{
header("location:http://192.168.1.6/");
exit();
}
else if(substr($strUsername,0,2) == "TC")
{
header("location:http://192.168.1.7/");
exit();
}" />
<input type="hidden" name="popup" value="true" />
<br />
<strong>RYU Asset Hotspot</strong>
<table width="311" border="0">
<tr>
<td align="right">User Name</td>
<td><input style="width: 120px" name="username" type="text" value="$(username)"/></td>
</tr>
<tr><td align="right">password</td>
<td><input style="width: 120px" name="password" type="password"/></td>
</tr>
<tr><td> </td>
<td><input type="submit" value="LOGIN" /></td>
</tr>
</table>
</form>
</td>
</tr>
<tr><td height="10" align="center"><h6>Welcome to wireless high-speed internet service.<br />
Please fill in username & password to start using service. <br />
</h6></td></tr>
</table></td>
<td width="155"> </td>
<td width="187"> </td>
</tr>
<tr>
<td height="129"> </td>
<td> </td>
<td> </td>
</tr>
</table>
<br /><div style="color: #c1c1c1; font-size: 9px">Powered by RYU Asset Network Solution</div>
$(if error)<br /><div style="color: #FF8080; font-size: 9px">$(error)</div>$(endif)
</td>
</tr>
</table>
<script type="text/javascript">
<!--
document.login.username.focus();
//-->
</script>
</body>
</html>
|
|
|
|
|
Date :
2016-06-13 21:30:57 |
By :
karurub |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
มันไม่ได้เกี่ยบกับการใส่ตรงไหน มันเกี่ยวกับ
1 คุณไม่ได้วางผังโปรแกรมเอง
2 ไม่ทำความเข้าใจกับโค๊ดเลยไม่รู้อะไรเกี่ยวกับโค๊ดที่คุณมี
3 หรืออ่านแล้วไม่เข้าใจ เพราะคุณไม่มีพืนฐานของไวยกรณ์ของภาษาที่คุณเขียน
ถ้าเป็นข้อ 1
ลองเขียนผังงาน flowchart (ลำดับงาน) เป็นภาษาที่คุณเข้าใจ(ไทย) กำหนดเหตุการณ์ทุกอย่างที่คุณคิดว่ามี ดุก่อน
แล้วเขียน โปรแกรมตาม flow control นั้นๆ
ลำดับการทำงานที่ถูกต้อง
ตรวจสอบข้อมูลเข้า
ถ้า ข้อมูลเป็น 1 ไปทำที่ ........
ถ้า ข้อมูลเป็น 2 ไปทำที่ .........
ถ้าไม่มีข้อมูล ทำ .......
ถ้าเป็น ข้อ2 อ่านโค๊ดที่คุณมี ให้รู้ทางเดินของโปรแกรมให้ได้
ถ้าเป็น ข้อ 3 อ่านไม่เป็น ก็ไปอ่าน document ก่อน ฝึกพื้นฐาน ก่อน
https://www.thaicreate.com/php.html
ลิงค์สำหรับ หัดทำพื้นฐาน อย่ากระโดดข้ามการฝึกพื้นฐาน มาสร้างงานเลยครับ
เหนื่อยกับตัวคุณเอง เพราะคุยกับคนอื่นไม่รู้เรื่อง
|
|
|
|
|
Date :
2016-06-14 06:33:32 |
By :
Chaidhanan |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
โค้ดอยู่ใน router แต่มาถามในหมวด php
คือเดี๋ยวนี้อะไรๆก็ถามในหมวด php หมดเลย
javascript ก็ถามในนี้
อะไรก็ไม่รู้ ก็ถามในนี้ไว้ก่อน
คนตอบก็ไม่รู้ นึกว่า php
คนอื่นที่เข้ามาอ่านก็นึกว่า php ตกลงไม่มีใครได้ประโยชน์อะไรเลย
|
|
|
|
|
Date :
2016-06-30 09:59:25 |
By :
mr.v |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
action="$(link-login-only)" <<-- คืออะไร copy มาจาก hotspot หรอ??
|
|
|
|
|
Date :
2016-06-30 14:19:15 |
By :
dudesaranyu |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ลองไปดักจับที่ 192.168.1.6 ดีกว่าไหม ถ้าไม่ใช่ของตัวเอง ให้ redirect ไป 192.168.1.7 แทน
คือเอา 192.168.1.6 เป็นแม่ข่ายตรวจสอบ
น่าจะง่ายกว่าที่จะไป ยุ่งกับ router
|
|
|
|
|
Date :
2016-06-30 15:04:52 |
By :
Chaidhanan |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
วิธีดักค่าที่ส่งมา
print_r($_SERVER);
|
|
|
|
|
Date :
2016-06-30 16:52:57 |
By :
Chaidhanan |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
เพิ่มเติม
Code (PHP)
echo '<pre>',print_r(array('server'=>$_SERVER,'get'=>$_GET, 'post'=>$_POST,'request'=>$_REQUEST),true),'</pre>';
สังเกตเอาหน่อยครับ ไม่ต้องเอามาลงทั้งหมดบางส่วนมันเป็นความลับของ server ไม่ควรจะโชว์ออกมาง่ายๆ
พอดีรู้ enveronment ของ server หมดใส้หมดพุงกันพอดี
|
|
|
|
|
Date :
2016-07-04 11:27:41 |
By :
Chaidhanan |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|