Location: PHPKode > projects > MyOWNSpace > MyOWNspace_v8.2/www/myownadmin.php
<?php

include "login.inc.php";
include "config.php";
$go=$_GET['go'];

if(checklogin()) {


 // 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=\"EDIT THIS SPACE\" class=\"user\">"; 

$menu= "<hr><H4><a href=\"myownadmin.php?add\">Create a New Space</a>&nbsp;|&nbsp;<a href=\"$rawuser\">Visit MyOwnSpace</a>&nbsp;|";

//+++++++++++++++++++++++
if(isset($_POST['change'])&&$myspace[$_POST['change']]['owner']==$rawuser){
$nb=$_POST['change'];
$array='<? $myspace=array(';
for($i=1;$i<=count($myspace);$i++)
{
if($i==$nb){
$myspace[$i]['owner']=$_POST['owner'];
$myspace[$i]['image']=clean($_POST['image']);
$myspace[$i]['artiste']=clean($_POST['artiste']);
$myspace[$i]['titre']=clean($_POST['title']);
$myspace[$i]['contact']=clean($_POST['contact']);
$myspace[$i]['web']=clean($_POST['web']);
$myspace[$i]['def']=clean($_POST['def']);
$myspace[$i]['label']=clean($_POST['label']);

$myspace[$i]['date']=clean($_POST['date']);
$myspace[$i]['bgcolor']=$_POST['bgcolor'];
$myspace[$i]['bgpic']=$_POST['bgpic'];
$myspace[$i]['guestbook']=$_POST['guestbook'];
$myspace[$i]['friends']=$_POST['friends'];
$myspace[$i]['myownpic']=$_POST['myownpic'];
//$latestblog[$i]=$_POST['latestblog'];
$myspace[$i]['cropimg']=$_POST['cropimg'];
$myspace[$i]['status']=$_POST['status'];
}

if($myspace[$i]['status']=="")$myspace[$i]['status']=1;
///**************** PRINT
$array.='"'.$i.'" => array 
("owner"=>"'.$myspace[$i]['owner'].'",
"titre"=>"'.$myspace[$i]['titre'].'", 
"artiste"=>"'.$myspace[$i]['artiste'].'", 
"label"=>"'.$myspace[$i]['label'].'",
"contact"=>"'.$myspace[$i]['contact'].'",
"image"=>"'.$myspace[$i]['image'].'",
"web"=>"'.$myspace[$i]['web'].'",
"def"=>"'.$myspace[$i]['def'].'",
"date"=>"'.$myspace[$i]['date'].'",
"bgcolor"=>"'.$myspace[$i]['bgcolor'].'",
"bgpic"=>"'.$myspace[$i]['bgpic'].'",
"guestbook"=>"'.$myspace[$i]['guestbook'].'",
"friends"=>"'.$myspace[$i]['friends'].'",
"myownpic"=>"'.$myspace[$i]['myownpic'].'",
"cropimg"=>"'.$myspace[$i]['cropimg'].'",
"status"=>"'.$myspace[$i]['status'].'"),
';
}
$array.=');?>';

$fp = fopen ("config.php", "w");
fwrite($fp,$array);
fclose ($fp);
header("location:members.php");

}



///==============================================================
if(isset($_GET['go'])&&$myspace[$_GET['go']]['owner']==$rawuser)
{
include "header.php";
$i=$_GET['go'];
$date=date("j-M-Y h:i:s A");

loged($rawuser);
echo $dropmenu."</FORM></div>";
echo $menu;
echo menu_options($i);

$page.= '<form name="change" action="myownadmin.php" method="POST">
<b>Status :</b><select name="status"><option ';
if($myspace[$i]['status']==1) $page.="selected=selected ";
$page.='value="1">public</option><option ';
if($myspace[$i]['status']!=1) $page.= "selected=selected ";
$page.='value="0">off</option></select><br>
<b>Album or page title :</b><br><input size="100" type="text" name="title" value="'.$myspace[$i]['titre'].'"><br>
<b>Artiste name :</b><br><input size="100" type="text" name="artiste" value="'.$myspace[$i]['artiste'].'"><br>
<b>Short Definition :</b><br><input size="100" type="text" name="def" value="'.$myspace[$i]['def'].'"><br><HR>
<b>Label name :</b><br><input size="50" type="text" name="label" value="'.$myspace[$i]['label'].'"><br>
<b>URL of the artist or label homepage :</b><br><input size="100" type="text" name="web" value="'.$myspace[$i]['web'].'"><br>
<b>Email contact :</b><br><input size="50" type="text" name="contact" value="'.$myspace[$i]['contact'].'"><br>
<hr><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?go='.$i.'">How does it work?</a>)</small></b><br>
<input size="10" type="hidden" name="date" value="'.$date.'"><hr>
<b>Picture :</b><br /><input type="checkbox" name="cropimg" value=1 ';
if($myspace[$i]['cropimg']==1) $page.='CHECKED';
$page.='>Resize picture!<br><img src="'.$myspace[$i]['image'].'" width="100"><br>
<input size="50" type="text" name="image" value="'.$myspace[$i]['image'].'">

<hr>
<b>Couleur de fond :</b> <br /><input type="text" size="10" maxlength="7" name="bgcolor" value="'.$myspace[$i]['bgcolor'].'">
<input type="button" value="Color picker" onclick="showColorPicker(this,document.forms[0].bgcolor)"><br>

<b>Image de fond :</b> <br />';
if ($myspace[$i]['bgpic']!="") $page.= '<img src="'.$myspace[$i]['bgpic'].'" height="25"><br />';
$page.='<input id="bgpic" size="50" type="text" name="bgpic" value="'.$myspace[$i]['bgpic'].'">
';
$page.= '<HR>';

$page.= '<b>Guestbook :<BR>&nbsp;<input type="checkbox" name="guestbook" value=1 ';
if($myspace[$i]['guestbook']==1) $page.='CHECKED';
$page .='>Allow user to post comments</b><hr>';

$page.= '<b>Friends :<BR>&nbsp;<input type="checkbox" name="friends" value=1 ';
if($myspace[$i]['friends']==1) $page.='CHECKED';
$page .='>Invite random Members of the MyOwnSpace Network in my Extended Friends Network! ( not only MyOwnFriends )</b><br><hr>';

$page.= '<b>MyOwnPictures :<BR>&nbsp;<input type="checkbox" name="myownpic" value=1 ';
if($myspace[$i]['myownpic']==1) $page.='CHECKED';
$page .='>Create Your Own Picture Album !</b><br>';

$page.= '<input type="hidden" name="change" value="'.$i.'"><input type="hidden" name="owner" value="'.$rawuser.'">';

$page.= '<hr><input type="submit" value="SAVE CHANGES"  class="user"></FORM>';
echo $page;
}



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


$array='<? $myspace=array(';
for($i=1;$i<=count($myspace);$i++)
{
if($myspace[$i]['status']=="")$myspace[$i]['status']=1;//test
$array.='"'.$i.'" => array 
("owner"=>"'.$myspace[$i]['owner'].'",
"titre"=>"'.$myspace[$i]['titre'].'", 
"artiste"=>"'.$myspace[$i]['artiste'].'", 
"label"=>"'.$myspace[$i]['label'].'",
"contact"=>"'.$myspace[$i]['contact'].'",
"image"=>"'.$myspace[$i]['image'].'",
"web"=>"'.$myspace[$i]['web'].'",
"def"=>"'.$myspace[$i]['def'].'",
"date"=>"'.$myspace[$i]['date'].'",
"bgcolor"=>"'.$myspace[$i]['bgcolor'].'",
"bgpic"=>"'.$myspace[$i]['bgpic'].'",
"guestbook"=>"'.$myspace[$i]['guestbook'].'",
"friends"=>"'.$myspace[$i]['friends'].'",
"myownpic"=>"'.$myspace[$i]['myownpic'].'",
"cropimg"=>"'.$myspace[$i]['cropimg'].'",
"status"=>"'.$myspace[$i]['status'].'"),
';
}

$array.='"'.$i.'" => array 
("owner"=>"'.$_POST['owner'].'",
"titre"=>"'.clean($_POST['title']).'", 
"artiste"=>"'.clean($_POST['artiste']).'", 
"label"=>"'.clean($_POST['label']).'",
"contact"=>"'.clean($_POST['contact']).'",
"image"=>"'.clean($_POST['image']).'",
"web"=>"'.clean($_POST['web']).'",
"def"=>"'.clean($_POST['def']).'",
"date"=>"'.clean($_POST['date']).'",
"bgcolor"=>"'.clean($_POST['bgcolor']).'",
"bgpic"=>"'.clean($_POST['bgpic']).'",
"guestbook"=>"'.$_POST['guestbook'].'",
"friends"=>"'.$_POST['friends'].'",
"myownpic"=>"'.$_POST['myownpic'].'",
"cropimg"=>"'.$_POST['cropimg'].'",
"status"=>"'.$_POST['status'].'"));?>';

