|
 |
|
รบกวนช่วยดูโค้ด เช็คการเข้าอ่านบทความให้หน่อยครับ (Access Level) |
|
 |
|
|
 |
 |
|
คือ ในบทความมีการกำหนดว่าต้องเป็นสมาชิกเท่านั้นถึงอ่านได้ กับไม่ได้กำหนดก็อ่านได้ อ่ะครับ
แต่โค้ดที่ผมทำ ในตาราง user มันไปเช็คแค่คนแรกอ่ะครับ ถ้าคนถัดไปล็อกอินเข้ามาอ่าน มันก็ไม่ให้เข้าไปอ่านได้ครับ
โค้ดด้านล่างครับ
โหค้ดหน้าแสดง
if($access==1){
if($_SESSION[username]==$adminuser || $_SESSION[username]==$user){
show_article($counter,$tittle,$writer,$write_date,$write_time,$detail);
}else{ ?>
<center><br><br><h3>คุณไม่สามารถอ่านบทความนี้ได้ กรุณาสมัครสมาชิก</h3><br><br>
<a href="JavaScript:DoCallMain('login/regis.php');"><< สมัครสมาชิก >> </a><br><br></center>
<?php }
}else{
show_article($counter,$tittle,$writer,$write_date,$write_time,$detail);
}
Code (PHP)
$sql = "select * from userinfo ";
$result = mysql_query($sql);
$dbarr=mysql_fetch_array($result,MYSQL_ASSOC);
$user = $dbarr["login_name"];
$sql = "SELECT * FROM admin";
$result=mysql_query($sql);
$dbarr=mysql_fetch_array($result,MYSQL_ASSOC);
$adminuser = $dbarr["username"];
รบกวนช่วยดูให้หน่อยนะครับบบบ
Tag : PHP

|
|
 |
 |
 |
 |
Date :
2011-02-18 17:16:50 |
By :
l3eel2 |
View :
743 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แง้ๆๆๆ ไม่มีคนมาตอบเลยอ่าาาาาา
|
 |
 |
 |
 |
Date :
2011-02-20 14:45:43 |
By :
l3eel2 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 01
|