"changeUserRole"アクションは、私をlocalhostに誘導します... myproject/index.phpではなくxampp index.php?setting =ユーザーリスト。 異なる設定で別のファイルに同じテクニックを実装したのはなぜか分かりません。PHPリンクパラメータは、それが想定されているスクリプトを実行する代わりにlocalhost/xamppにつながります
リダイレクト先のファイルはaction_changeuserrole.phpです。これはSQLクエリを実行し、パラメータなしでこのファイルにリダイレクトされます。
function showUserlistManagement() {
if (@$_GET['action'] == "addUser") {
require_once('actions/userlist/adduser.php');
}
else if (@$_GET['action'] == "changeUserRole") {
require_once('actions/userlist/action_changeuserrole.php');
}
else {
echo "<a href='?setting=userlist&action=addUser'><button>Add User</button></a>";
$i = 0;
$sql = "SELECT doctorID, username, isAdmin FROM doctor ORDER BY isAdmin DESC";
$result = query($sql);
echo "<table border='1'>";
while ($row = mysql_fetch_array($result)) {
$i = $i + 1;
echo "<tr><td>" . $i . "</td><td>" . $row['username'] . "</td><td>" . isAdminText($row['isAdmin']) . "</td><td><a href='?setting=userlist&action=changeUserRole&userID=" . $row['doctorID'] . "&userRole=" . $row['isAdmin'] . "'><button>" . changeUserRoleButton($row['isAdmin']) . "</button></a></td></tr>";
}
}
function isAdminText($isAdmin) {
if ($isAdmin) {
return "admin";
}
else return "user";
}
function changeUserRoleButton($isAdmin) {
if ($isAdmin) {
return 'Demote';
}
else return 'Promote';
}
}
action_changeuserrole.phpファイル:
<?php
//$sql = "UPDATE doctor SET (isAdmin = '1') WHERE doctorID = " . $_GET['userID'];
//$result = query($sql);
?>
<meta http-equiv='refresh' content='0; URL=../../index.php?setting=userlist'>
あなたはmyprojectに**「** ../../**」にあなたを導くん必ずご上位ディレクトリのリンクです**フォルダ –
はい、私は他のフォルダではなく、私が使っているのと同じレベルで多くのファイルを持っていますこのリダイレクト。このファイルの問題だと思うのですが、 – hermann
なぜヘッダーのリダイレクトではなくメタリフレッシュを使用しますか? – dqhendricks