Location: PHPKode > projects > MyOWNSpace > MyOWNspace_v8.2/www/login.inc.php
<?
$host="http://myownspace.fr";
$admin_mail="hide@address.com";

//if (($_SERVER['SERVER_NAME']=="myownspace.fr")||($_SERVER['SERVER_NAME']=="www.myownspace.fr"))
//{
/*
***************************************************************************
Script name: Obie Quick Authentication script (one user version)
Version: 1.0
Date: 12 March 2003
Author: Minh Nguyen Duong - http://obiewebsite.sourceforge.net

This Software is FREE and can be modified 
and redistributed under the condition that 
the copyright and information above stays 
intact and with the script.

If you redistribute any Obie's script, please link back 
to http://obiewebsite.sourceforge.net

For more information about GNU(GPL), please visit http://www.GNU.org

USAGE:*********************************************************************
Paste code below all pages that require authentication

==========start=code=======>
	include "PATH_TO/quickauth.php"; //in VERY TOP OF THE HEAD OF your PHP pages
		//Other code
	if( checkauth() ) { 
		//If not authorize, it returns value FALSE and NOT print the login box
	}
	if( checklogin() ) { 
		//If not authorize, it prints the login box and returns FALSE
	}

	authcontrolbar(); //Your control bar for logging out, changing new password. Can be placed anywhere in a pages.
<========end=code===========

------------------------------------------------
Control Panel has logging out and encryted account generator function.
You can enter the CP manually:

-Control Panel (Logging out and Changing new account function) : quickauth.php?auth=quickauthcp
 or you can add the Control Bar to anywhere in a page as the function: authcontrolbar();
-Loging out: quickauth.php?auth=logout
-New username/password generator: quickauth.php?auth=generateform

------------------------------------------------
Default account (if you forget your password):
$my_username="admin";
$my_password="c3284d0f94606de1fd2af172aba15bf3";

***************************************************************************
*/

//*********************CONFIGURATIONS**************************************

//$my_username="admin"; //Your username

//$my_password="c3284d0f94606de1fd2af172aba15bf3"; //Your ecrypted password (generator in Control Panel)

$cookiename="myownspace";

$lifetime=1;

/*
**********************ENCRYPTING EMPRESSION*******************************
***You can build your own Empression by using md5() or crypt() function***
**************************************************************************
*/
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//   
function encr($s){
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//   
	$s=md5(md5($s)); //The crypting empression here
	return $s;
}
include "myownusers.php";
$cryptinstall="./classes/crypt/cryptographp.fct.php";
include $cryptinstall;  
//**************************PLEASE DO NOT CHANGE BELOW********************

if ($_POST['auth']=='login'&&(($_SERVER['SERVER_NAME']=="myownspace.fr")||($_SERVER['SERVER_NAME']=="www.myownspace.fr"))){
  $user=clean($_POST['user']);
	$pass=encr(clean($_POST['pass']));
	$checkauth=FALSE;
	$cookielifetime=time() + $lifetime*3600;
	$rawuser=$user;
	$rawpass=$pass;
	$cookievalue="$rawuser|$rawpass|";
for ($i=1;$i<=count($myown_user);$i++){
$my_username=$myown_user[$i]['login'];
$my_password=$myown_user[$i]['pass'];
if($user==$my_username && $pass==$my_password) { $checkauth=TRUE; break; }
}
	if($checkauth==FALSE) errormessage("Your username or password is not correct");
	else {
		setcookie($cookiename,$cookievalue,$cookielifetime);
		//$url = $_SERVER['REQUEST_URI'] ."?" .$refurl;*
///user is online!
$string="$user-".mktime()."\n";
$fp = fopen ("useronline.php", "a");
fwrite($fp,$string);
fclose ($fp);
/////////// GO to member zone!
		$url="members.php";
		header("Location: $url");
	}
}

