salve a tutti ho un problema quando visualizzo il profilo dell'amico che ho nella mia lista amici mi compare il profilo con i commenti che lui ha inserito, il problema qual'è è che se io clicco per commentare un suo commento mi compare il mio profilo e se scrivo ugualmente il commento quello viene visualizzato nel suo profilo ma se scrivo un nuovo commento sul suo profilo lo mette nel mio, non so se mi sono spiegato?, vorrei che quando commento il post di un altro nel suo profilo o inserisco il commento nel suo profilo vorrei che la pagina rimanesse nel profilo dell'amico interessato ho queste righe:
Codice PHP:
if(isset($_GET['user']) && !empty($_GET['user'])){
$user=$_GET['user'];
} else {
$user=$_SESSION['user_id'];
}
$my_id=$_SESSION['user_id'];
$id_utente = getuser($user, 'id');
$nome = getuser($user, 'nome');
$cognome = getuser($user, 'cognome');
$foto = getuser($user, 'foto');
$username=getuser($user, 'username');
$user_id=getuser($user, 'user_id');
Codice PHP:
if(isset($_POST['submit']))
{
if(empty($_SESSION['content'] ) ||
strcmp($_SESSION['content'], $_POST['content']) != 0)
{
//$errors .= "\n The captcha code does not match!";
}
if(empty($errors))
{
//require_once('connection.php');
$content=$_POST['content'];
$commentid=$_POST['commentid'];
mysql_query("INSERT INTO comment(user_id, nome, cognome, content, foto, comsubid)VALUES('$my_id', '$nome', '$cognome', '$content', '$foto', '$commentid')");
}
}
Codice PHP:
<?php
require_once('connect-inc.php.');
$result3 = mysql_query("SELECT commentid, user_id, nome, cognome, content, comsubid, foto FROM comment WHERE comsubid=0 AND user_id='$id_utente'");
while($row3 = mysql_fetch_array($result3))
{
$id=$row3['commentid'];
echo '<div id="maincomm">';
echo '[img]'.$row3['foto'].'[/img]';
echo '
'.$row3['nome'].'';
echo ''.$row3['cognome'].'';
echo '
'.$row3['content'].'</p>';
echo '<p id="comm">'.'[url="profile2.php?id='.$id.'&#link1"]comment[/url]'.'</p>';
$result4 = mysql_query("SELECT * FROM comment where comsubid='$id'");
while($row4 = mysql_fetch_array($result4))
{
echo '<div id="subcomm">';
echo '[img]'.$row4['foto'].'[/img]';
echo '
'.$row4['nome'].'';
echo ''.$row4['cognome'].'';
echo '
'.$row4['content'].'</p>';
echo '<div class="clearfix"></div>';
echo '</div>';
}
echo '<div class="clearfix"></div>';
echo '</div>';
}
?>
<div class="clearfix"></div>
</div>
<a id="link1">
<form method="POST" name=""
action="profile2.php">
<table width="332" border="0" align="center">
<tr>
<td width="265">
<ul>
<?php
if(!empty($errors)){
echo "<li class='err'>".($errors)."";
}
?>
[/list] </td>
<td width="57"></td>
</tr>
<tr>
<td colspan="2">
<input type="hidden" name="nome" value="<?php echo $nome; ?>" />
<input type="hidden" name="cognome" value="<?php echo $cognome; ?>" />
<input name="commentid" type="hidden" value="<?php echo $_GET['id'] ?>">
Content:
<textarea name="content" style="width: 316px;"></textarea>
</td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Submit" name='submit'></td>
</tr>
</table>
</form>
qualcuno può aiutarmi?, ciao