在我的会员页面上注销时,我有一些未定义的索引,我希望非注册用户或偶然发现该页面的用户可以查看这些索引。
注意:未定义的变量:第 28 行 /home/fights7/public_html/rawfeeds.co.uk/members.php 中的 userblock
if($userblock==0) { }
和
注意:未定义的索引:第 31 行 /home/fights7/public_html/rawfeeds.co.uk/members.php 中的 id
if($user2_id==$_SESSION['id']){ }
我知道您可以使用 ISSET,但不知道将其放置在其中或周围的何处以使它们按预期工作。
会员.PHP
<?php
require_once"header.php";
require_once"include/load.php";
if(isset($_SESSION['id'])){
$user1_id=$_SESSION['id'];
}
if(isset($data['id'])){
$user2_id=$data['id'];
}
if(isset($user2_id,$user1_id)){
$userblock = user_core::check_block($user2_id, $user1_id);
}
switch($userblock){
case "1":
echo'<div class="userinfo"><hr>You Are Blocked From Viewing This Users Profile<hr></div>';
break;
}
?>
<?
$Members = mysqli_query($mysqli,"SELECT * FROM `users` ORDER BY id");
$numRowsMembers = mysqli_num_rows($Members);
while($row = mysqli_fetch_array($Members)){
$members=user_core::getuser($row['id']);
if($userblock==0){
$user1_id=(isset($_SESSION['id']));
$user2_id=$row['id'];
if(isset($_SESSION['id']) && $user2_id==$_SESSION['id']){
echo '';
}else{
echo'<div class="userinfo"><table border="0"><tr><td>';
echo '<img border=\'0\' src=\'imgs/cropped'.$user2_id.'.jpg\' onerror="this.src=\'img/no_profile_img.jpeg\'" width=\'40\' ><a href="profile.php?username=' .$row['username'] . '">' . $members['fullusersname'] .'</a></tr></td></table>';
?>
<?
$trimmed = trim($row['lives']);
if(!empty($row['lives']))
echo "<b>Lives In:</b> ".$row['lives'];
echo'</div>';
?>
<?
$trimmed = trim(isset($data['work']));
if(!empty($data['work']))
echo "<b>Works at:</b> ".$data['work'];
}
}
}
?>