if ($_POST['auth']=='signup'&&(chk_crypt($_POST['code']))){
$conf_file="myownusers.php";
  	$user=clean($_POST['user']);
	$pass=encr(clean($_POST['pass']));
	$repass=encr(clean($_POST['repass']));
	$checkauth=FALSE;
	$email=clean($_POST['email']);
	$reemail=clean($_POST['reemail']);
	$country=$_POST['country'];
	//echo "**".$user."**".$pass."**".$repass."**".$email."**".$reemail;
if($user!=""&&$pass!=""&&$pass==$repass&&$email!=""&&$email==$reemail){	
	//echo"*";
	$cookielifetime=time() + $lifetime*3600;
	$rawuser=$user;
	$rawpass=$pass;
	$cookievalue="$rawuser|$pass|";
	$code='<?php $myown_user=array(';

for ($i=1;$i<=count($myown_user);$i++)
{

$my_username=$myown_user[$i]['login'];
$my_password=$myown_user[$i]['pass'];
$my_email=$myown_user[$i]['email'];
$my_country=$myown_user[$i]['country'];
if($my_username==$rawuser) {$checkauth=FALSE;errormessage("Username allready exists!");break;}
else{
$code.='"'.$i.'" => array 
("login"=>"'.$my_username.'", 
"pass"=>"'.$my_password.'",
"email"=>"'.$my_email.'",
"country"=>"'.$my_country.'"),';
}
$checkauth=TRUE;}
$code.='"'.$i.'" => array 
("login"=>"'.$rawuser.'", 
"pass"=>"'.$rawpass.'",
"email"=>"'.$email.'",
"country"=>"'.$country.'")); ?>';

}

if ($checkauth==FALSE) errormessage("Your username or password is not correct");
else {
echo '<H1>Welcome to MyOwnSpace, '.$rawuser.'</H1><br>';
$fp = @fopen ($conf_file, "w");
fwrite($fp,$code);
fclose ($fp);
echo '<H4>You are now registered!</H4><br>Enter <a href="myownadmin.php">MyOwnSpace Admin</a> to start building your Network!!';
///CONFIRMATION EMAIL
$message="Hi ".$rawuser." -- Thanks for joining MyOwnSpace!\r\n
\r\n
Here's your account info for logging in:\n
\r\n
E-mail: ".$email."\r\n
Password: ".$_POST['pass']."\r\n
\r\n
Keep it secret. Keep it safe.\r\n
======================\r\n
\r\n
And don't forget to invite your friends!";
	 $to      = $email;
     $subject = 'Welcome to MyOwnSpace!';
$from = '"MyOwnSpace"<'.$admin_mail.'>';
$headers = 'From: '.$from . "\r\n" .
     'Reply-To: '.$from. "\r\n" .
     'Bcc: '.$from . "\r\n" .
     'X-Mailer: myOwnSpace/';

     mail($to, $subject, $message, $headers);

	}
}

if ($_GET['auth']=='logout'){
	setcookie($cookiename,"",time()-$lifetime*3600);
$url="home.php";
header("Location: $url");
}


$ma=explode("|",$_COOKIE[$cookiename]);
$rawuser=$ma[0];$rawpass=$ma[1];
/************************************************************************
 GENERATE PASSWORD
 ***********************************************************************/
