Location: PHPKode > projects > MyOWNSpace > MyOWNspace_v8.2/www/myownpic.php
<?php
include "login.inc.php";
include("header.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="myownpic/pic.".$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(checkauth()&&$myspace[$i]['owner']==$rawuser) {
loged($rawuser);
echo "<b>".menu_options($go)."</b>";


//+++++++++++++++++++++++++++AJOUT D'UNE IMAGE
if(isset($_POST['add'])){
$n=$_POST['add'];
$i=$_POST['go'];

$conf_file="myownpic/pic.".$i.".php";

include $conf_file;
//echo $conf_file;
$conf_file="myownpic/pic.".$i.".php";

include $conf_file;
$arrayconf='<? $myownpic=array(';
$myownpic[$n]['titre']=$_POST['titre'.$n.''];
$myownpic[$n]['url']=$_POST['url'.$n.''];


for($j=1;$j<=$n;$j++)
{

///**************** PRINT
$arrayconf.='"'.$j.'" => array 
("titre"=>"'.$myownpic[$j]['titre'].'", 
"url"=>"'.$myownpic[$j]['url'].'"), 
';
}

$arrayconf.=') ?>';
//echo '<PRE>'.$arrayconf.'</PRE>';
echo '<H4>Add this to conf file!</H4><br><a href="myownpic.php?pic='.$n.'&go='.$go.'">Back to myownpic</a>';
$fp = @fopen ($conf_file, "w");
fwrite($fp,$arrayconf);
fclose ($fp);
echo '<H4>Saved!</H4><br>';

}


//+++++++++++++++++++++++MODIFICATION D'UNE ENTRéE
else
if(isset($_POST['change'])){
$nb=$_POST['change'];
$array='<? $myownpic=array(';

for($j=1;$j<=count($myownpic);$j++)
{
if($j==$nb){
$myownpic[$j]['titre']=$_POST['titre'];
$myownpic[$j]['url']=$_POST['url'];

}


///**************** PRINT
$array.='"'.$j.'" => array 
("titre"=>"'.$myownpic[$j]['titre'].'", 
"url"=>"'.$myownpic[$j]['url'].'"),
';
}
$array.=');?>';

$fp = @fopen ($conf_file, "w");
fwrite($fp,$array);
fclose ($fp);
echo '<H4>Saved!</H4><br><a href="myownpic.php?go='.$go.'">Back to myownpic!</a><br><br>';

}
else   ////////////// affiche un formulaire de sélection
{

//************************************
 // Start Putting String Together, Starting With Form Tags
$dropmenu = "<p><form name=\"otherpages\" action=\"myownpic.php\" method=\"GET\">\n";
$dropmenu .= "<select name=\"pic\" size=\"1\" class=\"user\" onChange=\"document.otherpages.submit()\">\n";
$p=count($myownpic);
$dropmenu .= "<option value=\"\" selected>MyOwnPics(".$p.")..</option>\n";

for ($i=1;$i<=$p;$i++) {
// Loop Through The Array To Build The String And Drop Down List
$dropmenu .= "<option value=".$i.">".$myownpic[$i]['titre']."</option>\n";
}
// Finish Putting Together The String
$dropmenu .= "</select>&nbsp;\n";
$dropmenu .= "<input type=\"hidden\" name=\"go\" value=\"".$_GET['go']."\"><input type=\"submit\" value=\"GO\" class=\"user\"></FORM>\n"; 
$page= '<H3>Modify TITLE or URL of YourOwnPicture</H3>'.$dropmenu.'<FORM name="clean" action="myownpic.php" method="POST">';
for($i=1;$i<=(count($myownpic));$i++)
{


$array.='"'.$i.'" => array 
("titre"=>"'.$myownpic[$i]['titre'].'", 
"url"=>"'.$myownpic[$i]['url'].'", 

';

$code[$i]= '<img src="'.$myownpic[$i]['url'].'">
<br><font style="line-height:12px; font-size:11px; font-family:verdana,arial,sans-serif;">
<b>'.$myownpic[$i]['titre'].'</b></font></td><td  >
';
}
if($_GET['pic']!="") $n=$_GET['pic'];
else $n=rand(1,(count($myownpic)));



$page .='<br>Title:<input type="text" size="50" name="titre" value="'.$myownpic[$n]['titre'].'"><br>
URL:<input type="text" size="50" name="url" value="'.$myownpic[$n]['url'].'"><br>';
$page .='<span><input type="hidden" name="go" value="'.$go.'" ></span><input type="hidden" name="change" value="'.$n.'">
<input type="submit" value="SAVE YourOwnCHANGE"></FORM><HR>';
echo $page;


echo'<script type="text/javascript" src="http://www.huddletogether.com/projects/lightbox/lightbox.js"></script>
<table width="158" height="" cellspacing="0" cellpadding="0" border="0">
<tr >
<td width="158" height="116" align="left" valign="middle">
<table width="158" height="114" cellspacing="0" cellpadding="0" border="0" bgcolor="#ffffff">
<tr><td>
<a href="'.$myownpic[$n]['url'].'" rel="lightbox" title="'.$myownpic[$n]['titre'].'"><img width="80" src="'.$myownpic[$n]['url'].'"></a>
<br><font style="line-height:12px; font-size:11px; font-family:verdana,arial,sans-serif;">
<b>'.$myownpic[$n]['titre'].'</b></font></td></tr></table>
</td></tr></table>';
}



echo '<hr><H3>Add YourOwnPicture to Gallery !</H3>
<FORM name="add" action="myownpic.php" method="POST">
<br>
Title:<input type="text" size="50" name="titre'.$i.'" ><br>
URL:<input type="text" size="50" name="url'.$i.'" ><br>
<input type="hidden" name="go" value="'.$_GET['go'].'" ><br>

<input type="hidden" name="add" value="'.$i.'">
<input type="submit" value="ADD TO MyOwnPICS!"></FORM>';
}
else { 
$n=$_GET['go'];
$title=$myspace[$n]['titre'];
$myownpic=1;
$view_all=1;

include "showmyownpics.php";

}
include("myowntip.html");
include "footer.php";
?>
Return current item: MyOWNSpace