나는이 프로젝트를 인터넷 어딘가에서 다운로드 했으니 &은 좋은 페이지에 액세스하려고 시도했다. 하지만 욕망 프로파일에 로그인 한 후에는 내가 해결할 수없는 오류가 많이 발생합니다. 아무도 나를 도울 수로그인 후 PHP 정의되지 않은 색인 오류
오류 페이지의 스크린 샷. 오류를
friends.php을 제공
페이지
<?php
if(!isset($_SESSION)){
session_start();
}
include("profilesql.php");
$result = mysql_query("SELECT * FROM addfriends where meid='$_SESSION[stuid]' ");
while($row = mysql_fetch_array($result))
{
$uid1[$i] = $row["friendid"];
$i++;
}
$acrec1 = mysql_query("SELECT * FROM addfriends WHERE userid='$uid1[1]'");
while($row = mysql_fetch_array($acrec2))
{
$img1[0]= $row["image"];
}
$acrec2 = mysql_query("SELECT * FROM addfriends WHERE userid='$uid1[2]'");
while($row = mysql_fetch_array($acrec2))
{
$img1[1]= $row["image"];
}
$acrec3 = mysql_query("SELECT * FROM profile WHERE userid='$uid1[3]' ");
while($row = mysql_fetch_array($acrec3))
{
$img1[2]= $row["image"];
}
$acrec4 = mysql_query("SELECT * FROM profile WHERE userid='$uid1[4]' ");
while($row = mysql_fetch_array($acrec4))
{
$img1[3]= $row["image"];
}
?>
profile.php
<?php
include("header.php");
include("profilesql.php");
include("friends.php");
?>
<center>
<div class=container>
<div class=container>
<!-- head --><!-- navigation menu -->
<?php include("head.php"); ?>
<?php
include("menu.php");
$result = mysql_query("SELECT * FROM profile ORDER BY RAND()");
$i=0;
while($row = mysql_fetch_array($result))
{
if($row["userid"] != $_SESSION["stuid"])
{
$img[$i] = $row["image"];
$uid[$i] = $row["userid"];
$i++;
}
}
$result = mysql_query("SELECT * FROM stuacc where id");
$strec = mysql_query("SELECT * FROM stuacc WHERE email='$_SESSION[logid]' ");
while($row = mysql_fetch_array($strec))
{
$_SESSION["stuid"] = $row["id"];
}
$colrec = mysql_query("SELECT * FROM profile WHERE userid='$_SESSION[stuid]' ");
while($row = mysql_fetch_array($colrec))
{
$cname = $row["coluni"];
}
$acrec1 = mysql_query("SELECT * FROM stuacc WHERE id='$uid[0]' ");
while($row = mysql_fetch_array($acrec1))
{
$stid1 = $row["id"];
$name1 = $row["firstname"];
$gen1= $row["iam"];
}
$acrec2 = mysql_query("SELECT * FROM stuacc WHERE id='$uid[1]' ");
while($row = mysql_fetch_array($acrec2))
{
$stid2 = $row["id"];
$name2 = $row["firstname"];
$gen2= $row["iam"];
}
$acrec3 = mysql_query("SELECT * FROM stuacc WHERE id='$uid[2]' ");
while($row = mysql_fetch_array($acrec3))
{
$stid3 = $row["id"];
$name3 = $row["firstname"];
$gen3= $row["iam"];
}
$acrec4 = mysql_query("SELECT * FROM stuacc WHERE id='$uid[3]' ");
while($row = mysql_fetch_array($acrec4))
{
$stid4 = $row["id"];
$name4 = $row["firstname"];
$gen4= $row["iam"];
}
?>
<div style="padding: 10px; text-align: left;">
<!-- body content -->
<table width="100%" height="382" border="0" >
<tr>
<td width="16%" rowspan="9" align="left" valign="top" bgcolor="#CCCCCC"><?php include("profileleft.php"); ?></td>
<td width="55%" rowspan="9" valign="top"><table width="100%" border="1">
<tr>
<th scope="col"><strong>Welcome, <?php echo $_SESSION["logid"]; ?></strong></th>
</tr>
<tr>
<td><strong>Number of visitors:
<?php
if(isset($_SESSION['views']))
$_SESSION['views']=$_SESSION['views']+1;
else
$_SESSION['views']=1;
echo $_SESSION['views'];
?>
</strong></td>
</tr>
<tr>
<td><strong>College Name : </strong><b><?php echo $cname ; ?></b></td>
</tr>
<tr>
<td> </td>
</tr>
</table>
<table width=100%>
<tr valign=top align=center>
<td colspan="4" align="left"><strong>Request Friends</strong></td>
</tr>
<tr valign=top align=center>
<td><a href="friendsprofile.php?fid=<?php echo $stid1 ; ?>"><img src="<?php echo $img[0] ; ?>" width="100" height="150" border="0" alt=""><br />
<?php echo $name1 ; ?><br />
</a><br></td>
<td><a href="friendsprofile.php?fid=<?php echo $stid2 ; ?>""><img src="<?php echo $img[1] ; ?>" width="100" height="150" border="0" alt=""><br />
<?php echo $name2 ; ?>
</a><br></td>
<td><a href="friendsprofile.php?fid=<?php echo $stid3 ; ?>""><img src="<?php echo $img[2] ; ?>" width="100" height="150" border="0" alt=""><br />
<?php echo $name3 ; ?>
</a><br></td>
<td><a href="friendsprofile.php?fid=<?php echo $stid4 ; ?>""><img src="<?php echo $img[3] ; ?>" width="100" height="150" border="0" alt=""><br />
<?php echo $name4 ; ?>
</a><br></td>
</tr>
</table>
<table width="100%" border="1">
<tr>
<th colspan="2" scope="col"><br /> <?php echo $fname. " " . $lname; ?></th>
</tr>
<tr>
<td colspan="2"><strong>College Name : </strong><b><?php echo $cname ; ?></b></td>
</tr>
<tr>
<td width="51%"><strong>City :<?php echo $_GET["fmes"]; ?></strong></td>
<td width="49%"><?php echo $city; ?></td>
</tr>
<tr>
<td height="23"><strong>State:</strong></td>
<td><?php echo $state; ?></td>
</tr>
<tr>
<td height="23"><strong>Pincode:</strong></td>
<td><?php echo $pincode; ?></td>
</tr>
<tr>
<td height="23"><strong>Country:</strong></td>
<td><?php echo $country; ?></td>
</tr>
</table></td>
<td height="23" colspan="2" background="" bgcolor="#CCCCCC"><strong><u>My friends</u></strong></td>
</tr>
<tr>
<td width="14%" height="23" bgcolor="#CCCCCC" align="center" valign="top"><img src="<?php echo $img[0] ; ?>" alt="" width="71" height="53" /></td>
<td width="15%" height="23" bgcolor="#CCCCCC" align="center" valign="top"><img src="<?php echo $img[1] ; ?>" alt="" width="71" height="53" /></td>
</tr>
<tr>
<td height="4" align="center" valign="top" bgcolor="#CCCCCC"><img src="<?php echo $img[2] ; ?>" alt="" width="71" height="53" /><br />
<br /></td>
<td height="4" bgcolor="#CCCCCC" align="center" valign="top"><img src="<?php echo $img[3] ; ?>" alt="" width="71" height="53" /></td>
</tr>
<tr>
<td height="21" colspan="2" align="center" valign="top" bgcolor="#CCCCCC"><strong><a href="viewall.php">View all</a></strong></td>
</tr>
<tr>
<td height="36" bgcolor="#CCCCCC" align="center"><img src="images/alosious.jpg" alt="" width="77" height="75" /></td>
<td height="36" bgcolor="#CCCCCC" align="center"><img src="images/alvas.jpg" alt="" width="96" height="96" /></td>
</tr>
<tr>
<td height="36" bgcolor="#CCCCCC" align="center"><img src="images/canara.jpg" alt="" width="78" height="78" /></td>
<td height="36" bgcolor="#CCCCCC"><img src="images/dhavala.jpg" alt="" width="96" height="74" /></td>
</tr>
<tr>
<td colspan="2" bgcolor="#CCCCCC" align="center"><strong>View all</strong></td>
</tr>
<tr>
<td colspan="2" bgcolor="#CCCCCC"><strong><u>Advertisement</u></strong></td>
</tr>
<tr>
<td colspan="2" bgcolor="#CCCCCC" align="center" ><a href="http://www.admissionopen.com/" ><img src="images/advt.jpg" width="173" height="185" /></a></td>
</tr>
</table>
</div>
<center>
<?php include("footer.php"); ?>
는 분명 오류가'$ _SESSION은 [stuid]'설정되지 않았 음을 보여줍니다. '$ _SESSION [ 'stuid']' –
으로 설정하려고 시도한다. 세션이 설정되지 않았는지 검사 중이지만'session_start();'가 맨 위에 있어야한다. 당신은 그때 당신이 지금하고있는 방식이 아니라 그 이후에 당신의 상태를 설정할 것입니다. 또한 모든 파일에 있어야합니다. –
이 도움말을 확인하십시오. http://stackoverflow.com/questions/4261133/php-notice-undefined-variable-and-notice-undefined-index –