function generatePassword ($length = 8)
{
  // start with a blank password
  $password = "";
  // define possible characters
  $possible = "0123456789bcdfghjkmnpqrstvwxyz";   
  // set up a counter
  $i = 0;    
  // add random characters to $password until $length is reached
  while ($i < $length) { 
    // pick a random character from the possible ones
    $char = substr($possible, mt_rand(0, strlen($possible)-1), 1);        
    // we don't want this character if it's already in the password
    if (!strstr($password, $char)) { 
      $password .= $char;
      $i++;
    }
  }
 // done!
  return $password;
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//   
function loginbox(){
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//   
global $QUERY_STRING;
	print("
	<style>
		.obietext {font-family: Arial; font-size: 11pt; font-weight: normal;}
	</style>
	<div align=center class=obietext>
	You have not loged in yet<br><br>
	<table border=0 cellspacing=1 cellpadding=4 bgcolor=#AED0F2>
	<tr><td bgcolor=white>
	<form method=POST action=login.inc.php>
	<input type=hidden name=auth value=login>
	<input type=hidden name=refurl value=".$QUERY_STRING.">
	<table width=100% border=0 cellspacing=1 cellpadding=4 class=obietext>
	<tr><td width=99% bgcolor=#F0F0F0>Username</td><td width=1% bgcolor=#F0F0F0><input type=text size=10 name=user></td></tr>
	<tr><td width=99% bgcolor=#F0F0F0>Password</td><td width=1% bgcolor=#F0F0F0><input type=password size=10 name=pass></td></tr>
	</table>
	<input type=submit value=\"Login\"> *<font size=1>Require COOKIE enabled</font>
	</td></tr>
	</form></table></div>
	<p align=right class=obietext>Authentication Script by <a href=http://obiewebsite.sourceforge.net target=_blank>Quick AUTH</a></p>");
}
function errormessage($mess){
include"header.php";
	print("<p align=center><font color=red>$mess</font></p>");
include"footer.php";
}
function loged($u){
global $QUERY_STRING;
	$refurl=str_replace("&","^",$_SERVER["QUERY_STRING"]);
	$refurl=str_replace("=","~",$refurl);
	print("<div align=left style=\"border: solid 1 gray;\"> <table class=\"text\" bgcolor=\"#037bd1\" width=\"570\">
                <tbody><tr>

                  <td><font color=\"#ffffff\">Loged as <b><a href=/".$u.">".$u."</a></b> 
	&nbsp;<small>(<a style='color:#ffffff;' onmouseout=\"this.style.color = 'white';\" onmouseover=\"this.style.color 
= 'red';\"  href=\"login.inc.php?auth=logout\">Logout</a>)</small> | <a style='color:#ffffff;' onmouseout=\"this.style.color = 'white';\" onmouseover=\"this.style.color 
= 'red';\" href=\"members.php\">My Own ADMIN!</a> | <a style='color:#ffffff;' onmouseout=\"this.style.color = 'white';\" onmouseover=\"this.style.color 
= 'red';\" href=\"myownad.php\">My Own Ads!</a></font>  | <a style='color:#ffffff;' onmouseout=\"this.style.color = 'white';\" onmouseover=\"this.style.color 
= 'red';\" href=\"myownnews.php?go=".$u."\">My Own NEWS!</a><font color=red><small>(NEW)</small></font></font>
  </td></tr></tbody></table><br><hr>");
}

//**************************MAIN FUNCTIONS*******************************************************
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//   
function checkauth(){
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//   
$checklogin=FALSE;
global $rawuser;
global $rawpass;
include "myownusers.php";
//echo $rawuser."/".$rawpass;
$i=0;
foreach($myown_user as $k)
//for ($i=1;$i<=count($myown_user);$i++)
{
$i++;
$my_username=$k['login'];//echo "##:".$my_username;
$my_password=$k['pass'];
if($my_username==$rawuser && $my_username !="" && $my_password!="" && $my_password==$rawpass && rawuser!="" && rawpass!="") 
{$checklogin=TRUE;break;}
}
return $checklogin;
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//   
function checklogin(){
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//   
	if(!checkauth()) {
		loginbox();
		return FALSE;
	}
	else return TRUE;
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//   
function authcontrolbar(){
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//   
global $rawuser;
	if(checkauth()) loged($rawuser);
}

//************************END*******************************************************************
////////// NEW PASSSWORD if lost
if ($_POST['auth']=='lost'){
include "myownusers.php";
$code='<?php $myown_user=array(';
$password=generatePassword();
for($i=1;$i<=count($myown_user);$i++)
{
$my_username=$myown_user[$i]['login'];
$my_password=$myown_user[$i]['pass'];
$my_email=$myown_user[$i]['email'];
$my_country=$myown_user[$i]['country'];
if($myown_user[$i]['login']==$_POST['user']){
$code.='"'.$i.'" => array 
("login"=>"'.$my_username.'", 
"pass"=>"'.encr($password).'",
"email"=>"'.$my_email.'",
"country"=>"'.$my_country.'"),';
$email=$my_email;
$login=$my_username;
$user_found=1;
}
else{
$code.='"'.$i.'" => array 
("login"=>"'.$my_username.'", 
"pass"=>"'.$my_password.'",
"email"=>"'.$my_email.'",
"country"=>"'.$my_country.'"),';
}
}
$code.=');?>';
if($user_found!=1) errormessage("this is not a valid user name");
else{
writeTXT("myownusers.php",$code);
///CONFIRMATION EMAIL
$message="Hi ".$login." -- Thanks for using MyOwnSpace!\r\n\r\n Here's your account info for logging in:\n\r\n
E-mail: ".$email."\r\n
Login: ".$login."\r\n
Password: ".$password."\r\n\r\n
Keep it secret. Keep it safe.\r\n
======================\r\n\r\n
And don't forget to invite your friends!";
$to      = $email;
$subject = 'MyOwnPassword Reminder!';
$headers = 'From: "MyOwnSpace"<'.$admin_mail.'>' . "\r\n" .
     'Reply-To: hide@address.com' . "\r\n" .
     'Bcc: "MyOwnSpace"<'.$admin_mail.'>' . "\r\n" .
     'X-Mailer: myOwnSpace/';
mail($to, $subject, $message, $headers);
$message= "A new password has been sent to your email contact(".$email.")";
errormessage($message); 
}
}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//   
function clean($string){
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//   
if (get_magic_quotes_gpc()) {
            $string = stripslashes($string);
        }
        //addslashes($string);
        //$string = str_replace(array("&lt;","&gt;"),array("&amp;lt;","&amp;gt;"),$string);
        // fix &entitiy\n;
      
        $string = preg_replace('#(&\#*\w+)[\s\r\n]+;#U',"$1;",$string);
        //$string = @html_entity_decode($string, ENT_QUOTES, "UTF-8");
        $string = htmlspecialchars($string, ENT_QUOTES);
        
        // remove any attribute starting with "on" or xmlns
        $string = preg_replace('#(<[^>]+[\s\r\n\"\'])(on|xmlns)[^>]*>#iU',"$1>",$string);
        // remove javascript: and vbscript: protocol
        $string = preg_replace('#([a-z]*)[\s\r\n]*=[\s\n\r]*([\`\'\"]*)[\\s\n\r]*j[\s\n\r]*a[\s\n\r]*v[\s\n\r]*a[\s\n\r]*s[\s\n\r]*c[\s\n\r]*r[\s\n\r]*i[\s\n\r]*p[\s\n\r]*t[\s\n\r]*:#iU','$1=$2nojavascript...',$string);
        $string = preg_replace('#([a-z]*)[\s\r\n]*=([\'\"]*)[\s\n\r]*v[\s\n\r]*b[\s\n\r]*s[\s\n\r]*c[\s\n\r]*r[\s\n\r]*i[\s\n\r]*p[\s\n\r]*t[\s\n\r]*:#iU','$1=$2novbscript...',$string);
        //<span style="width: expression(alert('Ping!'));"></span> 
        // only works in ie...
        $string = preg_replace('#(<[^>]+)style[\s\r\n]*=[\s\r\n]*([\`\'\"]*).*expression[\s\r\n]*\([^>]*>#iU',"$1>",$string);
        $string = preg_replace('#(<[^>]+)style[\s\r\n]*=[\s\r\n]*([\`\'\"]*).*s[\s\n\r]*c[\s\n\r]*r[\s\n\r]*i[\s\n\r]*p[\s\n\r]*t[\s\n\r]*:*[^>]*>#iU',"$1>",$string);
        //remove namespaced elements (we do not need them...)
        $string = preg_replace('#</*\w+:\w[^>]*>#i',"",$string);
        //remove really unwanted tags
        
        do {
            $oldstring = $string;
            $string = preg_replace('#</*(style|script|object|iframe|frame|frameset|ilayer|layer|bgsound|title|base)[^>]*>#i',"",$string);
        } while ($oldstring != $string);
        
        return $string;
    }
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//       
function cleanhtml($string){
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//   
if (get_magic_quotes_gpc()) {
            $string = stripslashes($string);
        }
        //addslashes($string);
        //$string = str_replace(array("&lt;","&gt;"),array("&amp;lt;","&amp;gt;"),$string);
        // fix &entitiy\n;
      
        #$string = preg_replace('#(&\#*\w+)[\s\r\n]+;#U',"$1;",$string);
        #$string = @html_entity_decode($string, ENT_QUOTES, "UTF-8");
        #$string = htmlspecialchars($string, ENT_QUOTES);
        
        // remove any attribute starting with "on" or xmlns
        $string = preg_replace('#(<[^>]+[\s\r\n\"\'])(on|xmlns)[^>]*>#iU',"$1>",$string);
        // remove javascript: and vbscript: protocol
        $string = preg_replace('#([a-z]*)[\s\r\n]*=[\s\n\r]*([\`\'\"]*)[\\s\n\r]*j[\s\n\r]*a[\s\n\r]*v[\s\n\r]*a[\s\n\r]*s[\s\n\r]*c[\s\n\r]*r[\s\n\r]*i[\s\n\r]*p[\s\n\r]*t[\s\n\r]*:#iU','$1=$2nojavascript...',$string);
        $string = preg_replace('#([a-z]*)[\s\r\n]*=([\'\"]*)[\s\n\r]*v[\s\n\r]*b[\s\n\r]*s[\s\n\r]*c[\s\n\r]*r[\s\n\r]*i[\s\n\r]*p[\s\n\r]*t[\s\n\r]*:#iU','$1=$2novbscript...',$string);
        //<span style="width: expression(alert('Ping!'));"></span> 
        // only works in ie...
        $string = preg_replace('#(<[^>]+)style[\s\r\n]*=[\s\r\n]*([\`\'\"]*).*expression[\s\r\n]*\([^>]*>#iU',"$1>",$string);
        $string = preg_replace('#(<[^>]+)style[\s\r\n]*=[\s\r\n]*([\`\'\"]*).*s[\s\n\r]*c[\s\n\r]*r[\s\n\r]*i[\s\n\r]*p[\s\n\r]*t[\s\n\r]*:*[^>]*>#iU',"$1>",$string);
        //remove namespaced elements (we do not need them...)
        $string = preg_replace('#</*\w+:\w[^>]*>#i',"",$string);
        //remove really unwanted tags
        
        do {
            $oldstring = $string;
            $string = preg_replace('#</*(style|script|object|iframe|frame|frameset|ilayer|layer|bgsound|title|base)[^>]*>#i',"",$string);
        } while ($oldstring != $string);
        
        return $string;
    }    
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//    
function lastusers($n){
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//   
include "config.php";
$face="/images/unknown.gif";
$code='';
for($i=count($myspace);$i>(count($myspace)-$n);$i--)
{
$pic[$i]=$myspace[$i]['image'];
$artiste[$i]=$myspace[$i]['artiste'];
$title[$i]=$myspace[$i]['title'];
$urll[$i]=$myspace[$i]['pls'.$i.''];
$contact[$i]=$myspace[$i]['contact'];
$web[$i]=$myspace[$i]['web'];
$def[$i]=$myspace[$i]['def'];
$label[$i]=$myspace[$i]['label'];
if($pic[$i]==""||$pic[$i]=="http://") $pic[$i]=$face;
$date[$i]=$myspace[$i]['date'];
$code.='<tr><td width="110">
                  <p class="plan_monthly_price" style="padding-left: 5px;"><span class="currency_sign">></span>'.$artiste[$i].'</p>
                  <p class="plan_price_per_month">'.$label[$i].'</p>  <br>
                  <center><img src="'.$pic[$i].'" width="80" title="'.$title[$i].'!">
                    <b><br><img src="images/red_arr.jpg" width="8" height="7">
                    <a class="small" href="http://myownspace.fr/'.$i.'">CHECK NOW!</a></b>
                  </center>

                


                </td>
                <td width="235" align="left">
                  <img src="images/bullet_white.gif" width="9" height="9"> '.$def[$i].'<br><br>
                </td></tr>';
}
return $code;
}

//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//   
function showmyblog($userid,$artiste,$blogid){
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//   
$conf_file="myownblog/blog.".$userid.".php";
if (file_exists($conf_file)){
include $conf_file;
$nbblog=count($myownblog);
}
else $nbblog=0;
if($blogid==""||$blogid=="last") {$blogid=$nbblog;$nb=1;}
if($blogid=="all") {$blogid=$nbblog;$nb=$blogid;}
$code= '<br><!--BOX LATEST BLOG-->					

<table align="center" bgcolor="#ffcc99" border="1" bordercolor="#ffcc99" cellpadding="0" cellspacing="0" width="435">
		<tbody><tr>
			<td bgcolor="#ffcc99" height="17" width="435"><span class="orangetext15">'.$artiste.'\'s Latest Blog Entry</span></td>
</tr>';
if($nbblog>0){
for ($x=$blogid;$x>($blogid-$nb);$x--){
$txtfile="myownblog/blog.".$userid.".".$x.".txt";
$code.='<tr valign="top"><td border="0" bordercolor="#000000" bgcolor="#ffffff" width="435">
<small>['.$myownblog[$x]['date'].']</small><br>
<b>'.$myownblog[$x]['titre'].'</b>
<p>

'.file_get_contents($txtfile).'</p>
</td></tr>';}

$code.='<tr><td colspan="4" bgcolor="#ffffff">
<a href="showmyownblog.php?go='.$userid.'&viewall=1" class="redlink">View All of '.$artiste.'\'s Post..</a>
<br><br></td></tbody></table>';
}
else $code.='<tr valign="top"><td border="0" bordercolor="#000000" bgcolor="#ffffff" width="435">
<tr><td colspan="4" bgcolor="#ffffff">
[No Blog Entrie!]<br><a href="myownblog.php?go='.$_GET['go'].'">Create Your Own Blog</a><br>
<br><br></td></tbody></table>';

return($code);
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
function writeTXT($filename,$somecontent){
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++//
// Assurons nous que le fichier est accessible en écriture
if (!file_exists($filename)) {
@fopen($filename, "w"); 
chmod ($filename, 0777);}
if (is_writable($filename)) {

   // c'est là que $somecontent sera placé
   if (!$handle = fopen($filename, 'w')) {
         echo "Impossible d'ouvrir le fichier";
         exit;
   }

   // Ecrivons quelque chose dans notre fichier.
   if (fwrite($handle, $somecontent) === FALSE) {
       echo "Impossible d'écrire dans le fichier";
       exit;
   }
  
   echo ".";
  
   fclose($handle);
                  
} 
  else echo "Le fichier n'est pas accessible en écriture.";

}
//}else echo $_SERVER['SERVER_NAME'];

// USE THIS FUNCTION TO USE AUTOMATICALLY LinkExtractor CLASS
require( "classes/LinkExtractor.class.php" );

function linkExtractor( $what, $url = false ) {
	// andr3a 18/06/2004 [ www.3site.it ]

	// linkExtractor( $string_url_or_file [, true/false ] )
	// true if $string_or_url is an url or a file
	// false or anything if is a string
	
	$myLinks = &new LinkExtractor();
	if( $url == false ) {
		$myLinks->parseString( $what );
	}
	elseif( $url == true ) {
	        if( $myLinks->parseUrl( $what ) == false ) {
	        	return false;
		}
	}
	return $myLinks->getLinks();
}
///////////////////////////////////////////////
////////////////// CHANGE DATE OF LAST CHANGE
///////////////////////////////////////////////
function change_update($nb){
include "config.php";
$array='<? $myspace=array(';
for($i=1;$i<=count($myspace);$i++)
{
if($i==$nb){

$myspace[$i]['date']=date("j-M-Y h:i:s A");

}
///**************** 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);
//echo '<H4>your change has been updated!</H4><br><a href="myownadmin.php">Back to MyOwnAdmin</a>';

}
///////////////////////////////////////////////
////////////////// AFFICHE LAST CHANGE
///////////////////////////////////////////////
function last_change($nb){
include "config.php";
$face="/images/unknown.gif";
$date=array();
for($i=1;$i<=count($myspace);$i++)
{

$date[$i]= strtotime($myspace[$i]['date']);

}
arsort($date);

$max=$nb;
$i=0;$code='';
while(list($key2,$val2) = each($date))
{
if($myspace[$key2]['image']==""||$myspace[$key2]['image']=="http://") $pic=$face;
else $pic=$myspace[$key2]['image'];
if ($myspace[$key2]['status']==1){
$code.='<tr><td colspan="2">
                  <p class="plan_monthly_price" style="padding-left: 5px;"><span class="currency_sign">></span>'.$myspace[$key2]['artiste'].'</p>
                  <p class="plan_price_per_month">'.$myspace[$key2]['label'].'</p>                 
 </tr><tr><td width="110">
                  <center><a class="small" href="http://myownspace.fr/'.$key2.'"><img border="0" src="'.$pic.'" width="80" title="'.$myspace[$key2]['titre'].'!">
                    <b><br><img border="0" src="images/red_arr.jpg" width="8" height="7"> CHECK NOW!</a></b>
                  </center>

  <br><br>           

                </td>
                <td width="235" align="left">
                  <img src="images/bullet_white.gif" width="9" height="9"> '.$myspace[$key2]['def'].'<br><br>
                </td></tr>';

$i++;
if($i>=$max) break;
}
}
return $code;
}

/*******************************************************************************
///// SHOW ADMIN OPTIONS !
*****************************************************************************/
function menu_options($nb){
$menu2='<b>';
$menu2.="&nbsp;<a href=\"/".$nb."\">Go to THIS space</a><br>";
$menu2.='<a href="/'.$nb.'" rel="gb_page_fs[]" title="click to preview"><img src="http://thumbnailspro.com/thumb.php?url=http://myownspace.fr/'.$nb.'&S=150" border="2" alt="website thumbnails"></a>';
$menu2.='<br>&nbsp;<a href="myownjpeg.php?go='.$nb.'">MyOwnJPEG rotator</a>&nbsp;<a id="mylink1" href="$myjpeg?width=350" class="betterTip" title="My OWN jpeg rotator">?</a><sub><font color=red>NEW!</font></sub>
&nbsp;<a href="myownpic.php?go='.$nb.'">MyOwnPicture Album</a> <a id="mylink2" href="$myalbum?width=350" class="betterTip" title="My OWN gallery">?</a>
&nbsp;<a href="myownfriend.php?go='.$nb.'">MyOwnFriends Manager</a>&nbsp; <a id="mylink3" href="$myfriend?width=350" class="betterTip" title="My OWN friends">?</a><br>
&nbsp;<a href="myownblog.php?go='.$nb.'">MyOwnBLOG</a>&nbsp; <a id="mylink4" href="$myblog?width=350" class="betterTip" title="My OWN blog">?</a>
&nbsp;<a href="myownascii.php?go='.$nb.'">MyOwnASCII ART Collection</a>&nbsp; <a id="mylink5" href="$myascii?width=350" class="betterTip" title="My OWN ASCII Art">?</a>
&nbsp;<a href="myownstat.php?go='.$nb.'">MyOwnSTATISTICS !</a>&nbsp;<a id="mylink6" href="$mystats?width=350" class="betterTip" title="My OWN statistics">?</a>
&nbsp;<a href="playlist.php?go='.$nb.'">MyOwnMP3!</a>&nbsp;<a id="mylink7" href="$mymp3?width=350" class="betterTip" title="My OWN MP3 playlist">?</a></H4> ';
$menu2.='</b><hr>';
return($menu2);
}
?>
Return current item: MyOWNSpace