All pastes #482722 Raw Edit

Something

public php v1 · immutable
·published 2007-05-11 11:54 UTC
rendered paste body
<?php// Make DB connection$db = mysql_connect() or die(mysql_error());;mysql_select_db('w_lookup');// Check for player data$handle = mysql_query("SELECT * FROM w_lookup WHERE name='".$_GET['name']."' AND dim='".$_GET['dim']."' LIMIT 1");// Check if DB entry existsif($info = mysql_fetch_array($handle)) {	// Make sure oue bot is actively refreshing status	if($info['stamp']>=mktime()-5) {		// Check status every 3 seconds until bot updates		while($info['status']==3) {			sleep(3);			$handle = mysql_query("SELECT * FROM w_lookup WHERE name='".$_GET['name']."' AND dim='".$_GET['dim']."' LIMIT 1");			$info = mysql_fetch_array($handle);			$info['status'] = 0;		}		switch($info['status']) {			case 0:			// Return our code for offline player			$c = '<font color="#FF0000">Offline</font>';			break;			case 1:			// Return our code for online player			$c = '<font color="#00FF00">Online</font>';			break;			default:			// Return error if bot returns an unknown status ($info['status'] != 0|1|3)			$c = 'Error Unknown status ('.$info['status'].') returned';		}	} 	// Return error if bot hasn't updated within 5 seconds	else $c = 'Status unavailable at this time. Err (Bot failed to update)';// Return error if an entry for that player has not been added to our database via our main script} else $c = 'Status unavailable at this time. Err (No player '.$_GET['name'].' in DB)';// Send our response back to main scriptecho $c;?>