Tiffu Beschreibung
Version vom 21:51, 9. Aug. 2010 bei RolfNeumann (Diskussion | Beiträge)
Tiffu.com
...
API
Beispiel:
include( "../cfg.php" ); include( "../mysqldb.php" ); include( "tiffuapi.php" ); define( 'MAN_UPD_ALL', 'af6f3fa8682bc984d73c5edc0e39b162' ); define( 'MAN_UPD_YESTERDAY', 'aada7cee2dbfe6893e3dbdb29c10db45' ); define( 'MAN_UPD_TODAY', 'f44b4df415ba75eb2aa760d6d069ab7a' ); define( 'STATES_PUBLIC', 'f2a223aedca3bbbd6e2552477dfa9007' ); define( 'STATES_ALL', '5bde43a643a43448049500a2b71cd17b' ); define( 'REG_USER', 'ba7c61f9099a19234b2c5db969fddd02' ); define( 'FRESH_USER', '827d52af2c2c38c8a91aa7480a263ed4' ); $db = new MySQLDB( $_CFG['DB_HOST'], $_CFG['DB_NAME'], $_CFG['DB_USER'], $_CFG['DB_PASS'] ); $request = new TiffuAPI( 'tiffu', '******' ); function getCount( $sqlcmd ) { global $db; $query = $db->query( $sqlcmd ); return $query->getFirstField(); } function updateVar( $key, $value ) { global $request; if( !$request->setVar( $key, $value ) ) echo $request->getError()."<br>\n"; else echo "success<br>\n"; } $reg_user = getCount( "select count(*) from state_user" ); $states_all = getCount( "select count(*) from state_info" ); $states_public = getCount( "select count(*) from state_info where state_privacy=0" ); $man_upd_all = getCount( "select count(*) from state_log" ); $man_upd_today = getCount( "select count(*) from state_log where log_time > substr( NOW(), 1, 10)" ); $fresh_user = getCount( "select user_nick from state_user order by user_id desc limit 0,1" ); echo "reg_user: $reg_user<br>\n"; updateVar( REG_USER, $reg_user ); echo "states_all: $states_all<br>\n"; updateVar( STATES_ALL, $states_all ); echo "states_public: $states_public<br>\n"; updateVar( STATES_PUBLIC, $states_public ); echo "man_upd_all: $man_upd_all<br>\n"; updateVar( MAN_UPD_ALL, $man_upd_all ); echo "man_upd_today: $man_upd_today<br>\n"; updateVar( MAN_UPD_TODAY, $man_upd_today ); echo "fresh_user: $fresh_user<br>\n"; updateVar( FRESH_USER, $fresh_user );