我用php和MySQL创建了博客,在这个博客里面有管理区 在管理区域只有管理员可以访问 为此,我做了 if 语句:
#!/bin/bash
data=$(find /path/to/directory-1)
archive=/path/to/directory-2
if [ -z "$data" ]; then
echo "No data to archive"
elif [ -n "$data" ]
then
echo "Archiving data"
for i in $data; do
f=${i//\//_}
zip "$(date +"%d-%m-%Y")_$f.zip" $i
mv $(date +"%d-%m-%Y")_$f.zip $archive
done
echo "Archive complete"
else
echo "Error"
fi
问题是:
<块引用>如果不给我一个只制作管理区域的来源,是否是这个来源 对于管理员
谢谢
答案 0 :(得分:0)
试试这个在我的系统上工作
session_start(); //Start the session
define(ADMIN,$_SESSION['name']); //Get the user name from the previously registered super global variable
if(!session_is_registered("admin")){ //If session not registered
header("location:login.php"); // Redirect to login.php page
}
else //Continue to current page
header( 'Content-Type: text/html; charset=utf-8' );
第二个
<?php
if($_SESSION['username'] == 'admin'){ ?>
<a href='administration.php'>Administration Panel</a>
<?php } ?>