在 Wordpress Multisite 上,我试图在他的权限级别(permID)和他的网站(virkID)之后重定向用户。因此,如果是来自站点 A 的普通用户,他们将被重定向到具有权限级别 3 的站点 A。
我在自定义登录页面上有此代码:
<?php if(isset($_POST['submitlogin']))
{
$brugerUsername=$_POST['brugerUsername'];
$brugerPassword=$_POST['brugerPassword'];
$sql="SELECT * FROM virksomheder
INNER JOIN brugere ON virksomheder.virkID = brugere.virkID
WHERE brugerUsername = '$brugerUsername' and brugerPassword = '$brugerPassword'";
$result=mysql_query($sql);
if(mysql_num_rows($result) > 0)
{
while($row = mysql_fetch_array($result))
{
$_SESSION['brugerUsername']=$_POST['brugerUsername'];
$_SESSION['brugerPassword']=$_POST['brugerPassword'];
$_SESSION['permID']=$row['permID'];
$_SESSION['virkID']=$row['virkID'];
$_SESSION['virkNavn']=$row['virkNavn'];
$_SESSION['virkUrl']=$row['virkUrl'];
$_SESSION['holdID']=$row['holdID'];
$_SESSION['brugerID']=$row['brugerID'];
$_SESSION['brugerCpr']=$row['brugerCpr'];
$_SESSION['brugerNavn']=$row['brugerNavn'];
$_SESSION['brugerAfd']=$row['brugerAfd'];
$_SESSION['display_name']=$row['display_name'];
$_SESSION['hoejde']=$row['hoejde'];
$_SESSION['vaegtstart']=$row['vaegtstart'];
$_SESSION['bmistart']=$row['bmistart'];
$_SESSION['vaegtslut']=$row['vaegtslut'];
$_SESSION['bmislut']=$row['bmislut'];
$_SESSION['vaegtnu']=$row['vaegtnu'];
$_SESSION['bminu']=$row['bminu'];
//REDIRECT USER WHERE virkID = '$virkID'
/*<META http-equiv="refresh" content="0;URL=<?php $row['virkUrl']; ?>/status/"> */
if (($row['permID'] == '3') and ($row['virkID'] == '1')){
?>
<META http-equiv="refresh" content="0;URL=http://mahogni.com/afs/status/">
<?php
}
if ($row['permID'] == '2'){
?>
<META http-equiv="refresh" content="0;URL=http://mahogni.com/afs/coachsite/">
<?php
}
if ($row['permID'] == '1'){
?>
<META http-equiv="refresh" content="0;URL=http://mahogni.com/afs/adminsite/">
<?php
}
}
}
else
{
echo "<tr>";
echo "<td colspan='2' height='45'>";
echo "Ups! not correct";
echo "</td>";
echo "</tr>";
}
}
?>
谁能告诉我它是怎么做的??谢谢