require_once "wacs.php"; require_once 'DB.php'; $wacs = new Wacs; |
// read the Wacs configuration files $wacs->read_conf(); // check the auth(entication and authorisation) of this user $wacs->check_auth( $_SERVER['REMOTE_ADDR'], 0 ); |
// database initialisation
$dbienv = $wacs->conf_get_attr("database","dbienvvar");
if( ! empty( $dbienv ))
{
putenv($dbienv."=".$wacs->conf_get_attr("database","dbienvvalue"));
}
$dbhandle= DB::connect( $wacs->conf_get_attr("database","phpdbconnect") );
if( DB::iserror($dbhandle))
{
print "Can't connect to database\n";
}
|
// do db select
// 0 1 2 3
$results = $dbhandle->getAll("select mname, modelno, mbigimage, mimage from ".
$wacs->conf_get_attr("tables","models").
" where mflag = 'C' order by mname");
|
echo "<ul>\n";
while( isset( $results[$entryno] ))
{
echo "<li>";
echo "<a href=\"".$wacs->conf_get_attr("server","cgiurl");
echo "wacsmpthumbs/".$results[$entryno][1]."\">";
echo $results[$entryno][0]."</a></li>\n";
$entryno++;
}
echo "</ul>\n";
|
For further information on programming for Wacs, refer to the regular wacs documentation. The APIs provided by the perl and php implementations are function call identical whereever possible.