Location: PHPKode > projects > Hosting App > hosting/modules/functions.php
<?php
////////////////////////////////////////////////////////////////////////////////
//   Copyright (c), 2002, Sadri Sahraoui <hide@address.com>               //
//   Hosting App - A web based hosting management system                      //
//   http://sf.net/projetcs/hostingapp/                                       //
//   				                                                                  //
//   This program is free software. You can redistribute it and/or modify     //
//   it under the terms of the GNU General Public License                     //
//                                                                            //
//   This program is distributed in the hope that it will be useful,          //
//   but WITHOUT ANY WARRANTY, without even the implied warranty of           //
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the             //
//   GNU General Public License for more details															//
// 																		                                        //
//   You should have received a copy of GNU General Public License            //
//   along with this program.                                                 //
////////////////////////////////////////////////////////////////////////////////

/**
 *
 * @version v1, 24/08/2002
 */



function disk_space ($user)
{
	$home = $GLOBALS['path_to_users_home'].$user

	$df = disk_total_space("$dir");

	return $df; 
}

function mysql_disk_space($user, $db_user)
{

			$local_query = 'SHOW TABLE STATUS FROM '.$db_user;
            $result      = @mysql_query($local_query);
            if (@mysql_num_rows($result)) {

                while ($row = mysql_fetch_array($result)) {

                    $dbs_array[$db][1] += $row['Data_length'];

                    $dbs_array[$db][2] += $row['Index_length'];

                }

                $dbs_array[$db][3]     = $dbs_array[$db][1] + $dbs_array[$db][2];
								
                $total_array[1]        += $dbs_array[$db][1];

                $total_array[2]        += $dbs_array[$db][2];

                $total_array[3]        += $dbs_array[$db][3];
            } // end if

            mysql_free_result($result);
}


function change_password($user, $password, $password1)
{
	if ($password != $password1) {
	    return 10;
	}else{
		$chg = exec("$GLOBAL[path_to_chg_pass]");
			if ($chg == 1) {
			    return 1;
			}else{
				return 11;
			}
	}
}


function get_domains($id_user)

{

	$sql = "SELECT COUNT(*) FROM domain WHERE ID_client = '$id_user'";

	$res = mysql_query($sql);

	$nb = mysql_num_rows($res);

		if ($nb == 1) {

		    $sql_get_domain = "SELECT ID_domain, Domain, Pack FROM domain WHERE ID_client = '$id_user'";

				$res_get_domain = mysql_query($sql_get_domain) or die ("Impossible d'executer la requete".mysql_error);

				$data = mysql_fetch_array($res_get_domain);

				$id_domain = $data[0];

				$domain = $data[1];

				$id_pack = $data[2];

				return array($id_domain, $domain, $id_pack);

		}else{

			$sql_get_domains = "SELECT ID_domain, Domain, Pack FROM domain WHERE ID_client = '$id_user'";

			$res_get_domains = mysql_query($sql_get_domains) or die("Impossible d'executer la requete".mysql_error());

			while($data = mysql_fetch_array($res_get_domains)){

				$id_domain[] = $date[0];

				$domain[] = $data[1];

				$pack[] = $data[2];

			}

				return array($id_domain,$domain, $pack);
			
		}
}



function octet_2_kilo($nb) 
{

	$kilo = $nb / 1024;

	$number = number_format($kilo,1,',',' ');

	return $number;

}









?>
Return current item: Hosting App