Location: PHPKode > projects > MyOWNSpace > MyOWNspace_v8.2/www/myownascii.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="myownascii/ascii.".$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="myownascii/ascii.".$i.".php";

include $conf_file;
//echo $conf_file;
$conf_file="myownascii/ascii.".$i.".php";

include $conf_file;
$arrayconf='<? $myownascii=array(';
$myownascii[$n]['titre']=$_POST['titre'];
$myownascii[$n]['ascii']= strtr($_POST['ascii'], '"', '\"');


for($j=1;$j<=$n;$j++)
{
$titre[$j]=$myownascii[$j]['titre'];
$ascii[$j]=$myownascii[$j]['ascii'].'  ';

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

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

}

else {
//+++++++++++++++++++++++MODIFICATION D'UNE ENTRéE

if(isset($_POST['change'])){
$nb=$_POST['change'];
$array='<? $myownascii=array(';

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

}
else{
$titre[$j]=$myownascii[$j]['titre'];
$ascii[$j]=$myownascii[$j]['ascii'];}

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

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

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

//************************************
 // Start Putting String Together, Starting With Form Tags
$dropmenu = "<p><form name=\"otherpages\" action=\"myownascii.php\" method=\"GET\">\n";
$dropmenu .= "<select name=\"pic\" size=\"1\" class=\"user\" onChange=\"document.otherpages.submit()\">\n";
$p=count($myownascii);
$dropmenu .= "<option value=\"\" selected>myownasciis(".$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.">".$myownascii[$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 ascii of YourOwnPicture</H3>'.$dropmenu.'<FORM name="clean" action="myownascii.php" method="POST">';
for($i=1;$i<=(count($myownascii));$i++)
{
$titre[$i]=$myownascii[$i]['titre'];
$ascii[$i]=$myownascii[$i]['ascii'];

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

';

$code= '<pre>'.$ascii[$i].'</pre>
<br><font style="line-height:12px; font-size:11px; font-family:verdana,arial,sans-serif;">
<b>'.$titre[$i].'</b></font></td><td  >
';
}
if($_GET['pic']!="") $n=$_GET['pic'];
{
$page .='<br>Title:<input type="text" size="50" name="titre" value="'.$titre[$n].'"><br>
ASCII:<br><textarea style="background: black none repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;" name="ascii" cols="70" rows="20">
'.$myownascii[$n]['ascii'].'</textarea><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>';

$page.='
<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>
<pre>'.$myownascii[$n]['ascii'].'</pre>
<br><font style="line-height:12px; font-size:11px; font-family:verdana,arial,sans-serif;">
<b>'.$myownascii[$n]['titre'].'</b></font></td></tr></table>
</td></tr></table>';}
}

?>




<?
if ($p!=0) echo $page;
echo '<H3>Add YourOwnASCIIART to Gallery !</H3>
<FORM name="add" action="myownascii.php" method="POST">
<br>
Title:<br><input type="text" size="50" name="titre" ><br>
ASCII:<BR><textarea style="background: black none repeat scroll 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;" name="ascii" cols="70" rows="20"></textarea><br>
<input type="hidden" name="go" value="'.$_GET['go'].'" ><br>

<input type="hidden" name="add" value="'.$i.'">
<input type="submit" value="ADD TO MyOwnASCII ART COLLECTION!"></FORM><hr>';

include "footer.php";
}
}else 
{
$view_all=1;
include "showmyownascii.php";

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