Location: PHPKode > projects > MyOWNSpace > MyOWNspace_v8.2/www/myownad.php
<?php
include("header.php");
include "login.inc.php";


if(checklogin()) {
loged($rawuser);
$conf_file="myownad/config.php";
include($conf_file);

//+++++++++++++++++++++++++++AJOUT D'UNE PUB
if(isset($_POST['add'])){
$n=$_POST['add'];
$arrayconf='<? $myownad=array(';
$myownad[$n]['titre']=$_POST['titre'.$n.''];
$myownad[$n]['texte']=$_POST['texte'.$n.''];
$myownad[$n]['lien']=$_POST['lien'.$n.''];

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

///**************** PRINT
$arrayconf.='"'.$i.'" => array 
("titre"=>"'.$myownad[$i]['titre'].'", 
"texte"=>"'.$myownad[$i]['texte'].'", 
"lien"=>"'.$myownad[$i]['lien'].'"),
';
}

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

}
else echo":(";

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

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

foreach($myownad as $ad)
{
if($i==$nb){
$ad[titre]=$_POST['titre'.$i.''];
$ad[texte]=$_POST['texte'.$i.''];
$ad[lien]=$_POST['lien'.$i.''];
}

///**************** PRINT
$array.='"'.$i.'" => array 
("titre"=>"'.$ad[titre].'", 
"texte"=>"'.$ad[texte].'", 
"lien"=>"'.$ad[lien].'",
"owner"=>"'.$rawuser.'"),
';
}
}
$array.=');?>';

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

}
else
{

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

for ($i=1;$i<=$p;$i++) {
if($rawuser==$myownad[$i]['owner']){
// Loop Through The Array To Build The String And Drop Down List
$dropmenu .= "<option value=".$i.">".$myownad[$i]['lien']."</option>\n";
}
}
// Finish Putting Together The String
$dropmenu .= "</select>&nbsp;\n";
$dropmenu .= "<input type=\"submit\" value=\"GO\" class=\"user\">\n"; 
$page= '<FORM name="clean" action="myownad.php" method="POST">';
for($i=1;$i<=(count($myownad));$i++)
{

$array.='"'.$i.'" => array 
("titre"=>"'.$myownad[$i]['titre'].'", 
"texte"=>"'.$myownad[$i]['texte'].'", 
"lien"=>"'.$myownad[$i]['lien'].'",
"owner"=>"'.$rawuser.'",
';

$code[$i]= '<font style="line-height:12px; font-size:11px; font-family:verdana,arial,sans-serif;"><a class="ad" id="aw0" target="_top" href="http://'.$myownad[$i]['lien'].'" >
<b>'.$myownad[$i]['titre'].'</b></a></font>
<br><font style="line-height:12px; font-size:10px; font-family:verdana,arial,sans-serif; color:#000000">'.$myownad[$i]['texte'].'</font>
<br><font style="line-height:12px; font-size:10px" face="verdana,arial,sans-serif" color="#ff0000">'.$myownad[$i]['lien'].'</font></td></tr></table></td><td  width="1">
<img alt="" height=1 width="1"></td><td  width="1"><img alt="" height=1 width="1"></td><td  >
';
}
if($_GET['go']!="") $n=$_GET['go'];
else $n=rand(0,(count($myspace)));
$page .='<div>
<span>titre:<input type="text" size="25" name="titre'.$n.'" value="'.$myownad[$n]['titre'].'"></span><br>
<span>texte:<textarea size="25" name="texte'.$n.'">'.$myownad[$n]['texte'].'</textarea></span><br>
<span>lien:<input type="text" cols="20" rows="5" name="lien'.$n.'" value="'.$myownad[$n]['lien'].'"></span>
</div><HR>';
$page .='<input type="hidden" name="change" value="'.$n.'">
<input type="submit" value="SAVE"></FORM>';
echo $page;
// imprime la pub
echo "<head>
<style><!--
.ch{cursor:pointer;cursor:hand}a.ad:link { color: #000000 }a.ad:visited { color: #000000 }a.ad:hover { color: #000000 }a.ad:active { color: #000000 }a.search:link { color: #000000 }a.search:visited { color: #000000 }a.search:hover { color: #000000 }a.search:active { color: #000000 }a.attribution:link { color: #000000 }a.attribution:visited { color: #000000 }a.attribution:hover { color: #000000 }a.attribution:active { color: #000000 }  --></style>
</head>";


echo"
<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 id=\"taw0\" class=\"ch\" width=\"\" height=\"\" align=\"center\" valign=\"center\" onFocus=\"ss('go to www.jamescohan.com','aw0')\" onMouseOver=\"ss('go to www.jamescohan.com','aw0')\"  onMouseOut=\"cs()\" onClick=\"ga(this,event)\"><table width=\"95%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">
<tr><td><div style=\"overflow:hidden; width:153px; padding-left:0px\">
<font style=\"font-size:13px\" face=\"arial,sans-serif\" color=\"#ef007c\">
<a id=\"aw0\" target=\"_top\" href=\"/pagead/iclk?sa=l&ai=BOwB0sECNRJXsJqOoiQLg2p2dC-yYkhXG2NmYAcCNtwGgwh4QARgDIOeEsQMoBUDKEUiQOVDGx-Gh-f____8BmAGcSqoBCjUzOTIwMjczODGyAR13d3cud2UtbWFrZS1tb25leS1ub3QtYXJ0LmNvbboBCjE2MHg2MDBfYXPIAQHaASVodHRwOi8vd3d3LndlLW1ha2UtbW9uZXktbm90LWFydC5jb20v4AEClQInGEIK&num=3&adurl=http://www.jamescohan.com&client=ca-pub-0667538248168627\" onFocus=\"ss('go to www.jamescohan.com','aw0')\" onClick=\"ha('aw0')\" onMouseOver=\"return ss('go to www.jamescohan.com','aw0')\"  onMouseOut=\"cs()\">
<b>".$myownad[$n]['titre']."</b></a>
<br></font><font style=\"font-size:13px\" face=\"arial,sans-serif\" color=\"#333333\">
".$myownad[$n]['texte']."<br></font>
<font style=\"font-size:10px\" face=\"arial,sans-serif\" color=\"#999999\">
".$myownad[$n]['lien']."</font>
</div></td></tr></table>
</td></tr></table>";
echo '</td></tr></table></td></tr></table></body></html>';
}

?>

<!--EDIT BELOW CODE TO YOUR OWN MENU-->
<? echo $dropmenu ; ?>
<!--END OF EDIT-->


<?
echo '<br><br><hr><H4>Ajouter une PUB !</H4>
<FORM name="add" action="myownad.php" method="POST">
<span><b>#'.$i.'</b></span><br>
<span>titre:<input type="text" name="titre'.$i.'" ></span><br>
<span>texte:<input type="text" name="texte'.$i.'" ></span><br>
<span>lien:<input type="text" name="lien'.$i.'" ></span>

<input type="hidden" name="add" value="'.$i.'">
<input type="submit" value="ADD TO MYOWNAAADS!"></FORM>';
}
?>
Return current item: MyOWNSpace