Some knowledge of how the WACS system works is required in order to make use of this interface module, not least the data structures and basic API calls. All of this documentation is included in the main Wacs distribution and is available at the project page on sourceforge. For more information on WACS itself and this documentation, please visit the project page on sourceforge (http://wacsip.sourceforge.net/). What follows is a very brief introduction to using Wacs from a PHP application/web page; for more details see both the API reference section and the sample programs included with wacs-php.
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'], 1 ); |
// 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"; |
require_once "wacsui.php"; $wacsui = new WacsUI; |
If you then want to use a given function, in this instance describeher
(which produces a readable description of the model), you would use:
print $wacsui->describeher( array( 'hair'=>$results[$entryno][4], 'length'=>$results[$entryno][5], 'titsize'=>$results[$entryno][6], 'pussy'=>$results[$entryno][7], 'race'=>$results[$entryno][8], 'build'=>$results[$entryno][9], 'height'=>$results[$entryno][10], 'weight'=>$results[$entryno][11], 'occupation'=>$results[$entryno][12]))."\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.