myprofile.php ma mi prende l'id ma la pagina è quella dell'account loggiato e non quella dell'account dell'id che mi prende l'struzione :
echo "<a href=\"myprofile.php?id=$user_id\">".$joke_ut['user_name']."</a><br />";
Vi posto il codice ...
echo "<a href=\"myprofile.php?id=$user_id\">".$joke_ut['user_name']."</a><br />";
Vi posto il codice ...
PHP:
<?php
include 'dbc.php';
page_protect();
?>
<html>
<head>
<title>My Account</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="styles.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="5" class="main">
<tr>
<td colspan="3"> </td>
</tr>
<tr>
<td width="160" valign="top">
<?php
/*********************** MYACCOUNT MENU ****************************
This code shows my account menu only to logged in users.
Copy this code till END and place it in a new html or php where
you want to show myaccount options. This is only visible to logged in users
*******************************************************************/
if (isset($_SESSION['user_id'])) {?>
<div class="myaccount">
<p><strong>My Account</strong></p>
<a href="myaccount.php">My Account</a><br>
<a href="mysettings.php">Settings</a><br>
<a href="logout.php">Logout </a>
<p>You can add more links here for users</p></div>
<?php }
if (checkAdmin()) {
/*******************************END**************************/
?>
<p> <a href="admin.php">Admin CP </a></p>
<?php } ?>
<p> </p>
<p> </p>
<p> </p></td>
<td width="732" valign="top"><p> </p>
<h3 class="titlehdr">Welcome <?php echo $_SESSION['user_name'];?></h3>
<?php
if (isset($_GET['msg'])) {
echo "<div class=\"error\">$_GET[msg]</div>";
}
?>
<p>This is the my account page</p>
<?php echo $_SESSION[''];?>
<br />
<br />
<br />
<?php
$id_u=$_SESSION['user_id'];
$query = "SELECT * FROM annunci AS p WHERE p.user_id = '$id_u' OR p.user_id IN (SELECT user_1 FROM relationship AS r WHERE r.user_2 = '$id_u' AND r.amico = 'S') OR p.user_id IN (SELECT user_2 FROM relationship AS r WHERE r.user_1 = '$id_u' AND r.amico = 'S')";
$ris=mysql_query($query);//*******!!!!!!!!!!!!*******non vedo questa istruzione
while ($joke = mysql_fetch_array($ris)) {
$rich=$joke['user_id'];
$query_ut=mysql_query("SELECT * FROM users WHERE id=$rich");//non so come si chiama esattamente il campo id in user
//verifica e correggi eventualmente
$joke_ut=mysql_fetch_array($query_ut);
$user_id = $joke['user_id'];
$user_name = $joke['user_name'];
$commento = $joke['commento'];
echo "<a href=\"myprofile.php?id=$user_id\">".$joke_ut['user_name']."</a><br />";
echo "$commento<br /><br />";
}
?>
</td>
<td width="196" valign="top"> </td>
</tr>
<tr>
<td colspan="3"> </td>
</tr>
</table>
</body>
</html>