Location: PHPKode > projects > MyOWNSpace > MyOWNspace_v8.2/www/images/myownadmin.php
<?php
include "header.php";
include "login.inc.php";
//include "userspace.php";
include "config.php";
	if(checklogin()) {


loged($rawuser);
 // Start Putting String Together, Starting With Form Tags
$dropmenu = "<p><form name=\"otherpages\" action=\"myownadmin.php\" method=\"GET\">\n";
$dropmenu .= "<select name=\"go\" size=\"1\" class=\"user\" onChange=\"document.otherpages.submit()\">\n";

for($i=1;$i<=count($myspace);$i++)
{
if ($myspace[$i]['owner']==$rawuser) {
//echo $i."-".$myspace[$i]['artiste']."<br>";
$dropmenu .= "<option value=".$i.">".$myspace[$i]['artiste']." - ".$myspace[$i]['titre']."</option>\n";
}
}
$dropmenu .= "</select>&nbsp;\n";
$dropmenu .= "<input type=\"submit\" value=\"GO\" class=\"user\">"; 

echo $dropmenu."</FORM>";

echo "<hr><H4><a href=\"myownadmin.php?add\">Create a new page</a></H4><hr>";
//+++++++++++++++++++++++
if(isset($_POST['change'])){
echo "GUEST:".$_POST['guestbook'];
$nb=$_POST['change'];
$array='<? $myspace=array(';
for($i=1;$i<=count($myspace);$i++)
{
if($i==$nb){
$owner[$i]=$_POST['owner'];
$pic[$i]=clean($_POST['image']);
$artiste[$i]=clean($_POST['artiste']);
$title[$i]=clean($_POST['title']);
$urll[$i]=clean($_POST['pls']);
$contact[$i]=clean($_POST['contact']);
$web[$i]=clean($_POST['web']);
$def[$i]=clean($_POST['def']);
$label[$i]=clean($_POST['label']);
$image[$i]=clean($_POST['image']);
$date[$i]=clean($_POST['date']);
$bgcolor[$i]=$_POST['bgcolor'];
$bgpic[$i]=$_POST['bgpic'];
$guestbook[$i]=$_POST['guestbook'];

}
else{
$owner[$i]=$myspace[$i]['owner'];
$pic[$i]=$myspace[$i]['image'];
$artiste[$i]=$myspace[$i]['artiste'];
$title[$i]=$myspace[$i]['titre'];
$urll[$i]=$myspace[$i]['pls'];
$contact[$i]=$myspace[$i]['contact'];
$web[$i]=$myspace[$i]['web'];
$def[$i]=$myspace[$i]['def'];
$label[$i]=$myspace[$i]['label'];
$image[$i]=$myspace[$i]['image'];
$date[$i]=$myspace[$i]['date'];
$bgcolor[$i]=$myspace[$i]['bgcolor'];
$bgpic[$i]=$myspace[$i]['bgpic'];
$guestbook[$i]=$myspace[$i]['guestbook'];
}
///**************** PRINT
$array.='"'.$i.'" => array 
("owner"=>"'.$owner[$i].'",
"titre"=>"'.$title[$i].'", 
"artiste"=>"'.$artiste[$i].'", 
"label"=>"'.$label[$i].'",
"contact"=>"'.$contact[$i].'",
"image"=>"'.$pic[$i].'",
"pls"=>"'.$urll[$i].'",
"web"=>"'.$web[$i].'",
"def"=>"'.$def[$i].'",
"date"=>"'.$date[$i].'",
"bgcolor"=>"'.$bgcolor[$i].'",
"bgpic"=>"'.$bgpic[$i].'",
"guestbook"=>"'.$guestbook[$i].'"),
';
}
$array.=');?>';

$fp = fopen ("config.php", "w");
fwrite($fp,$array);
fclose ($fp);
echo '<H4>Saved!</H4><br><a href="myownadmin.php">Back to MyOwnAdmin</a>';

}
///==============================================================
if(isset($_GET['go']))

{
$i=$_GET['go'];
$owner[$i]=$myspace[$i]['owner'];
$pic[$i]=$myspace[$i]['image'];
$artiste[$i]=$myspace[$i]['artiste'];
$title[$i]=$myspace[$i]['titre'];
$urll[$i]=$myspace[$i]['pls'];
$contact[$i]=$myspace[$i]['contact'];
$web[$i]=$myspace[$i]['web'];
$def[$i]=$myspace[$i]['def'];
$label[$i]=$myspace[$i]['label'];
$image[$i]=$myspace[$i]['image'];
$guestbook[$i]=$myspace[$i]['guestbook'];
$bgcolor[$i]=$myspace[$i]['bgcolor'];
if($bgcolor[$i]=="") $bgcolor[$i]="#FFFFFF";
$bgpic[$i]=$myspace[$i]['bgpic'];
$date=date("j-M-Y");
$page.= '<form name="change" action="myownadmin.php" method="POST"><div>

<span><b>Album or page title:</b><br><input size="100" type="text" name="title" value="'.$title[$i].'"></span><br>
<span><b>Artiste name:</b><br><input size="100" type="text" name="artiste" value="'.$artiste[$i].'"></span><br>
<span><b>Short Definition:</b><br><input size="100" type="text" name="def" value="'.$def[$i].'"></span><br><br>
<span><b>Label name:</b><br><input size="50" type="text" name="label" value="'.$label[$i].'"></span><br>
<span><b>URL of the artist or label homepage:</b><br><input size="100" type="text" name="web" value="'.$web[$i].'"></span><br>
<span><b>Email contact:</b><br><input size="50" type="text" name="contact" value="'.$contact[$i].'"></span><br>
<hr><span><b>MP3 Playlist <br>
&nbsp;- Enter a link to a web page. Webjay will find any songs in the page<br>
&nbsp;- or URL of a Webjay XSPF playlist <small>(<a href="playlist.php">How does it work?</a>)</small></b><br>
<input size="100" type="text" name="pls" value="'.$urll[$i].'"></span><br>
<span><input size="10" type="hidden" name="date" value="'.$date.'"></span><br><br><hr>
<span><b>Picture:</b><br><img src="'.$image[$i].'" width="100"></span><br>
<span><input size="50" type="text" name="image" value="'.$image[$i].'"></span>
<script language="JavaScript" src="classes/pcjscolorchooser.js"></script>
<hr>
<span>Couleur de fond: <input id="bgcolor" type="text" name="bgcolor" value="'.$bgcolor[$i].'">
<input id="bgbutton" type="button" value="Choisir la couleur" onClick="PcjsColorChooser(\'bgbutton\', \'bgcolor\')"><br>
</span>
<span>Image de fond: (http://) <input id="bgpic" type="text" name="bgpic" value="'.$bgpic[$i].'"></span>
';
if ($bgpic[$i]!="") $page.= '<span><img src="'.$bgpic[$i].'" height="25"></span>';
$page.= '</div><HR>';

$page.= '<span><b>Guestbook!<BR>&nbsp;<input type="checkbox" name="guestbook" value="1" ';
if($guestbook[$i]=="1") $page.='CHECKED';
$page .='>Allow user to post comments</b><br>
<input type="hidden" name="change" value="'.$i.'">
<input type="hidden" name="owner" value="'.$rawuser.'">';
$page.= '<hr><input type="submit" value="SAVE CHANGES"></FORM>';
echo $page;
}



//+++++++++++++++++++++++++++ADD
if(isset($_POST['add'])){


$array='<? $myspace=array(';
for($i=1;$i<=count($myspace);$i++)
{
$owner[$i]=$myspace[$i]['owner'];
$pic[$i]=$myspace[$i]['image'];
$artiste[$i]=$myspace[$i]['artiste'];
$title[$i]=$myspace[$i]['titre'];
$urll[$i]=$myspace[$i]['pls'];
$contact[$i]=$myspace[$i]['contact'];
$web[$i]=$myspace[$i]['web'];
$def[$i]=$myspace[$i]['def'];
$label[$i]=$myspace[$i]['label'];
$image[$i]=$myspace[$i]['image'];
$date[$i]=$myspace[$i]['date'];
$bgcolor[$i]=$myspace[$i]['bgcolor'];
$bgpic[$i]=$myspace[$i]['bgpic'];
$array.='"'.$i.'" => array 
("owner"=>"'.$owner[$i].'",
"titre"=>"'.$title[$i].'", 
"artiste"=>"'.$artiste[$i].'", 
"label"=>"'.$label[$i].'",
"contact"=>"'.$contact[$i].'",
"image"=>"'.$pic[$i].'",
"pls"=>"'.$urll[$i].'",
"web"=>"'.$web[$i].'",
"def"=>"'.$def[$i].'",
"date"=>"'.$date[$i].'",
"bgcolor"=>"'.$bgcolor[$i].'",
"bgpic"=>"'.$bgpic[$i].'"),
';
}
//$i=$_POST['add'];
$owner[$i]=$_POST['owner'];
$pic[$i]=clean($_POST['image'.$i.'']);
$artiste[$i]=clean($_POST['artiste'.$i.'']);
$title[$i]=clean($_POST['title'.$i.'']);
$urll[$i]=clean($_POST['pls'.$i.'']);
$contact[$i]=clean($_POST['contact'.$i.'']);
$web[$i]=clean($_POST['web'.$i.'']);
$def[$i]=clean($_POST['def'.$i.'']);
$label[$i]=clean($_POST['label'.$i.'']);
$image[$i]=clean($_POST['image'.$i.'']);
$date[$i]=clean($_POST['date'.$i.'']);
$bgcolor[$i]=clean($_POST['bgcolor']);
$bgpic[$i]=clean($_POST['bgpic']);
$array.='"'.$i.'" => array 
("owner"=>"'.$owner[$i].'",
"titre"=>"'.$title[$i].'", 
"artiste"=>"'.$artiste[$i].'", 
"label"=>"'.$label[$i].'",
"contact"=>"'.$contact[$i].'",
"image"=>"'.$pic[$i].'",
"pls"=>"'.$urll[$i].'",
"web"=>"'.$web[$i].'",
"def"=>"'.$def[$i].'",
"date"=>"'.$date[$i].'"));?>';
//echo '<pre>'.$array.'</pre>';
$fp = fopen ("config.php", "w");
fwrite($fp,$array);
fclose ($fp);
echo '<H4>Saved!</H4><br><a href="myownadmin.php">Back to MyOwnAdmin</a>';

}
else {
if(isset($_GET['add'])){
echo '<br><H4>FILL BOXES TO CREAT A NEW MY OWN SPACE</H4><FORM name="add" action="myownadmin.php" method="POST">

<span>artiste:<input type="text" name="artiste" ></span><br>
<span>title:<input type="text" name="title" ></span><br>
<span>pls:<input type="text" name="pls" ></span><br>
<span>contact:<input type="text" name="contact"></span><br>
<span>web:<input type="text" name="web" ></span><br>
<span>def:<input type="text" name="def" ></span><br>
<span>label:<input type="text" name="label" ></span><br>
<span>date:<input type="text" name="date" ></span><br>
<span>image:<input type="text" name="image" ></span><br>
<script language="JavaScript" src="classes/pcjscolorchooser.js"></script>
<FORM name="formcolor">
<span>Couleur de fond: <input id="bgcolor" type="text" name="bgcolor" value="#FFFFFF">
<input id="bgbutton" type="button" value="Choisir la couleur" onClick="PcjsColorChooser(\'bgbutton\', \'bgcolor\')"><br>
</span></FORM>
<span>Image de fond: (http://) <input id="bgpic" type="text" name="bgpic"></span>
<input type="hidden" name="owner" value="'.$rawuser.'">
<input type="hidden" name="add" value="1"><HR>
<input type="submit" value="ADD TO MYOWNSPACE!"></FORM>';
}}
//fin
include ("footer.php");
}
?>
Return current item: MyOWNSpace