Location: PHPKode > scripts > Combine XML, Files and SQLite with PHP 5 > combine-xml-files-and-sqlite-with-php-5/MyRentABike/vr_admin_customer.php
<?php
	// check if classes are valid
	$strKlasse = '';
	function __autoload($strKlasse)
	{	try {	if(!preg_match('=^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*$=m',$strKlasse))
		{ throw new Exception("Class '$strKlasse' is not valid."); }		
		$strIncludeFile = 'classes/'.$strKlasse. '.class.php';		
		if (!file_exists($strIncludeFile))
		{ throw new Exception("Include file <i>$strIncludeFile</i> not found.<br>"); }		
		require_once($strIncludeFile);		
		if(!class_exists($strKlasse))
		{ throw new Exception("Include file <i>$strIncludeFile</i> 
							contains no class '$strKlasse'.<br>");	}
		return true; }
		catch(Exception $e)
		{ die($e->getMessage()); }
	}
	
	$id = $_GET['id'];
	$showid = $_GET['show'];
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>

	<head>
		<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
		<meta name="generator" content="Adobe GoLive 6">
		<title>MyRentABike / Customer data</title>
		<link href="css/filesqlite.css" rel="stylesheet" media="screen">
	</head>

	<body bgcolor="#ffffff">
		<p><a href="index.html">back</a></p>
		<h3>MyRentABike / Manage customers</h3>
		<p>
<?php
	$allcust = new VRProcessSQLite($modus,$custexist,$newid,$firstname,$lastname,$street,
							$zipcode,$city,$selectLand,$selectRent,$comprent,$datum);
	$allcust->executeSelect();
  ?></p>
		<p>
<?php
if(isset($_GET['cust_id'])) {
	$id = $_GET['cust_id'];
	
	try {
		$cust = new VRCustomer($id);
		
		// if id has not correct format, call exception	
		$cust->isId($id);
		
		// dow we have a valid customer id
		$cust->existCustId($id);		
	
		// is object $cust instance of class
		if($cust instanceof VRCustomer) {
			// set correct rent state to show or hide rent info
			if($cust->getRent() == 0) { $rent = "No vehicle rented."; }
			else { $rent = "Vehicle rented. / Nr. {$cust->getRent()}
				-> <a href=\"vr_admin_customer.php?id={$cust->getRent()}&show={$cust->getId()}\">show</a>"; }
				
				// load HTML from view
				if (file_exists('view/admin_custsingle_view.php')) {
				require 'view/admin_custsingle_view.php'; }
				else { die("Error."); }
		}
	
	// error exceptions
	} catch(IdException $e) {
		print $e->getMessage();
	} catch (Exception $e) {
		print $e;
		exit();
	}
}	
  ?></p>
		<p>
	<?php
		if(isset($showid)) {
			try {		
				$cust = new VRCustomer($id);
				// if id has not correct format, call exception	
				$cust->isId($id);
				
				// load data from web page
				if (file_exists('vr_main_rental.php')) {
				require 'vr_main_rental.php'; }
				else { die("Error."); }
				
			// error exceptions
			} catch(IdException $e) {
				print $e->getMessage();
			} catch (Exception $e) {
				print $e;
				exit();
			}
		}
	?>
		</p>
	</body>

</html>
Return current item: Combine XML, Files and SQLite with PHP 5