|
 |
|
มีอีก หนึ่ง ปัญหาแล้วครับ เรื่อง switch mode คือเรื่องเป็นแบบนี้ครับ ผมใช้ คำสั่ง switch mode |
|
 |
|
|
 |
 |
|
ช่วยด้วยครับ มือใหม่หัดเขียน ช่วยที 
|
 |
 |
 |
 |
Date :
2009-10-10 15:51:36 |
By :
aoooza |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เอาคำนี้ ไปวางใน addmember.php
ไว้บนสุดนะ
Code (PHP)
if ( basename($_SERVER['SCRIPT_NAME']) != 'admin.php' )
{
echo 'DIRECT ACCESS IS NOT ALLOWED';
exit;
}
--------
อันนี้ ไฟล์ admin.php
Code (PHP)
<?php
include_once("connection.php");
include("banner.php");
if ( ! isset($_GET['mode']) || trim($_GET['mode']) == '' )
{
echo 'PLEASE SPECIFIC MODE';
exit;
}
$mode=@$_GET["mode"];
?>
<?php
switch($mode)
{
case "addmember":
include("admin/addmember.php");
break;
}
?>
---
หรือ
Code (PHP)
<?php
include_once("connection.php");
include("banner.php");
// ใส่ mode ต่างๆ ในนี้ให้หมด ไม่อย่างนั้น โปรแกรมจะไม่ทำงาน เช่น admin.php?mode=addmember
$modeArray = array('addmember', 'editmember', 'deletemember');
if ( ! in_array($_GET['mode'], $modeArray) )
{
echo 'PLEASE SPECIFIC MODE';
exit;
}
$mode=@$_GET["mode"];
?>
<?php
switch($mode)
{
case "addmember":
include("admin/addmember.php");
break;
}
?>
---
แบบสุดท้าย
Code (PHP)
<?php
include_once("connection.php");
include("banner.php");
$mode=@$_GET["mode"];
?>
<?php
switch($mode)
{
case "addmember":
include("admin/addmember.php");
break;
default:
echo 'PLEASE SPECIFIC MODE';
exit;
break;
}
?>
|
 |
 |
 |
 |
Date :
2009-10-10 17:44:49 |
By :
danya |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
01.<?php
02.
include_once("connection.php");
03.
include("banner.php");
04.
05.
// ใส่ mode ต่างๆ ในนี้ให้หมด ไม่อย่างนั้น โปรแกรมจะไม่ทำงาน เช่น admin.php?mode=addmember
06.
$modeArray = array('addmember', 'editmember', 'deletemember');
07.
08.
if ( ! in_array($_GET['mode'], $modeArray) )
09.
{
10.
echo 'PLEASE SPECIFIC MODE';
11.
exit;
12.
}
13.
$mode=@$_GET["mode"];
14.?>
15.<?php
16.
switch($mode)
17.
{
18.
case "addmember":
19.
include("admin/addmember.php");
20.
break;
21.
}
22.?>
ใช้แค่อันนี้ในหน้า admin ครับได้แล้ว สุดยอดมากครับขอบคุณจริง ๆ เป็นปลื้ม เว็บนี้แล้วก้อ คนในเว็บนี้มาก ครับบ 
|
 |
 |
 |
 |
Date :
2009-10-10 21:16:24 |
By :
aoooza |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|

|
 |
 |
 |
 |
Date :
2009-10-11 08:32:51 |
By :
danya |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 00
|