Location: PHPKode > projects > MyOWNSpace > MyOWNspace_v8.2/www/myownennemies.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)) 
{
include $conf_file;
//echo $conf_file;
}
else  @fopen($conf_file, "w");
$i=$go;
////acces a la page seulement si le user est loggué et proprietaire de la page ID
if(checklogin()&&$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);
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;
echo '<td valign="top"><input type="checkbox" name="'.$key.'" value="1" ';
reset($myownfriend);
while (list($key2,$val2) = each($myownfriend))
{
if ($val2==$key) echo ' CHECKED';
//echo "#".$val2."#";
}
echo '><a target="_blank" href=?go='.$key.'">'.$myspace[$key]['artiste'].'</a>&nbsp;
<br><a href=?go='.$key.'"><img 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>';
}
}
?>
Return current item: MyOWNSpace