<?php

$date = time();

$be=mysql_fetch_array(mysql_query("SELECT * FROM `user` WHERE `id`= '$user[id]' LIMIT 1"));
$k_point=intval((time()-$be['regenerator'])/5);
if($k_point>=1){
$newhp=$user[hp]+1*$k_point;
$newmp=$user[mp]+1*$k_point;
if($newhp>$user[hpfull]){$newhp=$user[hpfull];}
if($newmp>$user[mpfull]){$newmp=$user[mpfull];}
mysql_query("UPDATE  `user` SET `hp`= '$newhp',`mp`='$newmp',`regenerator` = '$date' WHERE `id`='$user[id]' LIMIT 1");
}
?>