$fp = fopen ("config.php", "w");
fwrite($fp,$array);
fclose ($fp);
header("location:members.php");

}
else {
if(isset($_GET['add'])){
include "header.php";
loged($rawuser);
echo $dropmenu."</FORM></div>";
echo $menu;
echo menu_options($i);

$date=date("j-M-Y h:i:s A");
$page= '
		
  <H3>FILL BOXES TO CREATE A NEW MY OWN SPACE!</H3>
<FORM name="add" action="myownadmin.php" method="POST">
<b>Status :</b><select name="status"><option value="1">public</option><option value="0">off</option></select><br>
<b>Album or page title:</b><br><input size="100" type="text" name="title" value="'.$title[$i].'"><br>
<b>Artiste name:</b><br><input size="100" type="text" name="artiste" value="'.$artiste[$i].'"><br>
<b>Short Definition:</b><br><input size="100" type="text" name="def" value="'.$def[$i].'"><br><br>
<b>Label name:</b><br><input size="50" type="text" name="label" value="'.$label[$i].'"><br>
<b>URL of the artist or label homepage:</b><br><input size="100" type="text" name="web" value="http://"><br>
<b>Email contact:</b><br><input size="50" type="text" name="contact" value="'.$contact[$i].'"><br>
<hr>
<img src="http://myownspace.fr/images/unknown.gif">
<b>Link to your Own Picture :(enter URL)</b><br>
<input size="50" type="text" name="image" value="http://">&nbsp;<input type="checkbox" name="cropimg" value=1>Resize picture!<br>

<hr>
Couleur de fond: <input type="text" size="10" maxlength="7" name="bgcolor" >
<input type="button" value="Color picker" onclick="showColorPicker(this,document.forms[0].bgcolor)"><br>

Image de fond: (http://) <input id="bgpic" size="50" type="text" name="bgpic" value="'.$bgpic[$i].'">
';
if ($bgpic[$i]!="") $page.= '<img src="'.$bgpic[$i].'" height="25">';
$page.= '<HR>';

$page.= '<b>Guestbook!&nbsp;<input type="checkbox" name="guestbook" value="0" >';
$page.= '<hr><b>My Own Pictures Album!<BR>&nbsp;<input type="checkbox" name="myownpic" value=1 ';
if($myownpic[$i]==1) $page.='CHECKED';
$page .='>Create Your OwnPictureAlbum !</b><br><hr>';
$page .='
<input type="hidden" name="date" value="'.$date.'">
<input type="hidden" name="owner" value="'.$rawuser.'">
<input type="hidden" name="add" value="1">
<input type="submit" value="ADD TO MYOWNSPACE!" class="user"></FORM>';
echo $page;
}}
//fin
include("myowntip.html");
include ("footer.php");
}
else echo "incorrect";
?>
Return current item: MyOWNSpace