All pastes #824269 Raw Edit

Stuff

public text v1 · immutable
·published 2007-12-19 21:43 UTC
rendered paste body
<?php 
	
	$db_select = mysql_select_db("fraz0r_wrdp4", $connection);
if (!$db_select) {
	die("Unable to select database: " . mysql_error());
}

$update_hits = mysql_query("UPDATE wp_usermeta SET user_hits = user_hits +1 WHERE umeta_id = 1", $connection);
if (!$update_hits) {
	die("Unable to update user hits: " . mysql_error());
}

//updates temporary hits which apply credits to the authors account when they reach a certain limit

$update_temp_hits = mysql_query("UPDATE wp_usermeta SET temp_hits = temp_hits +1 WHERE umeta_id = 1", $connection);
if (!$update_temp_hits) {
	die("Unable to update users temporary hits: " . mysql_error());
}

$temp_hits_count = mysql_query("SELECT temp_hits FROM wp_usermeta WHERE umeta_id = 1");

$temp_hits_result = mysql_fetch_array($temp_hits_count);
if ($update_temp_hits >= 100) {
	echo "YES";
	echo $temp_hits_result["temp_hits"];
	mysql_query("UPDATE wp_usermeta SET user_credits = user_credits +5 WHERE umeta_id = 1");
	mysql_query("UPDATE wp_usermeta SET temp_hits = '0' WHERE umeta_id = 1");
	}

$result = mysql_query("SELECT user_hits FROM wp_usermeta WHERE umeta_id = 1", $connection);
if (!$result){
	die("Unable to query the database: " .mysql_error());
}

while($row = mysql_fetch_array($result)) {
	echo $row["user_hits"];
}

?>