Location: PHPKode > projects > MyOWNSpace > MyOWNspace_v8.2/www/myownfriend.php
<?php
include("header.php");
include "login.inc.php";
include "config.php";
////verifie quon adresse bien un ID pour designer la page
if(isset($_GET['go'])&&($_GET['go']!=""))
{
$go=$_GET['go'];
}
else 
if(isset($_POST['go'])&&($_POST['go']!=""))
{
$go=$_POST['go'];
}
else echo "BAD !!";
////trouve le fichier de conf adequat
$conf_file="myownfriends/friends.".$go.".php";
if (file_exists($conf_file)) 
{
@chmod ($conf_file, 0777);
include $conf_file;
//echo $conf_file;
}
else  {
$fp=@fopen($conf_file, "w");
@chmod ($conf_file, 0777);
$default_friends='<? $myownfriend=array(12,9);?>';
fwrite($fp, $default_friends);
fclose ($fp);
change_update($go);
include $conf_file;
}
$i=$go;
////acces a la page seulement si le user est loggué et proprietaire de la page ID
if(checkauth()&&$myspace[$i]['owner']==$rawuser) {
loged($rawuser);

if (isset($_POST['choose'])) 
{
$code='<? $myownfriend=array(';
while (list($key,$val) = each($myspace)) {
if ($_POST[$key]==1) $code.=$key.',';
}
$code.=');?>';

$fp = @fopen ($conf_file, "w");
fwrite($fp,$code);
fclose ($fp);
change_update($go);
echo '<H4>Saved!</H4><br>';
echo 'Back To <a href="myownfriend.php?go='.$go.'">MyOwnFriends</a>';
}
else
{
//+ MONTRE MES AMIS
$col=1;
echo '<FORM name="choose" action="myownfriend.php" method="POST">
<input type="submit" value="SELECT MY OWN FRIENDS" class="user">';
echo '<table border="1" cellpadding="5" cellspacing="0" width="435">
<tbody><tr>';
while (list($key,$val) = each($myspace)) {
//echo $key;
$checked=0;
echo '<td valign="top"><input type="checkbox" name="'.$key.'" value="1" ';
reset($myownfriend);
while (list($key2,$val2) = each($myownfriend))
{
if ($val2==$key) {echo ' CHECKED';$checked=1;}
//echo "#".$val2."#";
}
echo '><a target="_blank" href="index.php?go='.$key.'">'.$myspace[$key]['artiste'].'</a>&nbsp;
<br><a target="_blank" href="index.php?go='.$key.'"><img ';
if ($checked==1) echo ' border="8"';
echo ' width="80" src="'.$myspace[$key]['image'].'"></a></td>';
if($col<4) {$col++;} else {$col=1;echo'</tr><tr>';}

} 
echo '</tr></table>';
echo'<input type="hidden" name="choose" value="1">
<input type="hidden" name="go" value="'.$go.'"><HR>
<input type="submit" value="SELECT MY OWN FRIENDS" class="user"></FORM>';
}
}
else { 
echo '<H3>View All '.$myspace[$go]['artiste'].'\'s Friends:</H3>';
$view_all=1;
include "showmyownfriends.php"; 
echo '<br><center><a href="/'.$go.'">Back To '.$myspace[$go]['artiste'].'\'s Own Space!</a></center>';
include "footer.php";
}
?>
Return current item: MyOWNSpace